forked from wolfSSL/wolfssl
Fix to "mp_init_multi" so failure ensures a later "mp_clear" won't free on un-initialized pointer. Applies to !USE_FAST_MATH only. No measurable benchmark difference.
This commit is contained in:
@ -100,6 +100,13 @@ int mp_init_multi(mp_int* a, mp_int* b, mp_int* c, mp_int* d, mp_int* e,
|
|||||||
{
|
{
|
||||||
int res = MP_OKAY;
|
int res = MP_OKAY;
|
||||||
|
|
||||||
|
if (a) XMEMSET(a, 0, sizeof(mp_int));
|
||||||
|
if (b) XMEMSET(b, 0, sizeof(mp_int));
|
||||||
|
if (c) XMEMSET(c, 0, sizeof(mp_int));
|
||||||
|
if (d) XMEMSET(d, 0, sizeof(mp_int));
|
||||||
|
if (e) XMEMSET(e, 0, sizeof(mp_int));
|
||||||
|
if (f) XMEMSET(f, 0, sizeof(mp_int));
|
||||||
|
|
||||||
if (a && ((res = mp_init(a)) != MP_OKAY))
|
if (a && ((res = mp_init(a)) != MP_OKAY))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user