From f2d79b554e55efe64eb7c22ce31065532682f44d Mon Sep 17 00:00:00 2001 From: Daniele Lacamera Date: Wed, 1 Jul 2026 10:59:28 +0200 Subject: [PATCH] Falcon: fix codespell and source-text CI checks - codespell.yml: add "fpr"/"FPR" to ignore_words_list. "fpr" is the Falcon reference's canonical name for the floating-point primitive seam and appears hundreds of times across the sources; it is not a typo. - wc_falcon.c: rename local "clen" -> "compLen" (codespell flagged clen) and replace a non-ASCII em-dash in a comment with "--" (check-source-text 8-bit byte violation). - wc_falcon_bigint.c: fix typos "morever" -> "moreover", "Mutiply" -> "Multiply". - wc_falcon_codec.c: reword "are statics in" -> "are static functions in" (codespell flagged "statics"). --- .github/workflows/codespell.yml | 2 +- wolfcrypt/src/wc_falcon.c | 12 ++++++------ wolfcrypt/src/wc_falcon_bigint.c | 4 ++-- wolfcrypt/src/wc_falcon_codec.c | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml index 7c772054b0..b1aa6803d7 100644 --- a/.github/workflows/codespell.yml +++ b/.github/workflows/codespell.yml @@ -24,7 +24,7 @@ jobs: check_filenames: true check_hidden: true # Add comma separated list of words that occur multiple times that should be ignored (sorted alphabetically, case sensitive) - ignore_words_list: adin,ameba,aNULL,brunch,carryIn,chainG,ciph,cLen,cliKs,dout,haveA,inCreated,inOut,inout,larg,LEAPYEAR,Merget,optionA,parm,parms,repid,rIn,userA,ser,siz,te,Te,HSI,failT,toLen,vor, + ignore_words_list: adin,ameba,aNULL,brunch,carryIn,chainG,ciph,cLen,cliKs,dout,FPR,fpr,haveA,inCreated,inOut,inout,larg,LEAPYEAR,Merget,optionA,parm,parms,repid,rIn,userA,ser,siz,te,Te,HSI,failT,toLen,vor, # The exclude_file contains lines of code that should be ignored. This is useful for individual lines which have non-words that can safely be ignored. exclude_file: '.codespellexcludelines' # To skip files entirely from being processed, add it to the following list: diff --git a/wolfcrypt/src/wc_falcon.c b/wolfcrypt/src/wc_falcon.c index 79600900ff..388648014d 100644 --- a/wolfcrypt/src/wc_falcon.c +++ b/wolfcrypt/src/wc_falcon.c @@ -105,7 +105,7 @@ static void falcon_build_tables(int logn, word32 psi, word16* zetas, /* Twiddle tables are identical for every verification at a given level, so * compute them once and cache them (the previous code rebuilt them per call - * via O(n) modular exponentiations — the dominant verify cost). The lazy-init + * via O(n) modular exponentiations -- the dominant verify cost). The lazy-init * race is benign: the values are deterministic, so concurrent first-callers * write identical data. */ static word16 falcon_zetas_l1[FALCON_LEVEL1_N]; @@ -541,7 +541,7 @@ int falcon_native_sign_msg(const byte* in, word32 inLen, byte* out, word32* outL byte nonce[FALCON_NONCE_SIZE]; void* heap; int attempt, haveSpc = 0; - size_t clen = 0; + size_t compLen = 0; if ((in == NULL && inLen != 0) || out == NULL || outLen == NULL || key == NULL || rng == NULL) { @@ -615,17 +615,17 @@ int falcon_native_sign_msg(const byte* in, word32 inLen, byte* out, word32* outL } out[0] = (byte)(FALCON_SIG_HEAD_COMPRESSED | logn); XMEMCPY(out + 1, nonce, FALCON_NONCE_SIZE); - clen = falcon_comp_encode(out + 1 + FALCON_NONCE_SIZE, + compLen = falcon_comp_encode(out + 1 + FALCON_NONCE_SIZE, (size_t)(*outLen - 1 - FALCON_NONCE_SIZE), s2, logn); - if (clen != 0) { + if (compLen != 0) { break; } } - if (clen == 0) { + if (compLen == 0) { ret = BUFFER_E; goto out; } - *outLen = (word32)(1 + FALCON_NONCE_SIZE + clen); + *outLen = (word32)(1 + FALCON_NONCE_SIZE + compLen); out: /* Always zeroize: the SHAKE sponge may hold seed-derived state even if diff --git a/wolfcrypt/src/wc_falcon_bigint.c b/wolfcrypt/src/wc_falcon_bigint.c index 48ec013538..fa5a25f322 100644 --- a/wolfcrypt/src/wc_falcon_bigint.c +++ b/wolfcrypt/src/wc_falcon_bigint.c @@ -973,7 +973,7 @@ void modp_iNTT2_ext(word32* a, size_t stride, const word32* igm, /* * We need 1/n in Montgomery representation, i.e. R/n. Since - * 1 <= logn <= 10, R/n is an integer; morever, R/n <= 2^30 < p, + * 1 <= logn <= 10, R/n is an integer; moreover, R/n <= 2^30 < p, * thus a simple shift will do. */ ni = (word32)1 << (31 - logn); @@ -1011,7 +1011,7 @@ word32 zint_sub(word32* a, const word32* b, size_t len, word32 ctl) } /* - * Mutiply the provided big integer m with a small value x. + * Multiply the provided big integer m with a small value x. * This function assumes that x < 2^31. The carry word is returned. */ word32 zint_mul_small(word32* m, size_t mlen, word32 x) diff --git a/wolfcrypt/src/wc_falcon_codec.c b/wolfcrypt/src/wc_falcon_codec.c index ee9f6e64b0..f135b3c180 100644 --- a/wolfcrypt/src/wc_falcon_codec.c +++ b/wolfcrypt/src/wc_falcon_codec.c @@ -24,8 +24,8 @@ * implementation (codec.c): modq_encode, comp_encode, trim_i8_encode and * trim_i8_decode, plus the secret-key decoder that drives them. * - * The verification-side decoders (modq_decode, comp_decode) are statics in - * wc_falcon.c and are deliberately not duplicated here. */ + * The verification-side decoders (modq_decode, comp_decode) are static + * functions in wc_falcon.c and are deliberately not duplicated here. */ #include