mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-10-24 04:09:07 +03:00
falcon_native_check_key converted f and g into [0, q) ahead of the NTT with a branch on the sign of each secret coefficient. It now adds q under a mask taken from the sign bit, as falcon_compute_public already does. key->level is a public field, and a level written into it without wc_falcon_set_level() could make an import, export or DER encode copy past the key buffers: with dynamic keys they are sized for the old level, and in a level-restricted build the inline arrays only hold the level that was built. falcon_level_params now takes the key and, with dynamic keys, checks the level against the recorded kSz; the new falcon_level_ok() puts the same check in front of every public function that touches p or k. Both sit outside the native-only block, since crypto-callback-only builds keep those public functions. The signing caches had the same problem, and falcon_sign_key_setup now drops a cache whose recorded length does not fit the key's current level instead of reusing it. test_wc_falcon_level_overwrite covers all of it. The Falcon white-box reported failures as ordinary notes, and the CI step grepped for note wording that 11 of the failure messages did not contain. Failures now print [wb][FAIL] and the run ends with "done (N notes, with failures)", like the other white-boxes; notes are left for the residual decisions only. The CI step greps that line and builds the white-box with ASan and UBSan. Nothing in CI built Falcon with WOLF_CRYPTO_CB_ONLY_FALCON, so cryptocb-only.yml gains a falcon-onlycb-no-swdev entry. swdev has no Falcon handlers yet, so the entry builds without it and runs the tests that need no device. Smaller items: - falcon_sm_intt_p takes logn and forms n^-1 from p - 1 = 5 * 2^13, so it needs no division (a library call on Cortex-M0). - wb_sm_sign_core_err wipes its scratch after signing and the basis when key generation fails. - scripts/falcon_sm_tables.py parses its arguments with argparse, so --help works and an unknown option is an error rather than printing the tables.