Repository navigation
Conversation
|
Contributor
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
SparkiDev
force-pushed
the
ecc_sp_int_ct_fix
branch
from
November 12, 2026 06:42
58072bc to
23d0e51
Compare
Contributor
Author
|
@claude review |
Contributor
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
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.
SparkiDev
force-pushed
the
ecc_sp_int_ct_fix
branch
from
November 12, 2026 07:13
23d0e51 to
d7e25ec
Compare
Contributor
Author
|
@claude review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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