From bee1b5905dba1e7d6ab1a010ae3578b990b52f85 Mon Sep 17 00:00:00 2001 From: Franziskus Kiefer Date: Tue, 19 Mar 2024 14:59:59 +0100 Subject: [PATCH] fixup runtime detection for kyber --- libcrux/include/libcrux_hacl_glue.h | 4 ++++ libcrux/include/libcrux_kyber.h | 2 +- libcrux/src/libcrux_hacl_glue.c | 11 +++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libcrux/include/libcrux_hacl_glue.h b/libcrux/include/libcrux_hacl_glue.h index 15b7e302..7f7ba34b 100644 --- a/libcrux/include/libcrux_hacl_glue.h +++ b/libcrux/include/libcrux_hacl_glue.h @@ -12,6 +12,10 @@ typedef struct libcrux_digest_incremental_x4_Shake128StateX4 { Lib_IntVector_Intrinsics_vec256* x4; + uint64_t* st0; + uint64_t* st1; + uint64_t* st2; + uint64_t* st3; } libcrux_digest_incremental_x4_Shake128StateX4; #else typedef struct libcrux_digest_incremental_x4_Shake128StateX4 diff --git a/libcrux/include/libcrux_kyber.h b/libcrux/include/libcrux_kyber.h index 6fcb4f40..eb8f8b40 100644 --- a/libcrux/include/libcrux_kyber.h +++ b/libcrux/include/libcrux_kyber.h @@ -114,7 +114,7 @@ extern void libcrux_digest_incremental_x4__libcrux__digest__incremental_x4__Shake128StateX4__absorb_final_( size_t x0, libcrux_digest_incremental_x4_Shake128StateX4* x1, - Eurydice_slice* x2); + Eurydice_slice x2[3U]); extern void libcrux_digest_incremental_x4__libcrux__digest__incremental_x4__Shake128StateX4__free_memory( diff --git a/libcrux/src/libcrux_hacl_glue.c b/libcrux/src/libcrux_hacl_glue.c index bac2a520..f7ee8113 100644 --- a/libcrux/src/libcrux_hacl_glue.c +++ b/libcrux/src/libcrux_hacl_glue.c @@ -7,9 +7,8 @@ #ifdef HACL_CAN_COMPILE_VEC256 #include "EverCrypt_AutoConfig2.h" #include "Hacl_Hash_SHA3_Simd256.h" -#else -#include "Hacl_Hash_SHA3_Scalar.h" #endif +#include "Hacl_Hash_SHA3_Scalar.h" bool libcrux_platform_simd256_support(void) @@ -56,7 +55,11 @@ libcrux_digest_incremental_x4__libcrux__digest__incremental_x4__Shake128StateX4_ if (libcrux_platform_simd256_support()) { return (libcrux_digest_incremental_x4_Shake128StateX4){ .x4 = - (Lib_IntVector_Intrinsics_vec256*)Hacl_Hash_SHA3_Simd256_state_malloc() + (Lib_IntVector_Intrinsics_vec256*)Hacl_Hash_SHA3_Simd256_state_malloc(), + .st0 = NULL, + .st1 = NULL, + .st2 = NULL, + .st3 = NULL, }; } else { uint64_t* st0 = Hacl_Hash_SHA3_Scalar_state_malloc(); @@ -64,7 +67,7 @@ libcrux_digest_incremental_x4__libcrux__digest__incremental_x4__Shake128StateX4_ uint64_t* st2 = Hacl_Hash_SHA3_Scalar_state_malloc(); uint64_t* st3 = Hacl_Hash_SHA3_Scalar_state_malloc(); return (libcrux_digest_incremental_x4_Shake128StateX4){ - .st0 = st0, .st1 = st1, .st2 = st2, .st3 = st3 + .x4 = NULL, .st0 = st0, .st1 = st1, .st2 = st2, .st3 = st3 }; } #else