From 2b49e3456e14e7a85983571a12070dc8cecbb7c5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Thu, 16 Jan 2014 15:42:40 -0500 Subject: add conditional ERR_remove_thread_state. PyOpenSSL uses this --- cryptography/hazmat/bindings/openssl/crypto.py | 2 ++ cryptography/hazmat/bindings/openssl/err.py | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/openssl/crypto.py b/cryptography/hazmat/bindings/openssl/crypto.py index 189867bd..40d91bf2 100644 --- a/cryptography/hazmat/bindings/openssl/crypto.py +++ b/cryptography/hazmat/bindings/openssl/crypto.py @@ -16,6 +16,8 @@ INCLUDES = """ """ TYPES = """ +typedef ... CRYPTO_THREADID; + static const int SSLEAY_VERSION; static const int SSLEAY_CFLAGS; static const int SSLEAY_PLATFORM; diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index 1b66bd2a..99808d41 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -16,6 +16,8 @@ INCLUDES = """ """ TYPES = """ +static const int Cryptography_HAS_NEW_THREAD_METHOD; + struct ERR_string_data_st { unsigned long error; const char *string; @@ -114,9 +116,24 @@ int ERR_GET_LIB(unsigned long); int ERR_GET_FUNC(unsigned long); int ERR_GET_REASON(unsigned long); int ERR_FATAL_ERROR(unsigned long); +/* introduced in 1.0.0 so we have to handle this specially to continue + * supporting 0.9.8 + */ +void ERR_remove_thread_state(const CRYPTO_THREADID *); """ CUSTOMIZATIONS = """ +#if OPENSSL_VERSION_NUMBER >= 0x10000000L +static const long Cryptography_HAS_NEW_THREAD_METHOD = 1; +#else +static const long Cryptography_HAS_NEW_THREAD_METHOD = 0; +typedef uint32_t CRYPTO_THREADID; +void (*ERR_remove_thread_state)(const CRYPTO_THREADID *); +#endif """ -CONDITIONAL_NAMES = {} +CONDITIONAL_NAMES = { + "Cryptography_HAS_NEW_THREAD_METHOD": [ + "ERR_remove_thread_state" + ], +} -- cgit v1.2.3 From e30d62cd9e2cf95259721b24bbf6d33aaf08161b Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 17 Jan 2014 21:15:41 -0600 Subject: rename variable to be less confusing and terrible --- cryptography/hazmat/bindings/openssl/err.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index 99808d41..5399b597 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -16,7 +16,7 @@ INCLUDES = """ """ TYPES = """ -static const int Cryptography_HAS_NEW_THREAD_METHOD; +static const int Cryptography_HAS_REMOVE_THREAD_STATE; struct ERR_string_data_st { unsigned long error; @@ -124,16 +124,16 @@ void ERR_remove_thread_state(const CRYPTO_THREADID *); CUSTOMIZATIONS = """ #if OPENSSL_VERSION_NUMBER >= 0x10000000L -static const long Cryptography_HAS_NEW_THREAD_METHOD = 1; +static const long Cryptography_HAS_REMOVE_THREAD_STATE = 1; #else -static const long Cryptography_HAS_NEW_THREAD_METHOD = 0; +static const long Cryptography_HAS_REMOVE_THREAD_STATE = 0; typedef uint32_t CRYPTO_THREADID; void (*ERR_remove_thread_state)(const CRYPTO_THREADID *); #endif """ CONDITIONAL_NAMES = { - "Cryptography_HAS_NEW_THREAD_METHOD": [ + "Cryptography_HAS_REMOVE_THREAD_STATE": [ "ERR_remove_thread_state" ], } -- cgit v1.2.3