[Forensics-changes] [yara] 351/368: Don't use libcrypto locking function for OpenSSL >= 1.1

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:57 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit 557f9acf4f6a7b61b6a29a779806ccafe5115fa0
Author: Hilko Bengen <bengen at hilluzination.de>
Date:   Mon Jun 27 19:11:14 2016 +0200

    Don't use libcrypto locking function for OpenSSL >= 1.1
    
    OpenSSL 1.1 is thread-safe and does not need the locking functions.
---
 libyara/libyara.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/libyara/libyara.c b/libyara/libyara.c
index e74bd00..e1b16c2 100644
--- a/libyara/libyara.c
+++ b/libyara/libyara.c
@@ -69,10 +69,11 @@ char lowercase[256];
 char altercase[256];
 
 
-#ifdef HAVE_LIBCRYPTO
+#if defined HAVE_LIBCRYPTO && OPENSSL_VERSION_NUMBER < 0x10100000L
 
-// The OpenSSL library requires some locks in order to be thread-safe. These
-// locks are initialized in yr_initialize function.
+// The OpenSSL library before version 1.1 requires some locks in order
+// to be thread-safe. These locks are initialized in yr_initialize
+// function.
 
 YR_MUTEX *openssl_locks;
 
@@ -130,7 +131,7 @@ YR_API int yr_initialize(void)
   FAIL_ON_ERROR(yr_thread_storage_create(&tidx_key));
   FAIL_ON_ERROR(yr_thread_storage_create(&recovery_state_key));
 
-  #ifdef HAVE_LIBCRYPTO
+  #if defined HAVE_LIBCRYPTO && OPENSSL_VERSION_NUMBER < 0x10100000L
 
   openssl_locks = (YR_MUTEX*) OPENSSL_malloc(
       CRYPTO_num_locks() * sizeof(YR_MUTEX));
@@ -175,7 +176,7 @@ YR_API void yr_finalize_thread(void)
 
 YR_API int yr_finalize(void)
 {
-  #ifdef HAVE_LIBCRYPTO
+  #if defined HAVE_LIBCRYPTO && OPENSSL_VERSION_NUMBER < 0x10100000L
   int i;
   #endif
 
@@ -191,7 +192,7 @@ YR_API int yr_finalize(void)
   if (init_count > 0)
     return ERROR_SUCCESS;
 
-  #ifdef HAVE_LIBCRYPTO
+  #if defined HAVE_LIBCRYPTO && OPENSSL_VERSION_NUMBER < 0x10100000L
 
   for (i = 0; i < CRYPTO_num_locks(); i ++)
     yr_mutex_destroy(&openssl_locks[i]);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list