From 854e2789f9e1fbb672656a8b9a9f4fd857b1d920 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 16 Mar 2016 21:02:59 -0400 Subject: in 1.1.0 OpenSSL does its own locking now! locking funcs are now macros the macros are no ops. Also remove some constants that we never used and were related to locking --- src/_cffi_src/openssl/crypto.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/_cffi_src/openssl/crypto.py') diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py index b9ecd5ab..d610957a 100644 --- a/src/_cffi_src/openssl/crypto.py +++ b/src/_cffi_src/openssl/crypto.py @@ -25,11 +25,6 @@ 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; -static const int CRYPTO_READ; -static const int CRYPTO_WRITE; -static const int CRYPTO_LOCK_SSL; """ FUNCTIONS = """ @@ -38,14 +33,16 @@ int CRYPTO_mem_ctrl(int); int CRYPTO_is_mem_check_on(void); void CRYPTO_mem_leaks(struct bio_st *); void CRYPTO_cleanup_all_ex_data(void); -int CRYPTO_num_locks(void); -void CRYPTO_set_locking_callback(void(*)(int, int, const char *, int)); -void (*CRYPTO_get_locking_callback(void))(int, int, const char *, int); -void CRYPTO_lock(int, int, const char *, int); """ MACROS = """ +/* as of 1.1.0 OpenSSL does its own locking *angelic chorus*. These functions + have become macros that are no ops */ +int CRYPTO_num_locks(void); +void CRYPTO_set_locking_callback(void(*)(int, int, const char *, int)); +void (*CRYPTO_get_locking_callback(void))(int, int, const char *, int); + /* SSLeay was removed in 1.1.0 */ unsigned long SSLeay(void); const char *SSLeay_version(int); -- cgit v1.2.3 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 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/_cffi_src/openssl/crypto.py') 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 """ -- cgit v1.2.3 From fd42a00b6e8b120ae7c3219cec08659063b78b2b Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 17 Mar 2016 10:01:56 -0400 Subject: need this one too --- src/_cffi_src/openssl/crypto.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/_cffi_src/openssl/crypto.py') diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py index d6e5de15..86f2c7d6 100644 --- a/src/_cffi_src/openssl/crypto.py +++ b/src/_cffi_src/openssl/crypto.py @@ -29,6 +29,7 @@ static const int CRYPTO_MEM_CHECK_ENABLE; static const int CRYPTO_MEM_CHECK_DISABLE; static const int CRYPTO_LOCK; static const int CRYPTO_UNLOCK; +static const int CRYPTO_LOCK_SSL; """ FUNCTIONS = """ @@ -88,6 +89,7 @@ CUSTOMIZATIONS = """ static const long Cryptography_HAS_LOCKING_CALLBACKS = 0; static const long CRYPTO_LOCK = 0; static const long CRYPTO_UNLOCK = 0; +static const long CRYPTO_LOCK_SSL = 0; #else static const long Cryptography_HAS_LOCKING_CALLBACKS = 1; #endif -- cgit v1.2.3 From 7aa2a329792d89a22451f1d14a888f1d94547dc5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 17 Mar 2016 13:41:31 -0400 Subject: sigh... and this one --- src/_cffi_src/openssl/crypto.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/_cffi_src/openssl/crypto.py') diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py index 86f2c7d6..27948bd5 100644 --- a/src/_cffi_src/openssl/crypto.py +++ b/src/_cffi_src/openssl/crypto.py @@ -29,6 +29,7 @@ static const int CRYPTO_MEM_CHECK_ENABLE; static const int CRYPTO_MEM_CHECK_DISABLE; static const int CRYPTO_LOCK; static const int CRYPTO_UNLOCK; +static const int CRYPTO_READ; static const int CRYPTO_LOCK_SSL; """ @@ -89,6 +90,7 @@ CUSTOMIZATIONS = """ static const long Cryptography_HAS_LOCKING_CALLBACKS = 0; static const long CRYPTO_LOCK = 0; static const long CRYPTO_UNLOCK = 0; +static const long CRYPTO_READ = 0; static const long CRYPTO_LOCK_SSL = 0; #else static const long Cryptography_HAS_LOCKING_CALLBACKS = 1; -- cgit v1.2.3 From e55b381c10eaa17e843d7d2e3aa12cdc34e96799 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 17 Mar 2016 14:31:53 -0400 Subject: slowly re-add everything that was removed, but now conditional --- src/_cffi_src/openssl/crypto.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/_cffi_src/openssl/crypto.py') diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py index 27948bd5..0ecfbd1e 100644 --- a/src/_cffi_src/openssl/crypto.py +++ b/src/_cffi_src/openssl/crypto.py @@ -60,6 +60,9 @@ void CRYPTO_add(int *, int, int); /* this is a macro in 1.1.0 */ void OPENSSL_free(void *); + +/* This was removed in 1.1.0 */ +void CRYPTO_lock(int, int, const char *, int); """ CUSTOMIZATIONS = """ @@ -92,6 +95,7 @@ static const long CRYPTO_LOCK = 0; static const long CRYPTO_UNLOCK = 0; static const long CRYPTO_READ = 0; static const long CRYPTO_LOCK_SSL = 0; +void (*CRYPTO_lock)(int, int, const char *, int) = NULL; #else static const long Cryptography_HAS_LOCKING_CALLBACKS = 1; #endif -- cgit v1.2.3