You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7423f01
Browse filesBrowse the repository at this point in the historyBrowse files
SAKKE, ECCSI: constant time operations on secrets, optional RNG blinding
- 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.
Blinding values are generated by SAKKE rather than wc_ecc_gen_k() so the
ECC random buffer size (ECC_MAXSIZE_GEN in FIPS v6) doesn't limit them.
- 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.
- ECC generic projective add/double: constant time Montgomery reduction
and point equality check when timing resistant. Public only operations
(ecc_mul2add(), verify) keep the faster reduction.
- sp_int: sp_invmod_mont_ct() reductions are constant time; cheaper
constant time final subtraction and input masking in Montgomery
reduction.
- TFM: honor the constant time flag of Montgomery reduction (plain
reduction unchanged unless WOLFSSL_MONT_RED_CT), fixed length carry
propagation, constant time clamp, fp_invmod_mont_ct() constant time
reductions; fix fp_submod_ct() leaving a stale top digit.
- ECCSI signing: r * SSK, HE + r * SSK, inversion and multiply by j are
constant time (Fermat inversion in Montgomery form) with TFM and
SP math all; other math builds keep blinded inversion.
- Public only operations use the faster multiplication: ECCSI verify
(non-SP curves) computes Y and J with ecc_mul2add(), and the public key
order check uses ecc_mul2add() (uncached when FP_ECC).
- Regenerate SP x86_64 assembly (32-bit parameters zero extended).
- SP Karatsuba squaring (ARM, RISC-V): |a_lo - a_hi| by constant time
negation rather than selecting operand pointers by the secret sign.
- SP point add: doubling check and infinity masks read through volatiles
so the compiler cannot branch on their parts.
- Tests and docs for wc_SetSakkeRng(); white-box tests updated for
changed static helpers.
"comment": "Default (address-oblivious) cache-resistant modexp copy on a normal target: _sp_exptmod_mont_ex (sp_int.c) via _sp_cond_copy and the SAKKE ladder (sakke.c) via mp_cond_copy, which touch both t[0] and t[1] so the accessed address is secret-independent. Nothing else in this matrix builds SAKKE, and on a non-capability target the sp_int.c default is only otherwise reached incidentally. Pairs with modexp-copy-fast-sakke, which flips both to the pointer-copy opt-in.",
109
+
"comment": "Default (address-oblivious) cache-resistant modexp copy on a normal target: _sp_exptmod_mont_ex (sp_int.c) via _sp_cond_copy, which touches both t[0] and t[1] so the accessed address is secret-independent, alongside the SAKKE F_p* exponentiation (sakke.c), which always uses mp_cond_copy. Nothing else in this matrix builds SAKKE, and on a non-capability target the sp_int.c default is only otherwise reached incidentally. Pairs with modexp-copy-fast-sakke, which flips sp_int.c to the pointer-copy opt-in.",
"comment": "WOLFSSL_SP_FAST_MODEXP_COPY opt-in: the faster secret-dependent-pointer copy in _sp_exptmod_mont_ex (sp_int.c) and the SAKKE ladder (sakke.c). That branch is the #else of the oblivious default and is compiled by no other entry, and the macro is forced off on the capability (WC_NO_PTR_INT_CAST) legs in fil-c.yml, so a normal target is the only place it is built.",
112
+
"comment": "WOLFSSL_SP_FAST_MODEXP_COPY opt-in: the faster secret-dependent-pointer copy in _sp_exptmod_mont_ex (sp_int.c). SAKKE is built to check that its F_p* exponentiation (sakke.c), which ignores the opt-in and always uses mp_cond_copy, still passes with it defined. The sp_int.c branch is the #else of the oblivious default and is compiled by no other entry, and the macro is forced off on the capability (WC_NO_PTR_INT_CAST) legs in fil-c.yml, so a normal target is the only place it is built.",
0 commit comments