aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 07:53:34 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 07:53:34 -0800
commit7dc4a127e2fe5ec07ba94e96de00a6b2f65f4371 (patch)
treea446d6b8510150706093dc428c533a9097069b6d
parent05ef1d3854fb3e399b96a330b22ec383d930f0aa (diff)
downloadcryptography-7dc4a127e2fe5ec07ba94e96de00a6b2f65f4371.tar.gz
cryptography-7dc4a127e2fe5ec07ba94e96de00a6b2f65f4371.tar.bz2
cryptography-7dc4a127e2fe5ec07ba94e96de00a6b2f65f4371.zip
Remove names from the backend that don't actually exist
-rw-r--r--cryptography/hazmat/backends/openssl/asn1.py2
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py8
-rw-r--r--cryptography/hazmat/backends/openssl/bignum.py2
-rw-r--r--cryptography/hazmat/backends/openssl/bio.py2
-rw-r--r--cryptography/hazmat/backends/openssl/conf.py2
-rw-r--r--cryptography/hazmat/backends/openssl/crypto.py2
-rw-r--r--cryptography/hazmat/backends/openssl/dh.py2
-rw-r--r--cryptography/hazmat/backends/openssl/dsa.py2
-rw-r--r--cryptography/hazmat/backends/openssl/engine.py2
-rw-r--r--cryptography/hazmat/backends/openssl/err.py2
-rw-r--r--cryptography/hazmat/backends/openssl/evp.py10
-rw-r--r--cryptography/hazmat/backends/openssl/hmac.py2
-rw-r--r--cryptography/hazmat/backends/openssl/nid.py2
-rw-r--r--cryptography/hazmat/backends/openssl/opensslv.py2
-rw-r--r--cryptography/hazmat/backends/openssl/pem.py2
-rw-r--r--cryptography/hazmat/backends/openssl/pkcs12.py2
-rw-r--r--cryptography/hazmat/backends/openssl/pkcs7.py2
-rw-r--r--cryptography/hazmat/backends/openssl/rand.py2
-rw-r--r--cryptography/hazmat/backends/openssl/rsa.py2
-rw-r--r--cryptography/hazmat/backends/openssl/ssl.py12
-rw-r--r--cryptography/hazmat/backends/openssl/x509.py2
-rw-r--r--cryptography/hazmat/backends/openssl/x509name.py2
-rw-r--r--cryptography/hazmat/backends/openssl/x509v3.py2
23 files changed, 70 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/openssl/asn1.py b/cryptography/hazmat/backends/openssl/asn1.py
index c752e682..b56932fa 100644
--- a/cryptography/hazmat/backends/openssl/asn1.py
+++ b/cryptography/hazmat/backends/openssl/asn1.py
@@ -122,3 +122,5 @@ BIGNUM *ASN1_INTEGER_to_BN(ASN1_INTEGER *, BIGNUM *);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 080cb5f1..5d6b5bcc 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -141,6 +141,14 @@ class Backend(object):
libraries=["crypto", "ssl"],
)
+ for name in cls._modules:
+ module_name = "cryptography.hazmat.backends.openssl." + name
+ __import__(module_name)
+ module = sys.modules[module_name]
+ for name, condition in module.CONDITIONAL_NAMES.items():
+ if not getattr(lib, condition):
+ delattr(lib, name)
+
cls.ffi = ffi
cls.lib = lib
cls.lib.OpenSSL_add_all_algorithms()
diff --git a/cryptography/hazmat/backends/openssl/bignum.py b/cryptography/hazmat/backends/openssl/bignum.py
index 1b0fe5ab..68d0c3a2 100644
--- a/cryptography/hazmat/backends/openssl/bignum.py
+++ b/cryptography/hazmat/backends/openssl/bignum.py
@@ -38,3 +38,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/bio.py b/cryptography/hazmat/backends/openssl/bio.py
index c23dd0d8..d164804f 100644
--- a/cryptography/hazmat/backends/openssl/bio.py
+++ b/cryptography/hazmat/backends/openssl/bio.py
@@ -171,3 +171,5 @@ long BIO_set_buffer_read_data(BIO *, void *, long);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/conf.py b/cryptography/hazmat/backends/openssl/conf.py
index 4846252c..6d818cf1 100644
--- a/cryptography/hazmat/backends/openssl/conf.py
+++ b/cryptography/hazmat/backends/openssl/conf.py
@@ -27,3 +27,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/crypto.py b/cryptography/hazmat/backends/openssl/crypto.py
index 11e5f2f5..8d88c16e 100644
--- a/cryptography/hazmat/backends/openssl/crypto.py
+++ b/cryptography/hazmat/backends/openssl/crypto.py
@@ -40,3 +40,5 @@ void CRYPTO_malloc_debug_init();
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/dh.py b/cryptography/hazmat/backends/openssl/dh.py
index b8fbf368..56fa8b46 100644
--- a/cryptography/hazmat/backends/openssl/dh.py
+++ b/cryptography/hazmat/backends/openssl/dh.py
@@ -29,3 +29,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/dsa.py b/cryptography/hazmat/backends/openssl/dsa.py
index e6c369a6..3b77d7ae 100644
--- a/cryptography/hazmat/backends/openssl/dsa.py
+++ b/cryptography/hazmat/backends/openssl/dsa.py
@@ -31,3 +31,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/engine.py b/cryptography/hazmat/backends/openssl/engine.py
index 1f377665..cc214f84 100644
--- a/cryptography/hazmat/backends/openssl/engine.py
+++ b/cryptography/hazmat/backends/openssl/engine.py
@@ -63,3 +63,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/err.py b/cryptography/hazmat/backends/openssl/err.py
index f31c2405..2fb8bbe1 100644
--- a/cryptography/hazmat/backends/openssl/err.py
+++ b/cryptography/hazmat/backends/openssl/err.py
@@ -74,3 +74,5 @@ int ERR_FATAL_ERROR(unsigned long);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/evp.py b/cryptography/hazmat/backends/openssl/evp.py
index 8cb44610..fa35c6ac 100644
--- a/cryptography/hazmat/backends/openssl/evp.py
+++ b/cryptography/hazmat/backends/openssl/evp.py
@@ -35,6 +35,8 @@ static const int EVP_PKEY_DSA;
static const int Cryptography_EVP_CTRL_GCM_SET_IVLEN;
static const int Cryptography_EVP_CTRL_GCM_GET_TAG;
static const int Cryptography_EVP_CTRL_GCM_SET_TAG;
+
+static const int Cryptography_HAS_GCM;
"""
FUNCTIONS = """
@@ -101,12 +103,20 @@ int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *, int, int, void *);
CUSTOMIZATIONS = """
#ifdef EVP_CTRL_GCM_SET_TAG
+const int Cryptography_HAS_GCM = 1;
const int Cryptography_EVP_CTRL_GCM_GET_TAG = EVP_CTRL_GCM_GET_TAG;
const int Cryptography_EVP_CTRL_GCM_SET_TAG = EVP_CTRL_GCM_SET_TAG;
const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = EVP_CTRL_GCM_SET_IVLEN;
#else
+const int Cryptography_HAS_GCM = 0;
const int Cryptography_EVP_CTRL_GCM_GET_TAG = -1;
const int Cryptography_EVP_CTRL_GCM_SET_TAG = -1;
const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = -1;
#endif
"""
+
+CONDITIONAL_NAMES = {
+ "Cryptography_EVP_CTRL_GCM_GET_TAG": "Cryptography_HAS_GCM",
+ "Cryptography_EVP_CTRL_GCM_SET_TAG": "Cryptography_HAS_GCM",
+ "Cryptography_EVP_CTRL_GCM_SET_IVLEN": "Cryptography_HAS_GCM",
+}
diff --git a/cryptography/hazmat/backends/openssl/hmac.py b/cryptography/hazmat/backends/openssl/hmac.py
index 10e67141..5f9e0945 100644
--- a/cryptography/hazmat/backends/openssl/hmac.py
+++ b/cryptography/hazmat/backends/openssl/hmac.py
@@ -88,3 +88,5 @@ int Cryptography_HMAC_CTX_copy(HMAC_CTX *dst_ctx, HMAC_CTX *src_ctx) {
#endif
}
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/nid.py b/cryptography/hazmat/backends/openssl/nid.py
index 9816dde4..111f82f9 100644
--- a/cryptography/hazmat/backends/openssl/nid.py
+++ b/cryptography/hazmat/backends/openssl/nid.py
@@ -47,3 +47,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/opensslv.py b/cryptography/hazmat/backends/openssl/opensslv.py
index d463776c..37bbd2a7 100644
--- a/cryptography/hazmat/backends/openssl/opensslv.py
+++ b/cryptography/hazmat/backends/openssl/opensslv.py
@@ -27,3 +27,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/pem.py b/cryptography/hazmat/backends/openssl/pem.py
index cef7839f..ee5552c5 100644
--- a/cryptography/hazmat/backends/openssl/pem.py
+++ b/cryptography/hazmat/backends/openssl/pem.py
@@ -55,3 +55,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/pkcs12.py b/cryptography/hazmat/backends/openssl/pkcs12.py
index d91d100f..b3ecd0aa 100644
--- a/cryptography/hazmat/backends/openssl/pkcs12.py
+++ b/cryptography/hazmat/backends/openssl/pkcs12.py
@@ -35,3 +35,5 @@ PKCS12 *PKCS12_create(char *, char *, EVP_PKEY *, X509 *,
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/pkcs7.py b/cryptography/hazmat/backends/openssl/pkcs7.py
index 60ea3c52..43f9540b 100644
--- a/cryptography/hazmat/backends/openssl/pkcs7.py
+++ b/cryptography/hazmat/backends/openssl/pkcs7.py
@@ -35,3 +35,5 @@ int PKCS7_type_is_data(PKCS7 *);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/rand.py b/cryptography/hazmat/backends/openssl/rand.py
index 848ee05a..ddd0a3d8 100644
--- a/cryptography/hazmat/backends/openssl/rand.py
+++ b/cryptography/hazmat/backends/openssl/rand.py
@@ -38,3 +38,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/rsa.py b/cryptography/hazmat/backends/openssl/rsa.py
index ad0d37b4..e3a24d0f 100644
--- a/cryptography/hazmat/backends/openssl/rsa.py
+++ b/cryptography/hazmat/backends/openssl/rsa.py
@@ -57,3 +57,5 @@ MACROS = """
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/ssl.py b/cryptography/hazmat/backends/openssl/ssl.py
index 4fc20ebc..45dc97bd 100644
--- a/cryptography/hazmat/backends/openssl/ssl.py
+++ b/cryptography/hazmat/backends/openssl/ssl.py
@@ -262,3 +262,15 @@ void (*SSL_CTX_set_tlsext_servername_callback)(
int (*)(const SSL *, int *, void *)) = NULL;
#endif
"""
+
+CONDITIONAL_NAMES = {
+ "SSLv2_method": "Cryptography_HAS_SSL2",
+ "SSLv2_client_method": "Cryptography_HAS_SSL2",
+ "SSLv2_server_method": "Cryptography_HAS_SSL2",
+
+ "SSL_set_tlsext_host_name": "Cryptography_HAS_TLSEXT_HOSTNAME",
+ "SSL_get_servername": "Cryptography_HAS_TLSEXT_HOSTNAME",
+ "SSL_CTX_set_tlsext_servername_callback": (
+ "Cryptography_HAS_TLSEXT_HOSTNAME"
+ ),
+}
diff --git a/cryptography/hazmat/backends/openssl/x509.py b/cryptography/hazmat/backends/openssl/x509.py
index b2ee672e..dd7815fa 100644
--- a/cryptography/hazmat/backends/openssl/x509.py
+++ b/cryptography/hazmat/backends/openssl/x509.py
@@ -188,3 +188,5 @@ int X509_CRL_set_nextUpdate(X509_CRL *, const ASN1_TIME *);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/x509name.py b/cryptography/hazmat/backends/openssl/x509name.py
index 896f0ae4..4be39b53 100644
--- a/cryptography/hazmat/backends/openssl/x509name.py
+++ b/cryptography/hazmat/backends/openssl/x509name.py
@@ -49,3 +49,5 @@ void sk_X509_NAME_free(struct stack_st_X509_NAME *);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}
diff --git a/cryptography/hazmat/backends/openssl/x509v3.py b/cryptography/hazmat/backends/openssl/x509v3.py
index bc26236c..6d2d2361 100644
--- a/cryptography/hazmat/backends/openssl/x509v3.py
+++ b/cryptography/hazmat/backends/openssl/x509v3.py
@@ -95,3 +95,5 @@ const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int);
CUSTOMIZATIONS = """
"""
+
+CONDITIONAL_NAMES = {}