aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-03-21 10:18:42 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-03-21 10:18:42 -0700
commit58467ce5e5a78bea2be15a5a96dc8c816d1733b8 (patch)
tree82e08102cab9d984b64645b332dd9644b1e1813b
parent59cb7f978b30b833bde4ac355624047c6c6c07e3 (diff)
parent71f2c504cba8f5f7d800766e131b98a64d9c75dd (diff)
downloadcryptography-58467ce5e5a78bea2be15a5a96dc8c816d1733b8.tar.gz
cryptography-58467ce5e5a78bea2be15a5a96dc8c816d1733b8.tar.bz2
cryptography-58467ce5e5a78bea2be15a5a96dc8c816d1733b8.zip
Merge pull request #836 from reaperhulk/netbsd-why-oh-why
workaround a netbsd bug where they did not compile with d1_meth.c
-rw-r--r--cryptography/hazmat/bindings/openssl/ssl.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/cryptography/hazmat/bindings/openssl/ssl.py b/cryptography/hazmat/bindings/openssl/ssl.py
index 9735ae6a..b4319e8b 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 <sys/param.h>
+# 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",
+ ],
}