Merge pull request #6066 from SparkiDev/int_fast_mont_red_oob

integer.c: fast mod reduce fix
This commit is contained in:
David Garske 2023-02-07 14:12:13 -08:00 committed by GitHub
commit 9f5ffe6bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2512,13 +2512,13 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
}
#ifdef WOLFSSL_SMALL_STACK
W = (mp_word*)XMALLOC(sizeof(mp_word) * (n->used * 2 + 1), NULL,
W = (mp_word*)XMALLOC(sizeof(mp_word) * (n->used * 2 + 2), NULL,
DYNAMIC_TYPE_BIGINT);
if (W == NULL)
return MP_MEM;
#endif
XMEMSET(W, 0, sizeof(mp_word) * (n->used * 2 + 1));
XMEMSET(W, 0, sizeof(mp_word) * (n->used * 2 + 2));
/* first we have to get the digits of the input into
* an array of double precision words W[...]