From e9f1d694a97717987e8bb67d33fef800100082b2 Mon Sep 17 00:00:00 2001 From: Tiago Oliveira Date: Fri, 9 Feb 2024 13:45:56 +0100 Subject: [PATCH] mlkem: poly.jinc update from https://github.com/formosa-crypto/hakyber/pull/20 --- src/crypto_kem/mlkem/mlkem768/amd64/ref/poly.jinc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/crypto_kem/mlkem/mlkem768/amd64/ref/poly.jinc b/src/crypto_kem/mlkem/mlkem768/amd64/ref/poly.jinc index ca421d99..cd22db7c 100644 --- a/src/crypto_kem/mlkem/mlkem768/amd64/ref/poly.jinc +++ b/src/crypto_kem/mlkem/mlkem768/amd64/ref/poly.jinc @@ -420,7 +420,7 @@ fn _poly_getnoise(reg ptr u16[MLKEM_N] rp, reg ptr u8[MLKEM_SYMBYTES] seed, reg reg u64 outlen; reg u8 c,a,b; reg u16 t; - reg u64 i j; + reg u64 i; inline int k; stack ptr u16[MLKEM_N] srp; @@ -439,9 +439,8 @@ fn _poly_getnoise(reg ptr u16[MLKEM_N] rp, reg ptr u8[MLKEM_SYMBYTES] seed, reg rp = srp; i = 0; - j = 0; while (i < 128) { - c = buf[(int)i]; + c = buf[i]; a = c; a &= 0x55; @@ -456,7 +455,7 @@ fn _poly_getnoise(reg ptr u16[MLKEM_N] rp, reg ptr u8[MLKEM_SYMBYTES] seed, reg b &= 0x3; a -= b; t = (16s)a; - rp[(int)j] = t; + rp[2 * i] = t; a = c; a >>= 4; a &= 0x3; @@ -464,10 +463,8 @@ fn _poly_getnoise(reg ptr u16[MLKEM_N] rp, reg ptr u8[MLKEM_SYMBYTES] seed, reg b &= 0x3; a -= b; t = (16s)a; - j += 1; - rp[(int)j] = t; + rp[2 * i + 1] = t; i += 1; - j += 1; } return rp;