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 @@
static RAND_METHOD *rm = NULL;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
static isc_mutex_t *locks = NULL;
static int nlocks;
#endif
#ifdef USE_ENGINE
static ENGINE *e = NULL;
......@@ -185,6 +187,7 @@ dst__openssl_init(const char *engine) {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#endif
CRYPTO_set_mem_functions(mem_alloc, mem_realloc, mem_free);
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
nlocks = CRYPTO_num_locks();
locks = mem_alloc(sizeof(isc_mutex_t) * nlocks FILELINE);
if (locks == NULL)
......@@ -192,7 +195,6 @@ dst__openssl_init(const char *engine) {
result = isc_mutexblock_init(locks, nlocks);
if (result != ISC_R_SUCCESS)
goto cleanup_mutexalloc;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
CRYPTO_set_locking_callback(lock_callback);
CRYPTO_set_id_callback(id_callback);
#endif
......@@ -269,11 +271,13 @@ dst__openssl_init(const char *engine) {
rm = NULL;
#endif
cleanup_mutexinit:
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
CRYPTO_set_locking_callback(NULL);
DESTROYMUTEXBLOCK(locks, nlocks);
cleanup_mutexalloc:
mem_free(locks FILELINE);
locks = NULL;
#endif
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