changeset 21479:7bd5c8609f37

lib-ssl-iostream: Detect OPENSSL_cleanup() via configure It's ugly to have both OpenSSL version number check and a special LibreSSL check.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 05 Feb 2017 21:10:04 +0200
parents 25414f008456
children 6660ab6ba3a3
files configure.ac src/lib-ssl-iostream/dovecot-openssl-common.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun Feb 05 21:04:35 2017 +0200
+++ b/configure.ac	Sun Feb 05 21:10:04 2017 +0200
@@ -1769,6 +1769,9 @@
       AC_DEFINE(HAVE_SSL_NEW_MEM_FUNCS,, [Define if CRYPTO_set_mem_functions has new style parameters])
     fi
 
+    AC_CHECK_LIB(ssl, OPENSSL_cleanup, [
+      AC_DEFINE(HAVE_OPENSSL_CLEANUP,, [OpenSSL supports OPENSSL_cleanup()])
+    ],, $SSL_LIBS)
     AC_CHECK_LIB(ssl, SSL_get_current_compression, [
       AC_DEFINE(HAVE_SSL_COMPRESSION,, [Build with OpenSSL compression])
     ],, $SSL_LIBS)
--- a/src/lib-ssl-iostream/dovecot-openssl-common.c	Sun Feb 05 21:04:35 2017 +0200
+++ b/src/lib-ssl-iostream/dovecot-openssl-common.c	Sun Feb 05 21:10:04 2017 +0200
@@ -101,7 +101,7 @@
 	ERR_remove_thread_state(NULL);
 #endif
 	ERR_free_strings();
-#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER)
+#ifdef HAVE_OPENSSL_CLEANUP
 	OPENSSL_cleanup();
 #endif
 	return FALSE;