Repository navigation
Conversation
|
There was a problem hiding this comment.
🟡 Changes recommended
Critical secret-dependent timing and memory-access leaks remain in ECC reductions, signing, and shared-secret export, while exponentiation now rejects supported boundary-size moduli.
4 open issues
What changed in this PR
This PR strengthens timing resistance in wolfCrypt’s ECC operations and its TFM and SP arithmetic backends.
Changes:
- Routes ECC point arithmetic, mapping, and signing through constant-time helpers, and uses fixed-length ECDH output encoding.
- Adds fixed-width TFM modular exponentiation, including base-2 and nonblocking paths.
- Revises SP Montgomery reduction with masked subtraction and constant-time result-length calculation.
| File | Description |
|---|---|
wolfssl/wolfcrypt/tfm.h |
Declares constant-time comparison functions for TFM. |
wolfcrypt/src/tfm.c |
Adds fixed-width exponentiation and constant-time reduction and comparison helpers. |
wolfcrypt/src/sp_int.c |
Updates constant-time Montgomery reduction and inversion paths. |
wolfcrypt/src/ecc.c |
Integrates timing-resistant arithmetic into ECC operations and shared-secret encoding. |
Review effort: Balanced
58072bc to
23d0e51
Compare
|
@claude review |
There was a problem hiding this comment.
🟡 Changes recommended
Four critical findings remain: an uninitialized multiplication temporary and capacity violations in multiplication, reduction, and padded export can produce invalid results or access memory out of bounds.
4 open issues
4 resolved since last review
Review effort: Balanced
23d0e51 to
d7e25ec
Compare
|
@claude review |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical defects can cause out-of-bounds memory access, silently incorrect exponentiation results after allocation failures, and secret-dependent timing in elliptic-curve operations.
4 open issues
4 resolved since last review
Review effort: Balanced
d7e25ec to
da600b8
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The newly accepted FP_SIZE / 2-digit modulus boundary lacks regression tests asserting successful returns and known results for both base 2 and a general base, including under ALT_ECC_SIZE and MULX configurations.
1 open issue
4 resolved since last review
Review effort: Balanced
da600b8 to
187715d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Critical issues remain: some ECC configurations permit out-of-bounds coordinate accesses, while others use secret-dependent, variable-time multiplication despite ECC timing resistance being enabled.
2 open issues
1 resolved since last review
Review effort: Balanced
187715d to
a4e3b6b
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
Changes to core cryptographic arithmetic across multiple backends and configurations require specialist review and target-specific correctness and timing validation before approval.
No open issues 🎉
2 resolved since last review
Review effort: Balanced
Use constant time Montgomery reduction and compares in ECC point operations, ECDH shared secret output and ECDSA signing mod n. Constant time, fixed length TFM modular exponentiation including base 2.
a4e3b6b to
3b6feb2
Compare



Description
Use constant time Montgomery reduction and compares in ECC point operations, ECDH shared secret output and ECDSA signing mod n. Constant time, fixed length TFM modular exponentiation including base 2.
Fixes zd#22789, zd#22790, zd#22798
Testing
./configure --eable-sp-math-all
./configure --enable-fastmath