mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
OpenSSL: Fix memory leak in crypto_ecdh_init()
ec_params needs to be freed before returning from the function. Extension of this function to support BoringSSL introduced this memory leak and that was later extended to be the only variant and apply to OpenSSL and LibreSSL cases as well in commitc23e87d0d1
("OpenSSL: Replace EVP_PKEY_paramgen() with EC_KEY_new_by_curve_name()"). Fixes:f29761297b
("BoringSSL: Implement crypto_ecdh_init()") Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
fb10f3bb65
commit
f9cd1327ad
@ -1880,7 +1880,7 @@ struct crypto_ecdh * crypto_ecdh_init(int group)
|
|||||||
{
|
{
|
||||||
struct crypto_ecdh *ecdh;
|
struct crypto_ecdh *ecdh;
|
||||||
EVP_PKEY *params = NULL;
|
EVP_PKEY *params = NULL;
|
||||||
EC_KEY *ec_params;
|
EC_KEY *ec_params = NULL;
|
||||||
EVP_PKEY_CTX *kctx = NULL;
|
EVP_PKEY_CTX *kctx = NULL;
|
||||||
|
|
||||||
ecdh = os_zalloc(sizeof(*ecdh));
|
ecdh = os_zalloc(sizeof(*ecdh));
|
||||||
@ -1923,6 +1923,7 @@ struct crypto_ecdh * crypto_ecdh_init(int group)
|
|||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
EC_KEY_free(ec_params);
|
||||||
EVP_PKEY_free(params);
|
EVP_PKEY_free(params);
|
||||||
EVP_PKEY_CTX_free(kctx);
|
EVP_PKEY_CTX_free(kctx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user