From d30e267c29ba03157a9551aba013c6725dfd650d Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 17 Mar 2016 09:40:38 -0400 Subject: we need CRYPTO_LOCK & CRYPTO_UNLOCK on < 1.1.0 so conditionally bind them --- src/_cffi_src/openssl/crypto.py | 11 +++++++++++ src/cryptography/hazmat/bindings/openssl/_conditional.py | 4 ++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py index d610957a..d6e5de15 100644 --- a/src/_cffi_src/openssl/crypto.py +++ b/src/_cffi_src/openssl/crypto.py @@ -9,6 +9,8 @@ INCLUDES = """ """ TYPES = """ +static const long Cryptography_HAS_LOCKING_CALLBACKS; + typedef ... CRYPTO_THREADID; static const int SSLEAY_VERSION; @@ -25,6 +27,8 @@ static const int CRYPTO_MEM_CHECK_ON; static const int CRYPTO_MEM_CHECK_OFF; static const int CRYPTO_MEM_CHECK_ENABLE; static const int CRYPTO_MEM_CHECK_DISABLE; +static const int CRYPTO_LOCK; +static const int CRYPTO_UNLOCK; """ FUNCTIONS = """ @@ -80,4 +84,11 @@ CUSTOMIZATIONS = """ # define OPENSSL_PLATFORM SSLEAY_PLATFORM # define OPENSSL_DIR SSLEAY_DIR #endif +#if !defined(CRYPTO_LOCK) +static const long Cryptography_HAS_LOCKING_CALLBACKS = 0; +static const long CRYPTO_LOCK = 0; +static const long CRYPTO_UNLOCK = 0; +#else +static const long Cryptography_HAS_LOCKING_CALLBACKS = 1; +#endif """ diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py index 148534da..436fcebd 100644 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py @@ -412,4 +412,8 @@ CONDITIONAL_NAMES = { "TLS_ST_BEFORE", "TLS_ST_OK", ], + "Cryptography_HAS_LOCKING_CALLBACKS": [ + "CRYPTO_LOCK", + "CRYPTO_UNLOCK", + ] } -- cgit v1.2.3