diff options
| author | 2017-04-25 16:59:15 +0200 | |
|---|---|---|
| committer | 2017-04-26 15:21:02 +0200 | |
| commit | b89e4823ef9528936072f5f195d7fdab9e1f838b (patch) | |
| tree | 800e290660f43fef73a458a32c6bd8ef63abdb95 /src/idevice.c | |
| parent | f635812ccc9b2eb63f5bc2b494d7fdae9c9e1ef3 (diff) | |
| download | libimobiledevice-b89e4823ef9528936072f5f195d7fdab9e1f838b.tar.gz libimobiledevice-b89e4823ef9528936072f5f195d7fdab9e1f838b.tar.bz2 | |
#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>
Diffstat (limited to 'src/idevice.c')
| -rw-r--r-- | src/idevice.c | 6 |
1 files changed, 6 insertions, 0 deletions
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 @@ static void openssl_remove_thread_state(void) | |||
| 69 | #endif | 69 | #endif |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | #if OPENSSL_VERSION_NUMBER < 0x10100000L | ||
| 72 | static mutex_t *mutex_buf = NULL; | 73 | static mutex_t *mutex_buf = NULL; |
| 73 | static void locking_function(int mode, int n, const char* file, int line) | 74 | static void locking_function(int mode, int n, const char* file, int line) |
| 74 | { | 75 | { |
| @@ -83,10 +84,12 @@ static unsigned long id_function(void) | |||
| 83 | return ((unsigned long)THREAD_ID); | 84 | return ((unsigned long)THREAD_ID); |
| 84 | } | 85 | } |
| 85 | #endif | 86 | #endif |
| 87 | #endif | ||
| 86 | 88 | ||
| 87 | static void internal_idevice_init(void) | 89 | static void internal_idevice_init(void) |
| 88 | { | 90 | { |
| 89 | #ifdef HAVE_OPENSSL | 91 | #ifdef HAVE_OPENSSL |
| 92 | #if OPENSSL_VERSION_NUMBER < 0x10100000L | ||
| 90 | int i; | 93 | int i; |
| 91 | SSL_library_init(); | 94 | SSL_library_init(); |
| 92 | 95 | ||
| @@ -98,6 +101,7 @@ static void internal_idevice_init(void) | |||
| 98 | 101 | ||
| 99 | CRYPTO_set_id_callback(id_function); | 102 | CRYPTO_set_id_callback(id_function); |
| 100 | CRYPTO_set_locking_callback(locking_function); | 103 | CRYPTO_set_locking_callback(locking_function); |
| 104 | #endif | ||
| 101 | #else | 105 | #else |
| 102 | gnutls_global_init(); | 106 | gnutls_global_init(); |
| 103 | #endif | 107 | #endif |
| @@ -106,6 +110,7 @@ static void internal_idevice_init(void) | |||
| 106 | static void internal_idevice_deinit(void) | 110 | static void internal_idevice_deinit(void) |
| 107 | { | 111 | { |
| 108 | #ifdef HAVE_OPENSSL | 112 | #ifdef HAVE_OPENSSL |
| 113 | #if OPENSSL_VERSION_NUMBER < 0x10100000L | ||
| 109 | int i; | 114 | int i; |
| 110 | if (mutex_buf) { | 115 | if (mutex_buf) { |
| 111 | CRYPTO_set_id_callback(NULL); | 116 | CRYPTO_set_id_callback(NULL); |
| @@ -120,6 +125,7 @@ static void internal_idevice_deinit(void) | |||
| 120 | CRYPTO_cleanup_all_ex_data(); | 125 | CRYPTO_cleanup_all_ex_data(); |
| 121 | SSL_COMP_free_compression_methods(); | 126 | SSL_COMP_free_compression_methods(); |
| 122 | openssl_remove_thread_state(); | 127 | openssl_remove_thread_state(); |
| 128 | #endif | ||
| 123 | #else | 129 | #else |
| 124 | gnutls_global_deinit(); | 130 | gnutls_global_deinit(); |
| 125 | #endif | 131 | #endif |
