mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
[NSS] Implement constant-time GCD and modular inversion
The implementation is based on the work by Bernstein and Yang (https://eprint.iacr.org/2019/266) "Fast constant-time gcd computation and modular inversion". It fixes the old mp_gcd and s_mp_invmod_odd_m functions. The patch also fixes mpl_significant_bits s_mp_div_2d and s_mp_mul_2d by having less control flow to reduce side-channel leaks. Co-authored by : Billy Bob Brumley
This commit is contained in:
parent
db9ccc90e0
commit
62467c473d
3 changed files with 292 additions and 132 deletions
|
|
@ -267,6 +267,7 @@ mp_size mp_trailing_zeros(const mp_int *mp);
|
|||
void freebl_cpuid(unsigned long op, unsigned long *eax,
|
||||
unsigned long *ebx, unsigned long *ecx,
|
||||
unsigned long *edx);
|
||||
mp_err mp_cswap(mp_digit condition, mp_int *a, mp_int *b, mp_size numdigits);
|
||||
|
||||
#define MP_CHECKOK(x) \
|
||||
if (MP_OKAY > (res = (x))) \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue