summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2017-11-14 16:00:39 +0100
committerLinus Nordberg <linus@nordberg.se>2017-11-14 16:06:19 +0100
commita65b5b53b0d40c639b89a47b4a9ac713405d85c9 (patch)
tree5c13f2f02a849dd823274a01af19f7b380aa8e4c
parent6c1fb22f89cbf890e0431b4bbc274721c051856f (diff)
Perform explicit locking only when openssl version < 1.1.
-rw-r--r--tls.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tls.c b/tls.c
index 73dd6b5..111964c 100644
--- a/tls.c
+++ b/tls.c
@@ -188,6 +188,7 @@ init_openssl_rand_ (void)
}
#if defined HAVE_PTHREADS
+#if OPENSSL_VERSION_NUMBER < 0x10100000
/** Array of pthread_mutex_t for OpenSSL. Allocated and initialised in
\a init_locking_ and never freed. */
static pthread_mutex_t *s_openssl_mutexes = NULL;
@@ -224,6 +225,7 @@ init_locking_ ()
return 0;
}
+#endif /* OPENSSL_VERSION_NUMBER < 0x10100000 */
#endif /* HAVE_PTHREADS */
/** Initialise the TLS library. Return 0 on success, -1 on failure. */
@@ -232,6 +234,7 @@ tls_init ()
{
SSL_load_error_strings ();
#if defined HAVE_PTHREADS
+#if OPENSSL_VERSION_NUMBER < 0x10100000
if (CRYPTO_get_locking_callback () == NULL)
{
assert (s_openssl_mutexes_count == 0);
@@ -242,6 +245,7 @@ tls_init ()
return -1;
CRYPTO_set_locking_callback (openssl_locking_cb_);
}
+#endif /* OPENSSL_VERSION_NUMBER < 0x10100000 */
#endif /* HAVE_PTHREADS */
SSL_library_init ();
return init_openssl_rand_ ();