From 61a825107417a4ed64370e574eb0700ff0f0dd92 Mon Sep 17 00:00:00 2001 From: Stephan Mueller Date: Thu, 9 Nov 2023 06:37:57 +0100 Subject: [PATCH] fix kernel compilation complaints Signed-off-by: Stephan Mueller --- kem/tests/kyber_kem_x25519_tester.c | 2 +- signature/src/avx2/dilithium_signature_avx2.c | 3 +-- signature/src/dilithium_signature_impl.h | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/kem/tests/kyber_kem_x25519_tester.c b/kem/tests/kyber_kem_x25519_tester.c index 36597230..d18d4a70 100644 --- a/kem/tests/kyber_kem_x25519_tester.c +++ b/kem/tests/kyber_kem_x25519_tester.c @@ -67,9 +67,9 @@ static int kyber_kem_double_tester(void) struct lc_kyber_x25519_ct ct; uint8_t ss1[sizeof(ss_exp)], ss2[sizeof(ss_exp)]; }; + int ret; LC_DECLARE_MEM(ws, struct workspace, sizeof(uint64_t)); LC_SELFTEST_DRNG_CTX_ON_STACK(selftest_rng); - int ret; CKINT(lc_kyber_x25519_keypair(&ws->pk, &ws->sk, selftest_rng)); diff --git a/signature/src/avx2/dilithium_signature_avx2.c b/signature/src/avx2/dilithium_signature_avx2.c index 5188baec..f1b9b7a6 100644 --- a/signature/src/avx2/dilithium_signature_avx2.c +++ b/signature/src/avx2/dilithium_signature_avx2.c @@ -236,14 +236,13 @@ static int lc_dilithium_sign_avx2_internal(struct lc_dilithium_sig *sig, } tmpv; keccakx4_state keccak_state; }; - - LC_DECLARE_MEM(ws, struct workspace_sign, 32); unsigned int i, n, pos; uint8_t *rho, *key, *mu, *rhoprime, *rnd; uint8_t *hint = sig->sig + LC_DILITHIUM_CTILDE_BYTES + LC_DILITHIUM_L * LC_DILITHIUM_POLYZ_PACKEDBYTES; uint64_t nonce = 0; int ret = 0; + LC_DECLARE_MEM(ws, struct workspace_sign, 32); /* Skip tr which is in rho + LC_DILITHIUM_SEEDBYTES; */ key = ws->seedbuf; diff --git a/signature/src/dilithium_signature_impl.h b/signature/src/dilithium_signature_impl.h index f67eb2db..9ba675e4 100644 --- a/signature/src/dilithium_signature_impl.h +++ b/signature/src/dilithium_signature_impl.h @@ -201,13 +201,13 @@ static int lc_dilithium_sign_internal(struct lc_dilithium_sig *sig, uint8_t poly_uniform_buf[WS_POLY_UNIFORM_BUF_SIZE]; } tmp; }; - LC_DECLARE_MEM(ws, struct workspace_sign, sizeof(uint64_t)); unsigned int n; uint8_t *key, *mu, *rhoprime, *rnd; uint16_t nonce = 0; /* The first bytes of the key is rho. */ const uint8_t *rho; int ret = 0; + LC_DECLARE_MEM(ws, struct workspace_sign, sizeof(uint64_t)); key = ws->seedbuf; rnd = key + LC_DILITHIUM_SEEDBYTES; @@ -469,12 +469,12 @@ static int lc_dilithium_verify_internal(const struct lc_dilithium_sig *sig, uint8_t poly_challenge_buf[POLY_CHALLENGE_BYTES]; } tmp; }; - LC_DECLARE_MEM(ws, struct workspace_verify, sizeof(uint64_t)); /* The first bytes of the signature is c~ and thus contains c1. */ const uint8_t *c1 = sig->sig; /* The first bytes of the key is rho. */ const uint8_t *rho = pk->pk; int ret = 0; + LC_DECLARE_MEM(ws, struct workspace_verify, sizeof(uint64_t)); polyvec_matrix_expand(ws->mat, rho, ws->tmp.poly_uniform_buf);