@@ -26,6 +26,7 @@
#include <openssl/rand.h>
#include <openssl/hmac.h>
#include <openssl/evp.h>
+#include <openssl/opensslv.h>
#define MAX_SESSIONS 32
@@ -948,16 +949,18 @@ odp_crypto_operation(odp_crypto_op_param_t *param,
return 0;
}
-static unsigned long openssl_thread_id(void)
+static
+unsigned long ODP_UNUSED openssl_thread_id(void)
{
return (unsigned long)odp_thread_id();
}
odp_ticketlock_t *openssl_locks;
-static void openssl_lock(int mode, int n,
- const char *file ODP_UNUSED,
- int line ODP_UNUSED)
+static
+void ODP_UNUSED openssl_lock(int mode, int n,
+ const char *file ODP_UNUSED,
+ int line ODP_UNUSED)
{
if (mode & CRYPTO_LOCK)
odp_ticketlock_lock(&openssl_locks[n]);
@@ -972,6 +975,10 @@ static void openssl_init_locks(void)
odp_shm_t shm;
int idx;
+ /* OpenSSL does not need locks after 1.1.0 */
+ if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ return;
+
nlocks = CRYPTO_num_locks();
if (nlocks <= 0)
return;
@@ -996,6 +1003,10 @@ static void openssl_init_locks(void)
static int openssl_term_locks(void)
{
+ /* OpenSSL does not need locks after 1.1.0 */
+ if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ return 0;
+
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_id_callback(NULL);
OpenSSL 1.1.0 uses new threading API. It is no longer necessary to set locking callbacks to use OpenSSL in a multi-threaded environment. The old threading API should no longer be used. So don't allocate/set locking callbacks with new OpenSSL. Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org> --- platform/linux-generic/odp_crypto.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.11.0