Merge pull request #4769 from SparkiDev/sp_mont_red_neg

SP math neg: Mont Reduce fix
This commit is contained in:
David Garske
2022-01-18 14:12:09 -08:00
committed by GitHub

View File

@ -12171,7 +12171,7 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp)
sp_clamp(a);
sp_rshb(a, bits, a);
if (_sp_cmp(a, m) != MP_LT) {
if (_sp_cmp_abs(a, m) != MP_LT) {
_sp_sub_off(a, m, a, 0);
}
@ -12370,7 +12370,7 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp)
sp_clamp(a);
sp_rshb(a, bits, a);
if (_sp_cmp(a, m) != MP_LT) {
if (_sp_cmp_abs(a, m) != MP_LT) {
sp_sub(a, m, a);
}