mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Merge pull request #6426 from jpbland1/invariant-mp-size
add check to sp_invmod_mont_ct to make sure the
This commit is contained in:
@ -12467,6 +12467,10 @@ int sp_invmod_mont_ct(const sp_int* a, const sp_int* m, sp_int* r,
|
||||
else if (m->used * 2 >= SP_INT_DIGITS) {
|
||||
err = MP_VAL;
|
||||
}
|
||||
/* check that r can hold the range of the modulus result */
|
||||
else if (m->used > r->size) {
|
||||
err = MP_VAL;
|
||||
}
|
||||
|
||||
/* 0 != n*m + 1 (+ve m), r*a mod 0 is always 0 (never 1) */
|
||||
if ((err == MP_OKAY) && (sp_iszero(a) || sp_iszero(m) ||
|
||||
|
Reference in New Issue
Block a user