Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive constant-time arithmetic changes across ECC, six SP backends, and assembly implementations require specialist cryptographic review and target-specific correctness and side-channel validation beyond source inspection.
No open issues 🎉
What changed in this PR
This PR strengthens side-channel protection in wolfCrypt’s SAKKE implementation through constant-time arithmetic and cache-resistant lookups, with an optional RNG interface for blinding.
Changes:
- Harden secret-dependent P1024 operations across supported backends and use constant-time reduction in ECC point mapping.
- Add the
wc_SetSakkeRng()interface, documentation, and tests for blinded operations. - Correct x86 AVX2 table-read bounds, add vector-state cleanup, and adjust P1024 guards and key-generation buffer sizing.
| File | Description |
|---|---|
wolfssl/wolfcrypt/sakke.h |
Declare the RNG setter and store a non-owned RNG pointer. |
wolfssl/wolfcrypt/ecc.h |
Allow extra random bytes to reduce key-generation bias. |
wolfcrypt/test/test.c |
Test RNG setter arguments and repeat SAKKE operations with blinding. |
wolfcrypt/src/sp_x86_64.c |
Harden P1024 lookups, multiplication, and exponentiation. |
wolfcrypt/src/sp_x86_64_asm.S |
Add AVX2 lookups, fix read bounds, and clear upper vector state. |
wolfcrypt/src/sp_x86_64_asm.asm |
Apply equivalent AVX2 changes to Windows assembly. |
wolfcrypt/src/sp_riscv64.c |
Harden RISC-V P1024 lookups and secret exponentiation. |
wolfcrypt/src/sp_c64.c |
Harden portable 64-bit P1024 operations. |
wolfcrypt/src/sp_c32.c |
Harden portable 32-bit P1024 operations. |
wolfcrypt/src/sp_armthumb.c |
Harden ARM Thumb P1024 operations. |
wolfcrypt/src/sp_arm64.c |
Harden ARM64 P1024 operations. |
wolfcrypt/src/ecc.c |
Keep constant-time point mapping in Montgomery form until final conversion. |
doc/dox_comments/header_files/sakke.h |
Document RNG configuration, ownership, and intended performance benefits. |
doc/dox_comments/header_files/doxygen_groups.h |
Recommend RNG setup in SAKKE usage flows. |
Review effort: Balanced
|
f121bbe to
05cff92
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Constant-time changes across five arithmetic backends and two assembly formats require human security review and target-specific correctness and side-channel validation beyond the supplied configure-only testing.
No open issues 🎉
Review effort: Balanced
203ea06 to
6a7bfe1
Compare
- Without an RNG, operations on secrets (z_T, RSK, r) are constant time: reduction, inversion, field add/sub, ModExp and point mapping. - New wc_SetSakkeRng(): blinding allows faster algorithms to be used. wc_MakeSakkeRsk() uses it rather than instantiating an RNG per call. - Table lookups cache resistant unless WC_NO_CACHE_RESISTANT. - SP P1024: constant time lookups (AVX2 on x86_64), table multiply and ModExp; fix AVX2 entry over-read, add vzeroupper; fix p1024_order guard for NO_ECC_CHECK_KEY builds. - ecc_map_ex() constant time branch uses constant time reduction. - Fix zMont not reset when making or importing a key. - Tests and docs for wc_SetSakkeRng().
6a7bfe1 to
e039009
Compare
Description
Fixes zd#22803
Testing
./configure --enable-sakke