ecc_free should be called only upon ecc_import_x963 success.

This commit is contained in:
Moisés Guimarães 2014-07-08 13:41:42 -03:00
parent d6f5f57452
commit 9ffc44a01f

View File

@ -3056,16 +3056,18 @@ static int ConfirmSignature(const byte* buf, word32 bufSz,
if (ecc_import_x963(key, keySz, pubKey) < 0) { if (ecc_import_x963(key, keySz, pubKey) < 0) {
CYASSL_MSG("ASN Key import error ECC"); CYASSL_MSG("ASN Key import error ECC");
} }
else if (ecc_verify_hash(sig, sigSz, digest, digestSz, &verify, else {
if (ecc_verify_hash(sig, sigSz, digest, digestSz, &verify,
pubKey) != 0) { pubKey) != 0) {
CYASSL_MSG("ECC verify hash error"); CYASSL_MSG("ECC verify hash error");
} }
else if (1 != verify) { else if (1 != verify) {
CYASSL_MSG("ECC Verify didn't match"); CYASSL_MSG("ECC Verify didn't match");
} else } else
ret = 1; /* match */ ret = 1; /* match */
ecc_free(pubKey); ecc_free(pubKey);
}
#ifdef CYASSL_SMALL_STACK #ifdef CYASSL_SMALL_STACK
XFREE(pubKey, NULL, DYNAMIC_TYPE_TMP_BUFFER); XFREE(pubKey, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif #endif