Commit e49d93c2 authored by Mark Andrews's avatar Mark Andrews
Browse files

locks are only need in OpenSSL < 1.1

parent 56c6fc0d
...@@ -49,8 +49,10 @@ ...@@ -49,8 +49,10 @@
static RAND_METHOD *rm = NULL; static RAND_METHOD *rm = NULL;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static isc_mutex_t *locks = NULL; static isc_mutex_t *locks = NULL;
static int nlocks; static int nlocks;
#endif
#ifdef USE_ENGINE #ifdef USE_ENGINE
static ENGINE *e = NULL; static ENGINE *e = NULL;
...@@ -185,6 +187,7 @@ dst__openssl_init(const char *engine) { ...@@ -185,6 +187,7 @@ dst__openssl_init(const char *engine) {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#endif #endif
CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free); CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
nlocks = CRYPTO_num_locks(); nlocks = CRYPTO_num_locks();
locks = mem_alloc(sizeof(isc_mutex_t) * nlocks FILELINE); locks = mem_alloc(sizeof(isc_mutex_t) * nlocks FILELINE);
if (locks == NULL) if (locks == NULL)
...@@ -192,7 +195,6 @@ dst__openssl_init(const char *engine) { ...@@ -192,7 +195,6 @@ dst__openssl_init(const char *engine) {
result = isc_mutexblock_init(locks, nlocks); result = isc_mutexblock_init(locks, nlocks);
if (result != ISC_R_SUCCESS) if (result != ISC_R_SUCCESS)
goto cleanup_mutexalloc; goto cleanup_mutexalloc;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
CRYPTO_set_locking_callback(lock_callback); CRYPTO_set_locking_callback(lock_callback);
CRYPTO_set_id_callback(id_callback); CRYPTO_set_id_callback(id_callback);
#endif #endif
...@@ -269,11 +271,13 @@ dst__openssl_init(const char *engine) { ...@@ -269,11 +271,13 @@ dst__openssl_init(const char *engine) {
rm = NULL; rm = NULL;
#endif #endif
cleanup_mutexinit: cleanup_mutexinit:
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
CRYPTO_set_locking_callback(NULL); CRYPTO_set_locking_callback(NULL);
DESTROYMUTEXBLOCK(locks, nlocks); DESTROYMUTEXBLOCK(locks, nlocks);
cleanup_mutexalloc: cleanup_mutexalloc:
mem_free(locks FILELINE); mem_free(locks FILELINE);
locks = NULL; locks = NULL;
#endif
return (result); return (result);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment