add guard around public key validation on import

This commit is contained in:
JacobBarthelmeh
2024-02-28 13:48:58 +07:00
parent 6500444b26
commit 8a6c6ebfd5

View File

@@ -1021,9 +1021,11 @@ static int wc_PKCS7_CheckPublicKeyDer(PKCS7* pkcs7, int keyOID,
/* Try to decode public key and check with wc_ecc_check_key() */ /* Try to decode public key and check with wc_ecc_check_key() */
ret = wc_EccPublicKeyDecode(key, &scratch, ecc, keySz); ret = wc_EccPublicKeyDecode(key, &scratch, ecc, keySz);
#if defined(WOLFSSL_VALIDATE_ECC_IMPORT)
if (ret == 0) { if (ret == 0) {
ret = wc_ecc_check_key(ecc); ret = wc_ecc_check_key(ecc);
} }
#endif
wc_ecc_free(ecc); wc_ecc_free(ecc);
break; break;