Skip to content

Commit 4f87a89

Browse files
committed
ML-KEM/Kyber: fix for big-endian
Don't pull apart the nibbles when big-endian in reject uniform C code.
1 parent 5ecacfd commit 4f87a89

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

wolfcrypt/src/wc_mlkem_poly.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3166,7 +3166,8 @@ static unsigned int mlkem_rej_uniform_c(sword16* p, unsigned int len,
31663166
unsigned int i;
31673167
unsigned int j;
31683168

3169-
#if defined(WOLFSSL_MLKEM_SMALL) || !defined(WC_64BIT_CPU)
3169+
#if defined(WOLFSSL_MLKEM_SMALL) || !defined(WC_64BIT_CPU) || \
3170+
defined(BIG_ENDIAN_ORDER)
31703171
/* Keep sampling until maximum number of integers reached or buffer used up.
31713172
* Step 4. */
31723173
for (i = 0, j = 0; (i < len) && (j <= rLen - 3); j += 3) {

0 commit comments

Comments
 (0)