From d2c5451f74e74fffaf15782f459e51623224cbd9 Mon Sep 17 00:00:00 2001 From: "Matthias J. Kannwischer" Date: Fri, 6 Dec 2024 11:13:55 +0800 Subject: [PATCH] Port map to canonical (4a980373f96b68a4237c7959918d224cd4062c37) As pointed out by Vincent Hwang in https://github.com/mupq/pqm4/pull/369. --- crypto_kem/ml-kem-512/m4fspeed/poly.c | 1 + crypto_kem/ml-kem-512/m4fstack/poly.c | 1 + crypto_kem/ml-kem-768/m4fspeed/poly.c | 1 + crypto_kem/ml-kem-768/m4fstack/poly.c | 1 + 4 files changed, 4 insertions(+) diff --git a/crypto_kem/ml-kem-512/m4fspeed/poly.c b/crypto_kem/ml-kem-512/m4fspeed/poly.c index 401b26b..5a6d0ab 100644 --- a/crypto_kem/ml-kem-512/m4fspeed/poly.c +++ b/crypto_kem/ml-kem-512/m4fspeed/poly.c @@ -366,6 +366,7 @@ void poly_tobytes(unsigned char *r, poly *a) { int i; uint16_t t0, t1; + poly_reduce(a); poly_reduce(a); for (i = 0; i < KYBER_N / 2; i++) { diff --git a/crypto_kem/ml-kem-512/m4fstack/poly.c b/crypto_kem/ml-kem-512/m4fstack/poly.c index 443fdba..ed54ec8 100644 --- a/crypto_kem/ml-kem-512/m4fstack/poly.c +++ b/crypto_kem/ml-kem-512/m4fstack/poly.c @@ -366,6 +366,7 @@ void poly_tobytes(unsigned char *r, poly *a) { int i; uint16_t t0, t1; + poly_reduce(a); poly_reduce(a); for (i = 0; i < KYBER_N / 2; i++) { diff --git a/crypto_kem/ml-kem-768/m4fspeed/poly.c b/crypto_kem/ml-kem-768/m4fspeed/poly.c index b52060f..bf549ef 100644 --- a/crypto_kem/ml-kem-768/m4fspeed/poly.c +++ b/crypto_kem/ml-kem-768/m4fspeed/poly.c @@ -366,6 +366,7 @@ void poly_tobytes(unsigned char *r, poly *a) { int i; uint16_t t0, t1; + poly_reduce(a); poly_reduce(a); for (i = 0; i < KYBER_N / 2; i++) { diff --git a/crypto_kem/ml-kem-768/m4fstack/poly.c b/crypto_kem/ml-kem-768/m4fstack/poly.c index 35475ad..a5a694a 100644 --- a/crypto_kem/ml-kem-768/m4fstack/poly.c +++ b/crypto_kem/ml-kem-768/m4fstack/poly.c @@ -366,6 +366,7 @@ void poly_tobytes(unsigned char *r, poly *a) { int i; uint16_t t0, t1; + poly_reduce(a); poly_reduce(a); for (i = 0; i < KYBER_N / 2; i++) {