parent
e9ce32a16d
commit
a4d905a030
@ -28,6 +28,10 @@ int fast_mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
|
|||||||
int ix, res, olduse;
|
int ix, res, olduse;
|
||||||
mp_word W[MP_WARRAY];
|
mp_word W[MP_WARRAY];
|
||||||
|
|
||||||
|
if (x->used > MP_WARRAY) {
|
||||||
|
return MP_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
/* get old used count */
|
/* get old used count */
|
||||||
olduse = x->used;
|
olduse = x->used;
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ int mp_montgomery_reduce(mp_int *x, const mp_int *n, mp_digit rho)
|
|||||||
*/
|
*/
|
||||||
digs = (n->used * 2) + 1;
|
digs = (n->used * 2) + 1;
|
||||||
if ((digs < MP_WARRAY) &&
|
if ((digs < MP_WARRAY) &&
|
||||||
|
(x->used <= MP_WARRAY) &&
|
||||||
(n->used <
|
(n->used <
|
||||||
(1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) {
|
(1 << ((CHAR_BIT * sizeof(mp_word)) - (2 * DIGIT_BIT))))) {
|
||||||
return fast_mp_montgomery_reduce(x, n, rho);
|
return fast_mp_montgomery_reduce(x, n, rho);
|
||||||
|
Loading…
Reference in New Issue
Block a user