diff options
author | Nikias Bassen | 2019-06-21 21:44:19 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-06-21 21:44:19 +0200 |
commit | b3eaf9ce6a852c2000ce443e851ef9fc36a4d331 (patch) | |
tree | 2e09bf099459fd246cff5dbc9f0957975099450d | |
parent | 1d4ac48da49809e3c38574b711697cbb2ee0d773 (diff) | |
download | libimobiledevice-b3eaf9ce6a852c2000ce443e851ef9fc36a4d331.tar.gz libimobiledevice-b3eaf9ce6a852c2000ce443e851ef9fc36a4d331.tar.bz2 |
Use OPENSSL_THREADID_* API for OpenSSL >= 1.0.0 && < 1.1.0
-rw-r--r-- | src/idevice.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/idevice.c b/src/idevice.c index 745d784..8c81576 100644 --- a/src/idevice.c +++ b/src/idevice.c @@ -79,12 +79,19 @@ static void locking_function(int mode, int n, const char* file, int line) mutex_unlock(&mutex_buf[n]); } +#if OPENSSL_VERSION_NUMBER < 0x10000000L static unsigned long id_function(void) { return ((unsigned long)THREAD_ID); } +#else +static void id_function(CRYPTO_THREADID *thread) +{ + CRYPTO_THREADID_set_numeric(thread, (unsigned long)THREAD_ID); +} #endif #endif +#endif /* HAVE_OPENSSL */ static void internal_idevice_init(void) { @@ -99,7 +106,11 @@ static void internal_idevice_init(void) for (i = 0; i < CRYPTO_num_locks(); i++) mutex_init(&mutex_buf[i]); +#if OPENSSL_VERSION_NUMBER < 0x10000000L CRYPTO_set_id_callback(id_function); +#else + CRYPTO_THREADID_set_callback(id_function); +#endif CRYPTO_set_locking_callback(locking_function); #endif #else @@ -113,7 +124,11 @@ static void internal_idevice_deinit(void) #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) int i; if (mutex_buf) { +#if OPENSSL_VERSION_NUMBER < 0x10000000L CRYPTO_set_id_callback(NULL); +#else + CRYPTO_THREADID_set_callback(NULL); +#endif CRYPTO_set_locking_callback(NULL); for (i = 0; i < CRYPTO_num_locks(); i++) mutex_destroy(&mutex_buf[i]); |