Merge pull request #4149 from guidovranken/wc_ecc_verify_hash_ex-alloc-check

ECC: wc_ecc_verify_hash_ex, return if ALLOC_CURVE_SPECS() fails
This commit is contained in:
Sean Parkinson
2021-06-22 08:24:22 +10:00
committed by GitHub

View File

@ -7108,6 +7108,9 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
#if !defined(WOLFSSL_SP_MATH) || defined(FREESCALE_LTC_ECC)
ALLOC_CURVE_SPECS(ECC_CURVE_FIELD_COUNT, err);
if (err != 0) {
return err;
}
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM_V)
err = wc_ecc_alloc_mpint(key, &key->e);
@ -7128,8 +7131,10 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
#endif /* WOLFSSL_ASYNC_CRYPT && HAVE_CAVIUM_V */
err = mp_init(e);
if (err != MP_OKAY)
if (err != MP_OKAY) {
FREE_CURVE_SPECS();
return MEMORY_E;
}
/* read in the specs for this curve */
err = wc_ecc_curve_load(key->dp, &curve, ECC_CURVE_FIELD_ALL);