Skip to content

Commit

Permalink
tls: dynamic locks not needed for openssl v1.1.0+
Browse files Browse the repository at this point in the history
- openssl v1.1.0 is thread safe
- fixes the compile warnings for libssl 1.1.0

(cherry picked from commit e7c03ce)
  • Loading branch information
miconda committed Aug 29, 2017
1 parent 69bc838 commit 3526f30
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/tls/tls_locking.c
Expand Up @@ -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{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3526f30

Please sign in to comment.