From: Tobias Brunner Date: Tue, 26 Jan 2021 18:33:24 +0000 (+0100) Subject: openssl: Fix potential crash with ECDH on Windows X-Git-Tag: 5.9.2dr2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6c26267b07f77f8a14af7091af01b8dd0bb56b1c;p=thirdparty%2Fstrongswan.git openssl: Fix potential crash with ECDH on Windows Apparently, we should use OPENSSL_free() to release memory allocated by OpenSSL. While it generally maps to free() that's apparently not the case on Windows, where the ECP test vectors caused `ACCESS_VIOLATION exception` crashes (not always the same vector). Fixes: 74e02ff5e624 ("openssl: Mainly use EVP interface for ECDH") --- diff --git a/src/libstrongswan/plugins/openssl/openssl_ec_diffie_hellman.c b/src/libstrongswan/plugins/openssl/openssl_ec_diffie_hellman.c index 180eb0ab29..53691205df 100644 --- a/src/libstrongswan/plugins/openssl/openssl_ec_diffie_hellman.c +++ b/src/libstrongswan/plugins/openssl/openssl_ec_diffie_hellman.c @@ -246,7 +246,7 @@ METHOD(diffie_hellman_t, get_my_public_value, bool, if (pub.len != 0) { *value = chunk_clone(chunk_skip(pub, 1)); - chunk_free(&pub); + OPENSSL_free(pub.ptr); return value->len != 0; } return FALSE;