aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 08:02:49 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-23 08:02:49 -0800
commit3e52645f14dc3f015f354fb1c545259a4d882bc7 (patch)
treea61174658958fda5f1be9084e79208da04a11e67
parent7938206b7a7416f5a1a7abd7b652302ee2125a91 (diff)
downloadcryptography-3e52645f14dc3f015f354fb1c545259a4d882bc7.tar.gz
cryptography-3e52645f14dc3f015f354fb1c545259a4d882bc7.tar.bz2
cryptography-3e52645f14dc3f015f354fb1c545259a4d882bc7.zip
Invert these dics for more readability
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py5
-rw-r--r--cryptography/hazmat/backends/openssl/evp.py8
-rw-r--r--cryptography/hazmat/backends/openssl/ssl.py18
3 files changed, 18 insertions, 13 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 67a3e698..6cc8275d 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -146,9 +146,10 @@ class Backend(object):
module_name = cls._module_prefix + name
__import__(module_name)
module = sys.modules[module_name]
- for name, condition in module.CONDITIONAL_NAMES.items():
+ for condition, names in module.CONDITIONAL_NAMES.items():
if not getattr(lib, condition):
- delattr(lib, name)
+ for name in names:
+ delattr(lib, name)
cls.ffi = ffi
cls.lib = lib
diff --git a/cryptography/hazmat/backends/openssl/evp.py b/cryptography/hazmat/backends/openssl/evp.py
index fa35c6ac..7e50a6b3 100644
--- a/cryptography/hazmat/backends/openssl/evp.py
+++ b/cryptography/hazmat/backends/openssl/evp.py
@@ -116,7 +116,9 @@ const int Cryptography_EVP_CTRL_GCM_SET_IVLEN = -1;
"""
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",
+ "Cryptography_HAS_GCM": [
+ "Cryptography_EVP_CTRL_GCM_GET_TAG",
+ "Cryptography_EVP_CTRL_GCM_SET_TAG",
+ "Cryptography_EVP_CTRL_GCM_SET_IVLEN",
+ ]
}
diff --git a/cryptography/hazmat/backends/openssl/ssl.py b/cryptography/hazmat/backends/openssl/ssl.py
index 45dc97bd..bf1ffcc6 100644
--- a/cryptography/hazmat/backends/openssl/ssl.py
+++ b/cryptography/hazmat/backends/openssl/ssl.py
@@ -264,13 +264,15 @@ void (*SSL_CTX_set_tlsext_servername_callback)(
"""
CONDITIONAL_NAMES = {
- "SSLv2_method": "Cryptography_HAS_SSL2",
- "SSLv2_client_method": "Cryptography_HAS_SSL2",
- "SSLv2_server_method": "Cryptography_HAS_SSL2",
+ "Cryptography_HAS_SSL2": [
+ "SSLv2_method",
+ "SSLv2_client_method",
+ "SSLv2_server_method",
+ ],
- "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"
- ),
+ "Cryptography_HAS_TLSEXT_HOSTNAME": [
+ "SSL_set_tlsext_host_name",
+ "SSL_get_servername",
+ "SSL_CTX_set_tlsext_servername_callback",
+ ]
}