diff options
author | Martin Szulecki | 2014-10-07 16:29:58 +0200 |
---|---|---|
committer | Martin Szulecki | 2014-10-07 16:29:58 +0200 |
commit | 9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b (patch) | |
tree | 489799efc2f524af8339156b7524d172cfad9d25 | |
parent | 7aad73614e19a5cf73e1926c0279adb481fbb8e9 (diff) | |
download | libimobiledevice-9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b.tar.gz libimobiledevice-9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b.tar.bz2 |
idevice: Fix compilation with OpenSSL before 1.0.0-beta1
-rw-r--r-- | src/idevice.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/idevice.c b/src/idevice.c index 4fae693..7ec46ed 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -37,6 +37,10 @@ #ifdef HAVE_OPENSSL #include <openssl/err.h> #include <openssl/ssl.h> +#if OPENSSL_VERSION_NUMBER >= 0x10000001L +/* since OpenSSL 1.0.0-beta1 */ +#define HAVE_ERR_REMOVE_THREAD_STATE 1 +#endif #else #include <gnutls/gnutls.h> #endif @@ -96,8 +100,12 @@ static void internal_idevice_deinit(void) EVP_cleanup(); CRYPTO_cleanup_all_ex_data(); sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); +#ifdef HAVE_ERR_REMOVE_THREAD_STATE ERR_remove_thread_state(NULL); #else + ERR_remove_state(0); +#endif +#else gnutls_global_deinit(); #endif } @@ -717,8 +725,12 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne debug_info("SSL mode enabled, cipher: %s", SSL_get_cipher(ssl)); } /* required for proper multi-thread clean up to prevent leaks */ +#ifdef HAVE_ERR_REMOVE_THREAD_STATE ERR_remove_thread_state(NULL); #else + ERR_remove_state(0); +#endif +#else ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private)); /* Set up GnuTLS... */ |