Merge pull request #3733 from SparkiDev/sp_int_mont_red_size

SP int: mont_red - check size of a relative to m
pull/3713/head
toddouska 2021-02-09 16:00:24 -08:00 committed by GitHub
commit 27475291b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -12369,6 +12369,9 @@ int sp_mont_red(sp_int* a, sp_int* m, sp_int_digit mp)
if ((a == NULL) || (m == NULL) || sp_iszero(m)) {
err = MP_VAL;
}
else if (a->size < m->used * 2 + 1) {
err = MP_VAL;
}
else {
err = _sp_mont_red(a, m, mp);
}