forked from wolfSSL/wolfssl
Fix for "wc_ecc_make_key_ex" if call to rng fails. Issue only applies to !USE_FAST_MATH case on failure response from call to "wc_RNG_GenerateBlock".
This commit is contained in:
@ -2505,9 +2505,14 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
|
||||
|
||||
/* make up random string */
|
||||
err = wc_RNG_GenerateBlock(rng, buf, keysize);
|
||||
if (err != 0) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
/* setup the key variables */
|
||||
if (err == 0) {
|
||||
err = mp_init_multi(&key->k, &prime, &order, &a, NULL, NULL);
|
||||
if (err == MP_OKAY) {
|
||||
#ifndef ALT_ECC_SIZE
|
||||
@ -2522,7 +2527,6 @@ int wc_ecc_make_key_ex(WC_RNG* rng, int keysize, ecc_key* key, int curve_id)
|
||||
alt_fp_init(key->pubkey.z);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (err == MP_OKAY) {
|
||||
base = wc_ecc_new_point_h(key->heap);
|
||||
|
Reference in New Issue
Block a user