Module: kamailio Branch: master Commit: e7c03ce6ce61119fbf5cb9f41b7abcd4c7138d58 URL: https://github.com/kamailio/kamailio/commit/e7c03ce6ce61119fbf5cb9f41b7abcd4...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-06-28T10:26:43+02:00
tls: dynamic locks not needed for openssl v1.1.0+
- openssl v1.1.0 is thread safe - fixes the compile warnings for libssl 1.1.0
---
Modified: src/modules/tls/tls_locking.c
---
Diff: https://github.com/kamailio/kamailio/commit/e7c03ce6ce61119fbf5cb9f41b7abcd4... Patch: https://github.com/kamailio/kamailio/commit/e7c03ce6ce61119fbf5cb9f41b7abcd4...
---
diff --git a/src/modules/tls/tls_locking.c b/src/modules/tls/tls_locking.c index 9d8e8acec5..38c028fd2f 100644 --- a/src/modules/tls/tls_locking.c +++ b/src/modules/tls/tls_locking.c @@ -32,6 +32,9 @@ static int n_static_locks=0; static gen_lock_set_t* static_locks=0;
+/* OpenSSL is thread-safe since 1.1.0 */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L + /* "dynamic" locks */
struct CRYPTO_dynlock_value{ @@ -61,7 +64,6 @@ static struct CRYPTO_dynlock_value* dyn_create_f(const char* file, int line) }
- static void dyn_lock_f(int mode, struct CRYPTO_dynlock_value* l, const char* file, int line) { @@ -116,6 +118,7 @@ static void locking_f(int mode, int n, const char* file, int line) } }
+#endif /* openssl < 0x10100000L (1.1.0) */
void tls_destroy_locks() @@ -163,10 +166,14 @@ int tls_init_locks() } CRYPTO_set_locking_callback(locking_f); } + +/* OpenSSL is thread-safe since 1.1.0 */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L /* set "dynamic" locks callbacks */ CRYPTO_set_dynlock_create_callback(dyn_create_f); CRYPTO_set_dynlock_lock_callback(dyn_lock_f); CRYPTO_set_dynlock_destroy_callback(dyn_destroy_f); +#endif
/* starting with v1.0.0 openssl does not use anymore getpid(), but address * of errno which can point to same virtual address in a multi-process