Skip to content

Commit

Permalink
fixup runtime detection for kyber
Browse files Browse the repository at this point in the history
  • Loading branch information
franziskuskiefer committed Mar 19, 2024
1 parent 4f80d73 commit bee1b59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 4 additions & 0 deletions libcrux/include/libcrux_hacl_glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion libcrux/include/libcrux_kyber.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 7 additions & 4 deletions libcrux/src/libcrux_hacl_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -56,15 +55,19 @@ 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();
uint64_t* st1 = Hacl_Hash_SHA3_Scalar_state_malloc();
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
Expand Down

0 comments on commit bee1b59

Please sign in to comment.