forked from wolfSSL/wolfssl
fix potential ecc memory leak in ServerKeyExchange
This commit is contained in:
@ -5147,6 +5147,7 @@ int SetCipherList(Suites* s, const char* list)
|
|||||||
ret = RsaSSL_Sign(signBuffer, signSz, output + idx, sigSz,
|
ret = RsaSSL_Sign(signBuffer, signSz, output + idx, sigSz,
|
||||||
&rsaKey, &ssl->rng);
|
&rsaKey, &ssl->rng);
|
||||||
FreeRsaKey(&rsaKey);
|
FreeRsaKey(&rsaKey);
|
||||||
|
ecc_free(&dsaKey);
|
||||||
if (ret > 0)
|
if (ret > 0)
|
||||||
ret = 0; /* reset on success */
|
ret = 0; /* reset on success */
|
||||||
else
|
else
|
||||||
@ -5155,9 +5156,10 @@ int SetCipherList(Suites* s, const char* list)
|
|||||||
else if (ssl->specs.sig_algo == ecc_dsa_sa_algo) {
|
else if (ssl->specs.sig_algo == ecc_dsa_sa_algo) {
|
||||||
word32 sz = sigSz;
|
word32 sz = sigSz;
|
||||||
|
|
||||||
FreeRsaKey(&rsaKey);
|
|
||||||
ret = ecc_sign_hash(&hash[MD5_DIGEST_SIZE], SHA_DIGEST_SIZE,
|
ret = ecc_sign_hash(&hash[MD5_DIGEST_SIZE], SHA_DIGEST_SIZE,
|
||||||
output + idx, &sz, &ssl->rng, &dsaKey);
|
output + idx, &sz, &ssl->rng, &dsaKey);
|
||||||
|
FreeRsaKey(&rsaKey);
|
||||||
|
ecc_free(&dsaKey);
|
||||||
if (ret < 0) return ret;
|
if (ret < 0) return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user