Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to FIPS204 (needed for ACVP testing) #86

Open
wants to merge 1 commit into
base: standard
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions avx2/poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,16 +664,16 @@ void poly_uniform_gamma1_4x(poly *a0,
* SHAKE256(seed).
*
* Arguments: - poly *c: pointer to output polynomial
* - const uint8_t mu[]: byte array containing seed of length SEEDBYTES
* - const uint8_t mu[]: byte array containing seed of length CTILDEBYTES
**************************************************/
void poly_challenge(poly * restrict c, const uint8_t seed[SEEDBYTES]) {
void poly_challenge(poly * restrict c, const uint8_t seed[CTILDEBYTES]) {
unsigned int i, b, pos;
uint64_t signs;
ALIGNED_UINT8(SHAKE256_RATE) buf;
keccak_state state;

shake256_init(&state);
shake256_absorb(&state, seed, SEEDBYTES);
shake256_absorb(&state, seed, CTILDEBYTES);
shake256_finalize(&state);
shake256_squeezeblocks(buf.coeffs, 1, &state);

Expand Down
2 changes: 1 addition & 1 deletion avx2/poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void poly_uniform_gamma1_preinit(poly *a, stream256_state *state);
#define poly_uniform_gamma1 DILITHIUM_NAMESPACE(poly_uniform_gamma1)
void poly_uniform_gamma1(poly *a, const uint8_t seed[CRHBYTES], uint16_t nonce);
#define poly_challenge DILITHIUM_NAMESPACE(poly_challenge)
void poly_challenge(poly *c, const uint8_t seed[SEEDBYTES]);
void poly_challenge(poly *c, const uint8_t seed[CTILDEBYTES]);

#define poly_uniform_4x DILITHIUM_NAMESPACE(poly_uniform_4x)
void poly_uniform_4x(poly *a0,
Expand Down
6 changes: 3 additions & 3 deletions ref/poly.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,16 +484,16 @@ void poly_uniform_gamma1(poly *a,
* SHAKE256(seed).
*
* Arguments: - poly *c: pointer to output polynomial
* - const uint8_t mu[]: byte array containing seed of length SEEDBYTES
* - const uint8_t mu[]: byte array containing seed of length CTILDEBYTES
**************************************************/
void poly_challenge(poly *c, const uint8_t seed[SEEDBYTES]) {
void poly_challenge(poly *c, const uint8_t seed[CTILDEBYTES]) {
unsigned int i, b, pos;
uint64_t signs;
uint8_t buf[SHAKE256_RATE];
keccak_state state;

shake256_init(&state);
shake256_absorb(&state, seed, SEEDBYTES);
shake256_absorb(&state, seed, CTILDEBYTES);
shake256_finalize(&state);
shake256_squeezeblocks(buf, 1, &state);

Expand Down
2 changes: 1 addition & 1 deletion ref/poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void poly_uniform_gamma1(poly *a,
const uint8_t seed[CRHBYTES],
uint16_t nonce);
#define poly_challenge DILITHIUM_NAMESPACE(poly_challenge)
void poly_challenge(poly *c, const uint8_t seed[SEEDBYTES]);
void poly_challenge(poly *c, const uint8_t seed[CTILDEBYTES]);

#define polyeta_pack DILITHIUM_NAMESPACE(polyeta_pack)
void polyeta_pack(uint8_t *r, const poly *a);
Expand Down
4 changes: 2 additions & 2 deletions ref/sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ int crypto_sign_signature(uint8_t *sig,
shake256_absorb(&state, sig, K*POLYW1_PACKEDBYTES);
shake256_finalize(&state);
shake256_squeeze(sig, CTILDEBYTES, &state);
poly_challenge(&cp, sig); /* uses only the first SEEDBYTES bytes of sig */
poly_challenge(&cp, sig); /* uses only the first CTILDEBYTES bytes of sig */
poly_ntt(&cp);

/* Compute z, reject if it reveals secret */
Expand Down Expand Up @@ -260,7 +260,7 @@ int crypto_sign_verify(const uint8_t *sig,
shake256_squeeze(mu, CRHBYTES, &state);

/* Matrix-vector multiplication; compute Az - c2^dt1 */
poly_challenge(&cp, c); /* uses only the first SEEDBYTES bytes of c */
poly_challenge(&cp, c); /* uses only the first CTILDEBYTES bytes of c */
polyvec_matrix_expand(mat, rho);

polyvecl_ntt(&z);
Expand Down
2 changes: 1 addition & 1 deletion ref/sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include "poly.h"

#define challenge DILITHIUM_NAMESPACE(challenge)
void challenge(poly *c, const uint8_t seed[SEEDBYTES]);
void challenge(poly *c, const uint8_t seed[CTILDEBYTES]);

#define crypto_sign_keypair DILITHIUM_NAMESPACE(keypair)
int crypto_sign_keypair(uint8_t *pk, uint8_t *sk);
Expand Down