diff --git a/crypto_kem/kyber512/m4fspeed/poly.c b/crypto_kem/kyber512/m4fspeed/poly.c index f9d408b8..29861e69 100644 --- a/crypto_kem/kyber512/m4fspeed/poly.c +++ b/crypto_kem/kyber512/m4fspeed/poly.c @@ -237,7 +237,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { int i, j, k = 0; #if (KYBER_POLYCOMPRESSEDBYTES == 128) - for (i = 0; i < KYBER_N; i += 8) { + for(i=0;icoeffs[8*i+j]; @@ -256,8 +256,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { k += 4; } #elif (KYBER_POLYCOMPRESSEDBYTES == 160) - for(i=0;icoeffs[8*i+j]; diff --git a/crypto_kem/kyber512/m4fstack/poly.c b/crypto_kem/kyber512/m4fstack/poly.c index f42154ff..cc849592 100644 --- a/crypto_kem/kyber512/m4fstack/poly.c +++ b/crypto_kem/kyber512/m4fstack/poly.c @@ -237,7 +237,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { int i, j, k = 0; #if (KYBER_POLYCOMPRESSEDBYTES == 128) - for (i = 0; i < KYBER_N; i += 8) { + for(i=0;icoeffs[8*i+j]; @@ -256,8 +256,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { k += 4; } #elif (KYBER_POLYCOMPRESSEDBYTES == 160) - for(i=0;icoeffs[8*i+j]; diff --git a/crypto_kem/kyber768/m4fspeed/kem.c b/crypto_kem/kyber768/m4fspeed/kem.c index 7e6474e2..5cfa62bc 100644 --- a/crypto_kem/kyber768/m4fspeed/kem.c +++ b/crypto_kem/kyber768/m4fspeed/kem.c @@ -138,7 +138,6 @@ int crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned ch uint8_t buf[2 * KYBER_SYMBYTES]; /* Will contain key, coins */ uint8_t kr[2 * KYBER_SYMBYTES]; - uint8_t cmp[KYBER_CIPHERTEXTBYTES + KYBER_SYMBYTES]; const uint8_t *pk = sk + KYBER_INDCPA_SECRETKEYBYTES; indcpa_dec(buf, ct, sk); @@ -148,9 +147,7 @@ int crypto_kem_dec(unsigned char *ss, const unsigned char *ct, const unsigned ch hash_g(kr, buf, 2 * KYBER_SYMBYTES); /* coins are in kr+KYBER_SYMBYTES */ - indcpa_enc(cmp, buf, pk, kr + KYBER_SYMBYTES); - - fail = verify(ct, cmp, KYBER_CIPHERTEXTBYTES); + fail = indcpa_enc_cmp(ct, buf, pk, kr + KYBER_SYMBYTES); /* Compute rejection key */ rkprf(ss, sk + KYBER_SECRETKEYBYTES - KYBER_SYMBYTES, ct); diff --git a/crypto_kem/kyber768/m4fspeed/poly.c b/crypto_kem/kyber768/m4fspeed/poly.c index 9864534a..f73f1acd 100644 --- a/crypto_kem/kyber768/m4fspeed/poly.c +++ b/crypto_kem/kyber768/m4fspeed/poly.c @@ -237,7 +237,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { int i, j, k = 0; #if (KYBER_POLYCOMPRESSEDBYTES == 128) - for (i = 0; i < KYBER_N; i += 8) { + for(i=0;icoeffs[8*i+j]; @@ -256,8 +256,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { k += 4; } #elif (KYBER_POLYCOMPRESSEDBYTES == 160) - for(i=0;icoeffs[8*i+j]; diff --git a/crypto_kem/kyber768/m4fstack/poly.c b/crypto_kem/kyber768/m4fstack/poly.c index 91fab840..29b959f7 100644 --- a/crypto_kem/kyber768/m4fstack/poly.c +++ b/crypto_kem/kyber768/m4fstack/poly.c @@ -237,7 +237,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { int i, j, k = 0; #if (KYBER_POLYCOMPRESSEDBYTES == 128) - for (i = 0; i < KYBER_N; i += 8) { + for(i=0;icoeffs[8*i+j]; @@ -256,8 +256,7 @@ int cmp_poly_compress(const unsigned char *r, poly *a) { k += 4; } #elif (KYBER_POLYCOMPRESSEDBYTES == 160) - for(i=0;icoeffs[8*i+j];