Fix in "wc_InitRsaKey_ex" for normal math so mp_init isn't called to defer allocation.

This commit is contained in:
David Garske
2016-08-15 14:07:16 -06:00
parent 17a34c5899
commit 3e6be9bf2c

View File

@ -193,6 +193,13 @@ int wc_InitRsaKey_ex(RsaKey* key, void* heap, int devId)
else
#endif
{
/* For normal math defer the memory allocations */
#ifndef USE_FAST_MATH
key->n.dp = key->e.dp = 0; /* public alloc parts */
key->d.dp = key->p.dp = 0; /* private alloc parts */
key->q.dp = key->dP.dp = 0;
key->u.dp = key->dQ.dp = 0;
#else
mp_init(&key->n);
mp_init(&key->e);
mp_init(&key->d);
@ -201,6 +208,7 @@ int wc_InitRsaKey_ex(RsaKey* key, void* heap, int devId)
mp_init(&key->dP);
mp_init(&key->dQ);
mp_init(&key->u);
#endif /* USE_FAST_MATH */
}
return ret;