mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-03 22:10:35 -05:00
Add OPENSSL_cleanup to tls_shutdown function
This prevents a direct leak in OPENSSL_init_crypto (called from
OPENSSL_init_ssl).
Add shim version of OPENSSL_cleanup because it is missing in LibreSSL on
OpenBSD.
(cherry picked from commit 89f4f8f0c8)
This commit is contained in:
parent
95432e0865
commit
3c77a51f6b
5 changed files with 20 additions and 3 deletions
|
|
@ -288,6 +288,9 @@
|
|||
/* Define to 1 if you have the <net/route.h> header file. */
|
||||
#undef HAVE_NET_ROUTE_H
|
||||
|
||||
/* Define to 1 if you have the `OPENSSL_cleanup' function. */
|
||||
#undef HAVE_OPENSSL_CLEANUP
|
||||
|
||||
/* define if OpenSSL supports Ed25519 */
|
||||
#undef HAVE_OPENSSL_ED25519
|
||||
|
||||
|
|
|
|||
|
|
@ -832,7 +832,7 @@ AC_COMPILE_IFELSE(
|
|||
# Check for functions added in OpenSSL or LibreSSL
|
||||
#
|
||||
|
||||
AC_CHECK_FUNCS([OPENSSL_init_ssl OPENSSL_init_crypto])
|
||||
AC_CHECK_FUNCS([OPENSSL_init_ssl OPENSSL_init_crypto OPENSSL_cleanup])
|
||||
AC_CHECK_FUNCS([CRYPTO_zalloc])
|
||||
AC_CHECK_FUNCS([EVP_CIPHER_CTX_new EVP_CIPHER_CTX_free])
|
||||
AC_CHECK_FUNCS([EVP_MD_CTX_new EVP_MD_CTX_free EVP_MD_CTX_reset])
|
||||
|
|
|
|||
|
|
@ -220,3 +220,10 @@ OPENSSL_init_ssl(uint64_t opts, const void *settings) {
|
|||
return (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_OPENSSL_CLEANUP
|
||||
void
|
||||
OPENSSL_cleanup(void) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -119,6 +119,11 @@ OPENSSL_init_ssl(uint64_t opts, const void *settings);
|
|||
|
||||
#endif
|
||||
|
||||
#if !HAVE_OPENSSL_CLEANUP
|
||||
void
|
||||
OPENSSL_cleanup(void);
|
||||
#endif
|
||||
|
||||
#if !HAVE_TLS_SERVER_METHOD
|
||||
#define TLS_server_method SSLv23_server_method
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/conf.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/rand.h>
|
||||
|
|
@ -123,8 +124,9 @@ tls_shutdown(void) {
|
|||
REQUIRE(atomic_load(&init_done));
|
||||
REQUIRE(!atomic_load(&shut_done));
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
|
||||
OPENSSL_cleanup();
|
||||
#else
|
||||
CONF_modules_unload(1);
|
||||
OBJ_cleanup();
|
||||
EVP_cleanup();
|
||||
|
|
|
|||
Loading…
Reference in a new issue