#ifdef out code which is a no-op with OpenSSL 1.1.0
CRYPTO_set_id_callback
CRYPTO_set_locking_callback
EVP_cleanup
CRYPTO_cleanup_all_ex_data
SSL_COMP_free_compression_methods
are all no-ops with OpenSSL 1.1.0, so we can #ifdef out the
corresponding code. This cleans up some warnings about
id_function/locking_function being defined but unused (as the calls to
CRYPTO_set_id_callback and CRYPTO_set_locking_callback disappear at
preprocessing time).
Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
diff --git a/src/idevice.c b/src/idevice.c
index 1c43269..89724ff 100644
--- a/src/idevice.c
+++ b/src/idevice.c
@@ -69,6 +69,7 @@
#endif
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
static mutex_t *mutex_buf = NULL;
static void locking_function(int mode, int n, const char* file, int line)
{
@@ -83,10 +84,12 @@
return ((unsigned long)THREAD_ID);
}
#endif
+#endif
static void internal_idevice_init(void)
{
#ifdef HAVE_OPENSSL
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
int i;
SSL_library_init();
@@ -98,6 +101,7 @@
CRYPTO_set_id_callback(id_function);
CRYPTO_set_locking_callback(locking_function);
+#endif
#else
gnutls_global_init();
#endif
@@ -106,6 +110,7 @@
static void internal_idevice_deinit(void)
{
#ifdef HAVE_OPENSSL
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
int i;
if (mutex_buf) {
CRYPTO_set_id_callback(NULL);
@@ -120,6 +125,7 @@
CRYPTO_cleanup_all_ex_data();
SSL_COMP_free_compression_methods();
openssl_remove_thread_state();
+#endif
#else
gnutls_global_deinit();
#endif