diff options
| author | 2014-10-07 16:29:58 +0200 | |
|---|---|---|
| committer | 2014-10-07 16:29:58 +0200 | |
| commit | 9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b (patch) | |
| tree | 489799efc2f524af8339156b7524d172cfad9d25 /src/idevice.c | |
| parent | 7aad73614e19a5cf73e1926c0279adb481fbb8e9 (diff) | |
| download | libimobiledevice-9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b.tar.gz libimobiledevice-9e3561e508a22ea6dcfb00d9e80d7a653efd0e8b.tar.bz2 | |
idevice: Fix compilation with OpenSSL before 1.0.0-beta1
Diffstat (limited to 'src/idevice.c')
| -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 @@ | |||
| 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... */ |
