summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/idevice.c12
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 @@
37#ifdef HAVE_OPENSSL 37#ifdef HAVE_OPENSSL
38#include <openssl/err.h> 38#include <openssl/err.h>
39#include <openssl/ssl.h> 39#include <openssl/ssl.h>
40#if OPENSSL_VERSION_NUMBER >= 0x10000001L
41/* since OpenSSL 1.0.0-beta1 */
42#define HAVE_ERR_REMOVE_THREAD_STATE 1
43#endif
40#else 44#else
41#include <gnutls/gnutls.h> 45#include <gnutls/gnutls.h>
42#endif 46#endif
@@ -96,8 +100,12 @@ static void internal_idevice_deinit(void)
96 EVP_cleanup(); 100 EVP_cleanup();
97 CRYPTO_cleanup_all_ex_data(); 101 CRYPTO_cleanup_all_ex_data();
98 sk_SSL_COMP_free(SSL_COMP_get_compression_methods()); 102 sk_SSL_COMP_free(SSL_COMP_get_compression_methods());
103#ifdef HAVE_ERR_REMOVE_THREAD_STATE
99 ERR_remove_thread_state(NULL); 104 ERR_remove_thread_state(NULL);
100#else 105#else
106 ERR_remove_state(0);
107#endif
108#else
101 gnutls_global_deinit(); 109 gnutls_global_deinit();
102#endif 110#endif
103} 111}
@@ -717,8 +725,12 @@ LIBIMOBILEDEVICE_API idevice_error_t idevice_connection_enable_ssl(idevice_conne
717 debug_info("SSL mode enabled, cipher: %s", SSL_get_cipher(ssl)); 725 debug_info("SSL mode enabled, cipher: %s", SSL_get_cipher(ssl));
718 } 726 }
719 /* required for proper multi-thread clean up to prevent leaks */ 727 /* required for proper multi-thread clean up to prevent leaks */
728#ifdef HAVE_ERR_REMOVE_THREAD_STATE
720 ERR_remove_thread_state(NULL); 729 ERR_remove_thread_state(NULL);
721#else 730#else
731 ERR_remove_state(0);
732#endif
733#else
722 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private)); 734 ssl_data_t ssl_data_loc = (ssl_data_t)malloc(sizeof(struct ssl_data_private));
723 735
724 /* Set up GnuTLS... */ 736 /* Set up GnuTLS... */