aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurens Van Houtven <_@lvh.cc>2014-06-17 14:15:04 +0200
committerLaurens Van Houtven <_@lvh.cc>2014-06-17 14:15:04 +0200
commit19cc049139b77ec1b2935747b88fd6f25e9bd8af (patch)
tree32d49703dbeb3d874ae3012785f49d1a621dca0f
parent073015b24a9f813072b8f7c0bae4a15317009193 (diff)
downloadcryptography-19cc049139b77ec1b2935747b88fd6f25e9bd8af.tar.gz
cryptography-19cc049139b77ec1b2935747b88fd6f25e9bd8af.tar.bz2
cryptography-19cc049139b77ec1b2935747b88fd6f25e9bd8af.zip
Not all 1.0.2 releases!
-rw-r--r--cryptography/hazmat/bindings/openssl/x509_vfy.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/cryptography/hazmat/bindings/openssl/x509_vfy.py b/cryptography/hazmat/bindings/openssl/x509_vfy.py
index 2a456708..d6ae745b 100644
--- a/cryptography/hazmat/bindings/openssl/x509_vfy.py
+++ b/cryptography/hazmat/bindings/openssl/x509_vfy.py
@@ -27,6 +27,7 @@ typedef STACK_OF(ASN1_OBJECT) Cryptography_STACK_OF_ASN1_OBJECT;
"""
TYPES = """
+static const long Cryptography_HAS_X509_VERIFY_PARAM_SET_HOSTFLAGS;
static const long Cryptography_HAS_102_VERIFICATION_PARAMS;
static const long Cryptography_HAS_100_VERIFICATION_PARAMS;
@@ -81,6 +82,14 @@ int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *, const char *);
"""
CUSTOMIZATIONS = """
+// OpenSSL 1.0.2+, but only some very new releases
+#ifdef X509_VERIFY_PARAM_set_hostflags
+static const long Cryptography_HAS_X509_VERIFY_PARAM_SET_HOSTFLAGS = 1;
+#else
+static const long Cryptography_HAS_X509_VERIFY_PARAM_SET_HOSTFLAGS = 0;
+void (*X509_VERIFY_PARAM_set_hostflags)(X509_VERIFY_PARAM *, unsigned int) = NULL;
+#endif
+
// OpenSSL 1.0.2+
#if OPENSSL_VERSION_NUMBER >= 0x10002000L
static const long Cryptography_HAS_102_VERIFICATION_PARAMS = 1;
@@ -93,7 +102,6 @@ static const long X509_V_FLAG_SUITEB_128_LOS = 0;
static const long X509_V_FLAG_PARTIAL_CHAIN = 0;
int (*X509_VERIFY_PARAM_set1_host)(X509_VERIFY_PARAM *, const unsigned char *, size_t) = NULL;
-void (*X509_VERIFY_PARAM_set_hostflags)(X509_VERIFY_PARAM *, unsigned int) = NULL;
int (*X509_VERIFY_PARAM_set1_email)(X509_VERIFY_PARAM *, const unsigned char *, size_t) = NULL;
int (*X509_VERIFY_PARAM_set1_ip)(X509_VERIFY_PARAM *, const unsigned char *, size_t) = NULL;
int (*X509_VERIFY_PARAM_set1_ip_asc)(X509_VERIFY_PARAM *, const char *) = NULL;
@@ -111,6 +119,9 @@ static const long X509_V_FLAG_CHECK_SS_SIGNATURE = 0;
"""
CONDITIONAL_NAMES = {
+ "Cryptography_HAS_X509_VERIFY_PARAM_SET_HOSTFLAGS": [
+ "X509_VERIFY_PARAM_set_hostflags",
+ ],
"Cryptography_HAS_102_VERIFICATION_PARAMS": [
"X509_V_FLAG_TRUSTED_FIRST",
"X509_V_FLAG_SUITEB_128_LOS_ONLY",
@@ -119,7 +130,6 @@ CONDITIONAL_NAMES = {
"X509_V_FLAG_PARTIAL_CHAIN",
"X509_VERIFY_PARAM_set1_host",
- "X509_VERIFY_PARAM_set_hostflags",
"X509_VERIFY_PARAM_set1_email",
"X509_VERIFY_PARAM_set1_ip",
"X509_VERIFY_PARAM_set1_ip_asc",