From 10312c1768ebeb59106d2c1538e4fb491462088b Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 21 Mar 2014 10:58:19 -0400 Subject: workaround a netbsd bug where they did not compile with d1_meth.c --- cryptography/hazmat/bindings/openssl/ssl.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/cryptography/hazmat/bindings/openssl/ssl.py b/cryptography/hazmat/bindings/openssl/ssl.py index 9735ae6a..4749ab44 100644 --- a/cryptography/hazmat/bindings/openssl/ssl.py +++ b/cryptography/hazmat/bindings/openssl/ssl.py @@ -41,6 +41,7 @@ static const long Cryptography_HAS_OP_NO_COMPRESSION; static const long Cryptography_HAS_SSL_OP_MSIE_SSLV2_RSA_PADDING; static const long Cryptography_HAS_SSL_SET_SSL_CTX; static const long Cryptography_HAS_SSL_OP_NO_TICKET; +static const long Cryptography_HAS_NETBSD_D1_METH; static const long SSL_FILETYPE_PEM; static const long SSL_FILETYPE_ASN1; @@ -401,6 +402,24 @@ static const long Cryptography_HAS_SSL_SET_SSL_CTX = 0; static const long TLSEXT_NAMETYPE_host_name = 0; SSL_CTX *(*SSL_set_SSL_CTX)(SSL *, SSL_CTX *) = NULL; #endif + +/* NetBSD shipped without including d1_meth.c. This workaround checks to see + if the version of NetBSD we're currently running on is old enough to + have the bug and provides an empty implementation so we can link and + then remove the function from the ffi object. */ +#ifdef __NetBSD__ +# include +# if (__NetBSD_Version__ < 699003800) +static const long Cryptography_HAS_NETBSD_D1_METH = 0; +const SSL_METHOD *DTLSv1_method)(void) { + return NULL; +} +# else +static const long Cryptography_HAS_NETBSD_D1_METH = 1; +# endif +#else +static const long Cryptography_HAS_NETBSD_D1_METH = 1; +#endif """ CONDITIONAL_NAMES = { @@ -454,4 +473,8 @@ CONDITIONAL_NAMES = { "SSL_set_SSL_CTX", "TLSEXT_NAMETYPE_host_name", ], + + "Cryptography_HAS_NETBSD_D1_METH": [ + "DTLSv1_method", + ], } -- cgit v1.2.3 From 71f2c504cba8f5f7d800766e131b98a64d9c75dd Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 21 Mar 2014 12:29:21 -0400 Subject: c has syntax rules too --- cryptography/hazmat/bindings/openssl/ssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/openssl/ssl.py b/cryptography/hazmat/bindings/openssl/ssl.py index 4749ab44..b4319e8b 100644 --- a/cryptography/hazmat/bindings/openssl/ssl.py +++ b/cryptography/hazmat/bindings/openssl/ssl.py @@ -411,7 +411,7 @@ SSL_CTX *(*SSL_set_SSL_CTX)(SSL *, SSL_CTX *) = NULL; # include # if (__NetBSD_Version__ < 699003800) static const long Cryptography_HAS_NETBSD_D1_METH = 0; -const SSL_METHOD *DTLSv1_method)(void) { +const SSL_METHOD *DTLSv1_method(void) { return NULL; } # else -- cgit v1.2.3