SP int: mont_red - check size of a relative to m

This commit is contained in:
Sean Parkinson
2021-02-08 10:07:15 +10:00
parent 2933db8915
commit aefddaf2b8

View File

@ -12246,6 +12246,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);
}