Merge pull request #6581 from kareem-wolfssl/eccNullKCheck

Fixed crash in wc_ecc_free.
This commit is contained in:
Sean Parkinson
2023-07-07 10:54:18 +10:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@ -7654,6 +7654,9 @@ int wc_ecc_free(ecc_key* key)
mp_clear(key->pubkey.y);
mp_clear(key->pubkey.z);
#ifdef ALT_ECC_SIZE
if (key->k)
#endif
mp_forcezero(key->k);
#ifdef WOLFSSL_CUSTOM_CURVES

View File

@ -4398,6 +4398,9 @@ void fp_clear(fp_int *a)
void fp_forcezero (mp_int * a)
{
if (a == NULL)
return;
int size;
a->used = 0;
a->sign = FP_ZPOS;