mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Merge pull request #4769 from SparkiDev/sp_mont_red_neg
SP math neg: Mont Reduce fix
This commit is contained in:
@ -12171,7 +12171,7 @@ static int _sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp)
|
|||||||
sp_clamp(a);
|
sp_clamp(a);
|
||||||
sp_rshb(a, bits, 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);
|
_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_clamp(a);
|
||||||
sp_rshb(a, bits, 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);
|
sp_sub(a, m, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user