aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/_cffi_src/commoncrypto/cf.py2
-rw-r--r--src/_cffi_src/commoncrypto/common_cryptor.py2
-rw-r--r--src/_cffi_src/commoncrypto/common_digest.py2
-rw-r--r--src/_cffi_src/commoncrypto/common_hmac.py2
-rw-r--r--src/_cffi_src/commoncrypto/common_key_derivation.py2
-rw-r--r--src/_cffi_src/commoncrypto/common_symmetric_key_wrap.py2
-rw-r--r--src/_cffi_src/commoncrypto/secimport.py2
-rw-r--r--src/_cffi_src/commoncrypto/secitem.py2
-rw-r--r--src/_cffi_src/commoncrypto/seckey.py2
-rw-r--r--src/_cffi_src/commoncrypto/seckeychain.py2
-rw-r--r--src/_cffi_src/commoncrypto/sectransform.py2
-rw-r--r--src/_cffi_src/openssl/aes.py7
-rw-r--r--src/_cffi_src/openssl/asn1.py2
-rw-r--r--src/_cffi_src/openssl/bignum.py2
-rw-r--r--src/_cffi_src/openssl/bio.py2
-rw-r--r--src/_cffi_src/openssl/cmac.py11
-rw-r--r--src/_cffi_src/openssl/cms.py34
-rw-r--r--src/_cffi_src/openssl/conf.py2
-rw-r--r--src/_cffi_src/openssl/crypto.py2
-rw-r--r--src/_cffi_src/openssl/dh.py2
-rw-r--r--src/_cffi_src/openssl/dsa.py2
-rw-r--r--src/_cffi_src/openssl/ec.py100
-rw-r--r--src/_cffi_src/openssl/ecdh.py9
-rw-r--r--src/_cffi_src/openssl/ecdsa.py24
-rw-r--r--src/_cffi_src/openssl/engine.py6
-rw-r--r--src/_cffi_src/openssl/err.py26
-rw-r--r--src/_cffi_src/openssl/evp.py32
-rw-r--r--src/_cffi_src/openssl/hmac.py2
-rw-r--r--src/_cffi_src/openssl/nid.py9
-rw-r--r--src/_cffi_src/openssl/objects.py2
-rw-r--r--src/_cffi_src/openssl/opensslv.py2
-rw-r--r--src/_cffi_src/openssl/pem.py6
-rw-r--r--src/_cffi_src/openssl/pkcs12.py2
-rw-r--r--src/_cffi_src/openssl/pkcs7.py2
-rw-r--r--src/_cffi_src/openssl/rand.py8
-rw-r--r--src/_cffi_src/openssl/rsa.py13
-rw-r--r--src/_cffi_src/openssl/ssl.py111
-rw-r--r--src/_cffi_src/openssl/x509.py15
-rw-r--r--src/_cffi_src/openssl/x509_vfy.py50
-rw-r--r--src/_cffi_src/openssl/x509name.py2
-rw-r--r--src/_cffi_src/openssl/x509v3.py2
-rw-r--r--src/_cffi_src/utils.py3
-rw-r--r--src/cryptography/hazmat/bindings/openssl/_conditional.py414
-rw-r--r--src/cryptography/hazmat/bindings/openssl/binding.py19
44 files changed, 432 insertions, 515 deletions
diff --git a/src/_cffi_src/commoncrypto/cf.py b/src/_cffi_src/commoncrypto/cf.py
index 77d2d7cc..9d4387e6 100644
--- a/src/_cffi_src/commoncrypto/cf.py
+++ b/src/_cffi_src/commoncrypto/cf.py
@@ -101,5 +101,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/common_cryptor.py b/src/_cffi_src/commoncrypto/common_cryptor.py
index fc6eef91..15c253e1 100644
--- a/src/_cffi_src/commoncrypto/common_cryptor.py
+++ b/src/_cffi_src/commoncrypto/common_cryptor.py
@@ -97,5 +97,3 @@ enum {
kCCModeGCM = 11
};
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/common_digest.py b/src/_cffi_src/commoncrypto/common_digest.py
index a76fc508..e40e729f 100644
--- a/src/_cffi_src/commoncrypto/common_digest.py
+++ b/src/_cffi_src/commoncrypto/common_digest.py
@@ -56,5 +56,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/common_hmac.py b/src/_cffi_src/commoncrypto/common_hmac.py
index fcd0c0f4..721cff53 100644
--- a/src/_cffi_src/commoncrypto/common_hmac.py
+++ b/src/_cffi_src/commoncrypto/common_hmac.py
@@ -35,5 +35,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/common_key_derivation.py b/src/_cffi_src/commoncrypto/common_key_derivation.py
index 19525852..13ae5806 100644
--- a/src/_cffi_src/commoncrypto/common_key_derivation.py
+++ b/src/_cffi_src/commoncrypto/common_key_derivation.py
@@ -37,5 +37,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/common_symmetric_key_wrap.py b/src/_cffi_src/commoncrypto/common_symmetric_key_wrap.py
index ea9e459d..9c7d42f8 100644
--- a/src/_cffi_src/commoncrypto/common_symmetric_key_wrap.py
+++ b/src/_cffi_src/commoncrypto/common_symmetric_key_wrap.py
@@ -33,5 +33,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/secimport.py b/src/_cffi_src/commoncrypto/secimport.py
index 41a799f9..81657596 100644
--- a/src/_cffi_src/commoncrypto/secimport.py
+++ b/src/_cffi_src/commoncrypto/secimport.py
@@ -84,5 +84,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/secitem.py b/src/_cffi_src/commoncrypto/secitem.py
index dd255430..19bfe763 100644
--- a/src/_cffi_src/commoncrypto/secitem.py
+++ b/src/_cffi_src/commoncrypto/secitem.py
@@ -25,5 +25,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/seckey.py b/src/_cffi_src/commoncrypto/seckey.py
index 01d42e6a..99fe61ec 100644
--- a/src/_cffi_src/commoncrypto/seckey.py
+++ b/src/_cffi_src/commoncrypto/seckey.py
@@ -22,5 +22,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/seckeychain.py b/src/_cffi_src/commoncrypto/seckeychain.py
index 6a2cb4be..221a87c7 100644
--- a/src/_cffi_src/commoncrypto/seckeychain.py
+++ b/src/_cffi_src/commoncrypto/seckeychain.py
@@ -23,5 +23,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/commoncrypto/sectransform.py b/src/_cffi_src/commoncrypto/sectransform.py
index bed94953..04037469 100644
--- a/src/_cffi_src/commoncrypto/sectransform.py
+++ b/src/_cffi_src/commoncrypto/sectransform.py
@@ -66,5 +66,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/aes.py b/src/_cffi_src/openssl/aes.py
index 15da9b62..8a5d0471 100644
--- a/src/_cffi_src/openssl/aes.py
+++ b/src/_cffi_src/openssl/aes.py
@@ -52,10 +52,3 @@ int (*AES_unwrap_key)(AES_KEY *, const unsigned char *, unsigned char *,
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_AES_WRAP": [
- "AES_wrap_key",
- "AES_unwrap_key",
- ],
-}
diff --git a/src/_cffi_src/openssl/asn1.py b/src/_cffi_src/openssl/asn1.py
index 96eff7d3..44e9de17 100644
--- a/src/_cffi_src/openssl/asn1.py
+++ b/src/_cffi_src/openssl/asn1.py
@@ -164,5 +164,3 @@ ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **, const unsigned char **, long);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/bignum.py b/src/_cffi_src/openssl/bignum.py
index d974e04e..843e5119 100644
--- a/src/_cffi_src/openssl/bignum.py
+++ b/src/_cffi_src/openssl/bignum.py
@@ -101,5 +101,3 @@ int BN_rshift1(BIGNUM *, BIGNUM *);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/bio.py b/src/_cffi_src/openssl/bio.py
index 6cc1bcb2..ac866831 100644
--- a/src/_cffi_src/openssl/bio.py
+++ b/src/_cffi_src/openssl/bio.py
@@ -168,5 +168,3 @@ int BIO_method_type(const BIO *);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/cmac.py b/src/_cffi_src/openssl/cmac.py
index c01a449f..f4a36866 100644
--- a/src/_cffi_src/openssl/cmac.py
+++ b/src/_cffi_src/openssl/cmac.py
@@ -43,14 +43,3 @@ void (*CMAC_CTX_free)(CMAC_CTX *) = NULL;
static const long Cryptography_HAS_CMAC = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_CMAC": [
- "CMAC_CTX_new",
- "CMAC_Init",
- "CMAC_Update",
- "CMAC_Final",
- "CMAC_CTX_copy",
- "CMAC_CTX_free",
- ],
-}
diff --git a/src/_cffi_src/openssl/cms.py b/src/_cffi_src/openssl/cms.py
index a43df5d9..f0da82dd 100644
--- a/src/_cffi_src/openssl/cms.py
+++ b/src/_cffi_src/openssl/cms.py
@@ -116,37 +116,3 @@ CMS_SignerInfo *(*CMS_add1_signer)(CMS_ContentInfo *, X509 *, EVP_PKEY *,
const EVP_MD *, unsigned int) = NULL;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_CMS": [
- "BIO_new_CMS",
- "i2d_CMS_bio_stream",
- "PEM_write_bio_CMS_stream",
- "CMS_final",
- "CMS_sign",
- "CMS_verify",
- "CMS_encrypt",
- "CMS_decrypt",
- "CMS_add1_signer",
- "CMS_TEXT",
- "CMS_NOCERTS",
- "CMS_NO_CONTENT_VERIFY",
- "CMS_NO_ATTR_VERIFY",
- "CMS_NOSIGS",
- "CMS_NOINTERN",
- "CMS_NO_SIGNER_CERT_VERIFY",
- "CMS_NOVERIFY",
- "CMS_DETACHED",
- "CMS_BINARY",
- "CMS_NOATTR",
- "CMS_NOSMIMECAP",
- "CMS_NOOLDMIMETYPE",
- "CMS_CRLFEOL",
- "CMS_STREAM",
- "CMS_NOCRL",
- "CMS_PARTIAL",
- "CMS_REUSE_DIGEST",
- "CMS_USE_KEYID",
- "CMS_DEBUG_DECRYPT",
- ]
-}
diff --git a/src/_cffi_src/openssl/conf.py b/src/_cffi_src/openssl/conf.py
index cab246f0..c89ae5ca 100644
--- a/src/_cffi_src/openssl/conf.py
+++ b/src/_cffi_src/openssl/conf.py
@@ -22,5 +22,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/crypto.py b/src/_cffi_src/openssl/crypto.py
index 641e95a8..c66bbe36 100644
--- a/src/_cffi_src/openssl/crypto.py
+++ b/src/_cffi_src/openssl/crypto.py
@@ -54,5 +54,3 @@ void CRYPTO_malloc_debug_init(void);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/dh.py b/src/_cffi_src/openssl/dh.py
index b66e7196..8df66f8b 100644
--- a/src/_cffi_src/openssl/dh.py
+++ b/src/_cffi_src/openssl/dh.py
@@ -48,5 +48,3 @@ int DH_generate_parameters_ex(DH *, int, int, BN_GENCB *);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/dsa.py b/src/_cffi_src/openssl/dsa.py
index 99a685df..89511e44 100644
--- a/src/_cffi_src/openssl/dsa.py
+++ b/src/_cffi_src/openssl/dsa.py
@@ -52,5 +52,3 @@ int DSA_generate_parameters_ex(DSA *, int, unsigned char *, int,
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/ec.py b/src/_cffi_src/openssl/ec.py
index 5ffbea6b..93ca2754 100644
--- a/src/_cffi_src/openssl/ec.py
+++ b/src/_cffi_src/openssl/ec.py
@@ -404,103 +404,3 @@ const char *(*EC_curve_nid2nist)(int) = NULL;
static const long Cryptography_HAS_EC_1_0_2 = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_EC": [
- "OPENSSL_EC_NAMED_CURVE",
- "EC_GROUP_new",
- "EC_GROUP_free",
- "EC_GROUP_clear_free",
- "EC_GROUP_new_curve_GFp",
- "EC_GROUP_new_by_curve_name",
- "EC_GROUP_set_curve_GFp",
- "EC_GROUP_get_curve_GFp",
- "EC_GROUP_method_of",
- "EC_GROUP_get0_generator",
- "EC_GROUP_get_curve_name",
- "EC_GROUP_get_degree",
- "EC_GROUP_set_asn1_flag",
- "EC_GROUP_set_point_conversion_form",
- "EC_KEY_new",
- "EC_KEY_free",
- "EC_get_builtin_curves",
- "EC_KEY_new_by_curve_name",
- "EC_KEY_copy",
- "EC_KEY_dup",
- "EC_KEY_up_ref",
- "EC_KEY_set_group",
- "EC_KEY_get0_private_key",
- "EC_KEY_set_private_key",
- "EC_KEY_set_public_key",
- "EC_KEY_get_enc_flags",
- "EC_KEY_set_enc_flags",
- "EC_KEY_set_conv_form",
- "EC_KEY_get_key_method_data",
- "EC_KEY_insert_key_method_data",
- "EC_KEY_set_asn1_flag",
- "EC_KEY_precompute_mult",
- "EC_KEY_generate_key",
- "EC_KEY_check_key",
- "EC_POINT_new",
- "EC_POINT_free",
- "EC_POINT_clear_free",
- "EC_POINT_copy",
- "EC_POINT_dup",
- "EC_POINT_method_of",
- "EC_POINT_set_to_infinity",
- "EC_POINT_set_Jprojective_coordinates_GFp",
- "EC_POINT_get_Jprojective_coordinates_GFp",
- "EC_POINT_set_affine_coordinates_GFp",
- "EC_POINT_get_affine_coordinates_GFp",
- "EC_POINT_set_compressed_coordinates_GFp",
- "EC_POINT_point2oct",
- "EC_POINT_oct2point",
- "EC_POINT_point2bn",
- "EC_POINT_bn2point",
- "EC_POINT_point2hex",
- "EC_POINT_hex2point",
- "EC_POINT_add",
- "EC_POINT_dbl",
- "EC_POINT_invert",
- "EC_POINT_is_at_infinity",
- "EC_POINT_is_on_curve",
- "EC_POINT_cmp",
- "EC_POINT_make_affine",
- "EC_POINTs_make_affine",
- "EC_POINTs_mul",
- "EC_POINT_mul",
- "EC_GROUP_precompute_mult",
- "EC_GROUP_have_precompute_mult",
- "EC_GFp_simple_method",
- "EC_GFp_mont_method",
- "EC_GFp_nist_method",
- "EC_METHOD_get_field_type",
- ],
-
- "Cryptography_HAS_EC_1_0_1": [
- "EC_KEY_get_flags",
- "EC_KEY_set_flags",
- "EC_KEY_clear_flags",
- "EC_KEY_set_public_key_affine_coordinates",
- ],
-
- "Cryptography_HAS_EC_NISTP_64_GCC_128": [
- "EC_GFp_nistp224_method",
- "EC_GFp_nistp256_method",
- "EC_GFp_nistp521_method",
- ],
-
- "Cryptography_HAS_EC2M": [
- "EC_GF2m_simple_method",
- "EC_POINT_set_affine_coordinates_GF2m",
- "EC_POINT_get_affine_coordinates_GF2m",
- "EC_POINT_set_compressed_coordinates_GF2m",
- "EC_GROUP_set_curve_GF2m",
- "EC_GROUP_get_curve_GF2m",
- "EC_GROUP_new_curve_GF2m",
- ],
-
- "Cryptography_HAS_EC_1_0_2": [
- "EC_curve_nid2nist",
- ],
-}
diff --git a/src/_cffi_src/openssl/ecdh.py b/src/_cffi_src/openssl/ecdh.py
index 6c7e010c..3116c3b6 100644
--- a/src/_cffi_src/openssl/ecdh.py
+++ b/src/_cffi_src/openssl/ecdh.py
@@ -48,12 +48,3 @@ void *(*ECDH_get_ex_data)(EC_KEY *, int) = NULL;
static const long Cryptography_HAS_ECDH = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_ECDH": [
- "ECDH_compute_key",
- "ECDH_get_ex_new_index",
- "ECDH_set_ex_data",
- "ECDH_get_ex_data",
- ],
-}
diff --git a/src/_cffi_src/openssl/ecdsa.py b/src/_cffi_src/openssl/ecdsa.py
index db21025c..f231864b 100644
--- a/src/_cffi_src/openssl/ecdsa.py
+++ b/src/_cffi_src/openssl/ecdsa.py
@@ -95,27 +95,3 @@ void* (*ECDSA_get_ex_data)(EC_KEY *, int) = NULL;
static const long Cryptography_HAS_ECDSA = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_ECDSA": [
- "ECDSA_SIG_new",
- "ECDSA_SIG_free",
- "i2d_ECDSA_SIG",
- "d2i_ECDSA_SIG",
- "ECDSA_do_sign",
- "ECDSA_do_sign_ex",
- "ECDSA_do_verify",
- "ECDSA_sign_setup",
- "ECDSA_sign",
- "ECDSA_sign_ex",
- "ECDSA_verify",
- "ECDSA_size",
- "ECDSA_OpenSSL",
- "ECDSA_set_default_method",
- "ECDSA_get_default_method",
- "ECDSA_set_method",
- "ECDSA_get_ex_new_index",
- "ECDSA_set_ex_data",
- "ECDSA_get_ex_data",
- ],
-}
diff --git a/src/_cffi_src/openssl/engine.py b/src/_cffi_src/openssl/engine.py
index 5079fd69..011f6692 100644
--- a/src/_cffi_src/openssl/engine.py
+++ b/src/_cffi_src/openssl/engine.py
@@ -167,9 +167,3 @@ void (*ENGINE_load_cryptodev)(void) = NULL;
static const long Cryptography_HAS_ENGINE_CRYPTODEV = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_ENGINE_CRYPTODEV": [
- "ENGINE_load_cryptodev"
- ]
-}
diff --git a/src/_cffi_src/openssl/err.py b/src/_cffi_src/openssl/err.py
index 73ce4e3c..6ec13775 100644
--- a/src/_cffi_src/openssl/err.py
+++ b/src/_cffi_src/openssl/err.py
@@ -335,29 +335,3 @@ static const long Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR = 0;
static const long RSA_R_PKCS_DECODING_ERROR = 0;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_REMOVE_THREAD_STATE": [
- "ERR_remove_thread_state"
- ],
- "Cryptography_HAS_098H_ERROR_CODES": [
- "ASN1_F_B64_READ_ASN1",
- "ASN1_F_B64_WRITE_ASN1",
- "ASN1_F_SMIME_READ_ASN1",
- "ASN1_F_SMIME_TEXT",
- "ASN1_R_NO_CONTENT_TYPE",
- "ASN1_R_NO_MULTIPART_BODY_FAILURE",
- "ASN1_R_NO_MULTIPART_BOUNDARY",
- ],
- "Cryptography_HAS_098C_CAMELLIA_CODES": [
- "EVP_F_CAMELLIA_INIT_KEY",
- "EVP_R_CAMELLIA_KEY_SETUP_FAILED"
- ],
- "Cryptography_HAS_EC_CODES": [
- "EC_R_UNKNOWN_GROUP",
- "EC_F_EC_GROUP_NEW_BY_CURVE_NAME"
- ],
- "Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR": [
- "RSA_R_PKCS_DECODING_ERROR"
- ]
-}
diff --git a/src/_cffi_src/openssl/evp.py b/src/_cffi_src/openssl/evp.py
index 93aa83de..6d17cb7c 100644
--- a/src/_cffi_src/openssl/evp.py
+++ b/src/_cffi_src/openssl/evp.py
@@ -231,35 +231,3 @@ EC_KEY *(*EVP_PKEY_get1_EC_KEY)(EVP_PKEY *) = NULL;
int (*EVP_PKEY_set1_EC_KEY)(EVP_PKEY *, EC_KEY *) = NULL;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_GCM": [
- "EVP_CTRL_GCM_GET_TAG",
- "EVP_CTRL_GCM_SET_TAG",
- "EVP_CTRL_GCM_SET_IVLEN",
- ],
- "Cryptography_HAS_PBKDF2_HMAC": [
- "PKCS5_PBKDF2_HMAC"
- ],
- "Cryptography_HAS_PKEY_CTX": [
- "EVP_PKEY_CTX_new",
- "EVP_PKEY_CTX_new_id",
- "EVP_PKEY_CTX_dup",
- "EVP_PKEY_CTX_free",
- "EVP_PKEY_sign",
- "EVP_PKEY_sign_init",
- "EVP_PKEY_verify",
- "EVP_PKEY_verify_init",
- "Cryptography_EVP_PKEY_encrypt",
- "EVP_PKEY_encrypt_init",
- "Cryptography_EVP_PKEY_decrypt",
- "EVP_PKEY_decrypt_init",
- "EVP_PKEY_CTX_set_signature_md",
- "EVP_PKEY_id",
- ],
- "Cryptography_HAS_EC": [
- "EVP_PKEY_assign_EC_KEY",
- "EVP_PKEY_get1_EC_KEY",
- "EVP_PKEY_set1_EC_KEY",
- ]
-}
diff --git a/src/_cffi_src/openssl/hmac.py b/src/_cffi_src/openssl/hmac.py
index 86bbdfc2..7178e573 100644
--- a/src/_cffi_src/openssl/hmac.py
+++ b/src/_cffi_src/openssl/hmac.py
@@ -81,5 +81,3 @@ int Cryptography_HMAC_CTX_copy(HMAC_CTX *dst_ctx, HMAC_CTX *src_ctx) {
#endif
}
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/nid.py b/src/_cffi_src/openssl/nid.py
index c2c0552b..94f21c67 100644
--- a/src/_cffi_src/openssl/nid.py
+++ b/src/_cffi_src/openssl/nid.py
@@ -237,12 +237,3 @@ static const int NID_ecdsa_with_SHA384 = 0;
static const int NID_ecdsa_with_SHA512 = 0;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_ECDSA_SHA2_NIDS": [
- "NID_ecdsa_with_SHA224",
- "NID_ecdsa_with_SHA256",
- "NID_ecdsa_with_SHA384",
- "NID_ecdsa_with_SHA512",
- ],
-}
diff --git a/src/_cffi_src/openssl/objects.py b/src/_cffi_src/openssl/objects.py
index 9c480b37..f2c1d5f3 100644
--- a/src/_cffi_src/openssl/objects.py
+++ b/src/_cffi_src/openssl/objects.py
@@ -32,5 +32,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/opensslv.py b/src/_cffi_src/openssl/opensslv.py
index e6c5f269..a4e88f07 100644
--- a/src/_cffi_src/openssl/opensslv.py
+++ b/src/_cffi_src/openssl/opensslv.py
@@ -23,5 +23,3 @@ MACROS = """
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/pem.py b/src/_cffi_src/openssl/pem.py
index 8ec3fefd..846e64e3 100644
--- a/src/_cffi_src/openssl/pem.py
+++ b/src/_cffi_src/openssl/pem.py
@@ -90,9 +90,3 @@ int (*PEM_write_bio_ECPrivateKey)(BIO *, EC_KEY *, const EVP_CIPHER *,
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_EC": [
- "PEM_write_bio_ECPrivateKey"
- ]
-}
diff --git a/src/_cffi_src/openssl/pkcs12.py b/src/_cffi_src/openssl/pkcs12.py
index fa7564ac..0bbd1e53 100644
--- a/src/_cffi_src/openssl/pkcs12.py
+++ b/src/_cffi_src/openssl/pkcs12.py
@@ -28,5 +28,3 @@ PKCS12 *PKCS12_create(char *, char *, EVP_PKEY *, X509 *,
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/pkcs7.py b/src/_cffi_src/openssl/pkcs7.py
index df82afef..5d6ee45f 100644
--- a/src/_cffi_src/openssl/pkcs7.py
+++ b/src/_cffi_src/openssl/pkcs7.py
@@ -54,5 +54,3 @@ int PKCS7_type_is_data(PKCS7 *);
"""
CUSTOMIZATIONS = ""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/rand.py b/src/_cffi_src/openssl/rand.py
index 6330482c..91e1a396 100644
--- a/src/_cffi_src/openssl/rand.py
+++ b/src/_cffi_src/openssl/rand.py
@@ -41,11 +41,3 @@ int (*RAND_query_egd_bytes)(const char *, unsigned char *, int) = NULL;
static const long Cryptography_HAS_EGD = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_EGD": [
- "RAND_egd",
- "RAND_egd_bytes",
- "RAND_query_egd_bytes",
- ]
-}
diff --git a/src/_cffi_src/openssl/rsa.py b/src/_cffi_src/openssl/rsa.py
index 8bac7895..16769504 100644
--- a/src/_cffi_src/openssl/rsa.py
+++ b/src/_cffi_src/openssl/rsa.py
@@ -84,16 +84,3 @@ static const long Cryptography_HAS_MGF1_MD = 0;
int (*EVP_PKEY_CTX_set_rsa_mgf1_md)(EVP_PKEY_CTX *, EVP_MD *) = NULL;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_PKEY_CTX": [
- "EVP_PKEY_CTX_set_rsa_padding",
- "EVP_PKEY_CTX_set_rsa_pss_saltlen",
- ],
- "Cryptography_HAS_PSS_PADDING": [
- "RSA_PKCS1_PSS_PADDING",
- ],
- "Cryptography_HAS_MGF1_MD": [
- "EVP_PKEY_CTX_set_rsa_mgf1_md",
- ],
-}
diff --git a/src/_cffi_src/openssl/ssl.py b/src/_cffi_src/openssl/ssl.py
index 5841ee2f..f15b9b32 100644
--- a/src/_cffi_src/openssl/ssl.py
+++ b/src/_cffi_src/openssl/ssl.py
@@ -624,114 +624,3 @@ static const long Cryptography_HAS_SSL_CTX_SET_CLIENT_CERT_ENGINE = 1;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_TLSv1_1": [
- "SSL_OP_NO_TLSv1_1",
- "TLSv1_1_method",
- "TLSv1_1_server_method",
- "TLSv1_1_client_method",
- ],
-
- "Cryptography_HAS_TLSv1_2": [
- "SSL_OP_NO_TLSv1_2",
- "TLSv1_2_method",
- "TLSv1_2_server_method",
- "TLSv1_2_client_method",
- ],
-
- "Cryptography_HAS_SSL2": [
- "SSLv2_method",
- "SSLv2_client_method",
- "SSLv2_server_method",
- ],
-
- "Cryptography_HAS_SSL3_METHOD": [
- "SSLv3_method",
- "SSLv3_client_method",
- "SSLv3_server_method",
- ],
-
- "Cryptography_HAS_TLSEXT_HOSTNAME": [
- "SSL_set_tlsext_host_name",
- "SSL_get_servername",
- "SSL_CTX_set_tlsext_servername_callback",
- ],
-
- "Cryptography_HAS_TLSEXT_STATUS_REQ_CB": [
- "SSL_CTX_set_tlsext_status_cb",
- "SSL_CTX_set_tlsext_status_arg"
- ],
-
- "Cryptography_HAS_STATUS_REQ_OCSP_RESP": [
- "SSL_set_tlsext_status_ocsp_resp",
- "SSL_get_tlsext_status_ocsp_resp",
- ],
-
- "Cryptography_HAS_TLSEXT_STATUS_REQ_TYPE": [
- "SSL_set_tlsext_status_type",
- ],
-
- "Cryptography_HAS_RELEASE_BUFFERS": [
- "SSL_MODE_RELEASE_BUFFERS",
- ],
-
- "Cryptography_HAS_OP_NO_COMPRESSION": [
- "SSL_OP_NO_COMPRESSION",
- ],
-
- "Cryptography_HAS_SSL_OP_MSIE_SSLV2_RSA_PADDING": [
- "SSL_OP_MSIE_SSLV2_RSA_PADDING",
- ],
-
- "Cryptography_HAS_EC": [
- "SSL_CTX_set_tmp_ecdh",
- ],
-
- "Cryptography_HAS_SSL_OP_NO_TICKET": [
- "SSL_OP_NO_TICKET",
- ],
-
- "Cryptography_HAS_SSL_SET_SSL_CTX": [
- "SSL_set_SSL_CTX",
- "TLSEXT_NAMETYPE_host_name",
- ],
-
- "Cryptography_HAS_NETBSD_D1_METH": [
- "DTLSv1_method",
- ],
-
- "Cryptography_HAS_NEXTPROTONEG": [
- "SSL_CTX_set_next_protos_advertised_cb",
- "SSL_CTX_set_next_proto_select_cb",
- "SSL_select_next_proto",
- "SSL_get0_next_proto_negotiated",
- ],
-
- "Cryptography_HAS_SECURE_RENEGOTIATION": [
- "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION",
- "SSL_OP_LEGACY_SERVER_CONNECT",
- "SSL_get_secure_renegotiation_support",
- ],
-
- "Cryptography_HAS_ALPN": [
- "SSL_CTX_set_alpn_protos",
- "SSL_set_alpn_protos",
- "SSL_CTX_set_alpn_select_cb",
- "SSL_get0_alpn_selected",
- ],
-
- "Cryptography_HAS_COMPRESSION": [
- "SSL_get_current_compression",
- "SSL_get_current_expansion",
- "SSL_COMP_get_name",
- ],
-
- "Cryptography_HAS_GET_SERVER_TMP_KEY": [
- "SSL_get_server_tmp_key",
- ],
-
- "Cryptography_HAS_SSL_CTX_SET_CLIENT_CERT_ENGINE": [
- "SSL_CTX_set_client_cert_engine",
- ],
-}
diff --git a/src/_cffi_src/openssl/x509.py b/src/_cffi_src/openssl/x509.py
index bdcc1719..468d74ea 100644
--- a/src/_cffi_src/openssl/x509.py
+++ b/src/_cffi_src/openssl/x509.py
@@ -348,18 +348,3 @@ EC_KEY *(*o2i_ECPublicKey)(EC_KEY **, const unsigned char **, long) = NULL;
int (*i2o_ECPublicKey)(EC_KEY *, unsigned char **) = NULL;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_EC": [
- "i2d_EC_PUBKEY",
- "d2i_EC_PUBKEY",
- "d2i_EC_PUBKEY_bio",
- "i2d_EC_PUBKEY_bio",
- "d2i_ECPrivateKey",
- "d2i_ECPrivateKey_bio",
- "i2d_ECPrivateKey",
- "i2d_ECPrivateKey_bio",
- "i2o_ECPublicKey",
- "o2i_ECPublicKey",
- ]
-}
diff --git a/src/_cffi_src/openssl/x509_vfy.py b/src/_cffi_src/openssl/x509_vfy.py
index 23ac8483..2f640b17 100644
--- a/src/_cffi_src/openssl/x509_vfy.py
+++ b/src/_cffi_src/openssl/x509_vfy.py
@@ -295,53 +295,3 @@ static const long Cryptography_HAS_X509_V_FLAG_CHECK_SS_SIGNATURE = 0;
static const long X509_V_FLAG_CHECK_SS_SIGNATURE = 0;
#endif
"""
-
-CONDITIONAL_NAMES = {
- "Cryptography_HAS_102_VERIFICATION_ERROR_CODES": [
- 'X509_V_ERR_SUITE_B_INVALID_VERSION',
- 'X509_V_ERR_SUITE_B_INVALID_ALGORITHM',
- 'X509_V_ERR_SUITE_B_INVALID_CURVE',
- 'X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM',
- 'X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED',
- 'X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256',
- 'X509_V_ERR_HOSTNAME_MISMATCH',
- 'X509_V_ERR_EMAIL_MISMATCH',
- 'X509_V_ERR_IP_ADDRESS_MISMATCH'
- ],
- "Cryptography_HAS_102_VERIFICATION_PARAMS": [
- "X509_V_FLAG_SUITEB_128_LOS_ONLY",
- "X509_V_FLAG_SUITEB_192_LOS",
- "X509_V_FLAG_SUITEB_128_LOS",
- "X509_VERIFY_PARAM_set1_host",
- "X509_VERIFY_PARAM_set1_email",
- "X509_VERIFY_PARAM_set1_ip",
- "X509_VERIFY_PARAM_set1_ip_asc",
- "X509_VERIFY_PARAM_set_hostflags",
- ],
- "Cryptography_HAS_X509_V_FLAG_TRUSTED_FIRST": [
- "X509_V_FLAG_TRUSTED_FIRST",
- ],
- "Cryptography_HAS_X509_V_FLAG_PARTIAL_CHAIN": [
- "X509_V_FLAG_PARTIAL_CHAIN",
- ],
- "Cryptography_HAS_100_VERIFICATION_ERROR_CODES": [
- 'X509_V_ERR_DIFFERENT_CRL_SCOPE',
- 'X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE',
- 'X509_V_ERR_UNNESTED_RESOURCE',
- 'X509_V_ERR_PERMITTED_VIOLATION',
- 'X509_V_ERR_EXCLUDED_VIOLATION',
- 'X509_V_ERR_SUBTREE_MINMAX',
- 'X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE',
- 'X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX',
- 'X509_V_ERR_UNSUPPORTED_NAME_SYNTAX',
- 'X509_V_ERR_CRL_PATH_VALIDATION_ERROR',
- ],
- "Cryptography_HAS_100_VERIFICATION_PARAMS": [
- "Cryptography_HAS_100_VERIFICATION_PARAMS",
- "X509_V_FLAG_EXTENDED_CRL_SUPPORT",
- "X509_V_FLAG_USE_DELTAS",
- ],
- "Cryptography_HAS_X509_V_FLAG_CHECK_SS_SIGNATURE": [
- "X509_V_FLAG_CHECK_SS_SIGNATURE",
- ]
-}
diff --git a/src/_cffi_src/openssl/x509name.py b/src/_cffi_src/openssl/x509name.py
index be5b3a75..2d87db4c 100644
--- a/src/_cffi_src/openssl/x509name.py
+++ b/src/_cffi_src/openssl/x509name.py
@@ -59,5 +59,3 @@ X509_NAME_ENTRY *sk_X509_NAME_ENTRY_value(
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/openssl/x509v3.py b/src/_cffi_src/openssl/x509v3.py
index fc3c6d46..f6a18903 100644
--- a/src/_cffi_src/openssl/x509v3.py
+++ b/src/_cffi_src/openssl/x509v3.py
@@ -288,5 +288,3 @@ int i2d_CRL_DIST_POINTS(Cryptography_STACK_OF_DIST_POINT *, unsigned char **);
CUSTOMIZATIONS = """
"""
-
-CONDITIONAL_NAMES = {}
diff --git a/src/_cffi_src/utils.py b/src/_cffi_src/utils.py
index 65f9f120..0b00353e 100644
--- a/src/_cffi_src/utils.py
+++ b/src/_cffi_src/utils.py
@@ -22,9 +22,6 @@ def build_ffi_for_binding(module_name, module_prefix, modules, pre_include="",
* ``CUSTOMIZATIONS``: A string containing arbitrary top-level C code, this
can be used to do things like test for a define and provide an
alternate implementation based on that.
- * ``CONDITIONAL_NAMES``: A dict mapping strings of condition names from the
- library to a list of names which will not be present without the
- condition.
"""
types = []
includes = []
diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py
new file mode 100644
index 00000000..adf00b02
--- /dev/null
+++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py
@@ -0,0 +1,414 @@
+# This file is dual licensed under the terms of the Apache License, Version
+# 2.0, and the BSD License. See the LICENSE file in the root of this repository
+# for complete details.
+
+from __future__ import absolute_import, division, print_function
+
+# This is a temporary copy of all the CONDITIONAL_NAMES from _cffi_src so
+# we can loop over them and delete them at runtime. It will be removed when
+# cffi supports #if in cdef
+
+CONDITIONAL_NAMES = {
+ "Cryptography_HAS_AES_WRAP": [
+ "AES_wrap_key",
+ "AES_unwrap_key",
+ ],
+ "Cryptography_HAS_CMAC": [
+ "CMAC_CTX_new",
+ "CMAC_Init",
+ "CMAC_Update",
+ "CMAC_Final",
+ "CMAC_CTX_copy",
+ "CMAC_CTX_free",
+ ],
+ "Cryptography_HAS_CMS": [
+ "BIO_new_CMS",
+ "i2d_CMS_bio_stream",
+ "PEM_write_bio_CMS_stream",
+ "CMS_final",
+ "CMS_sign",
+ "CMS_verify",
+ "CMS_encrypt",
+ "CMS_decrypt",
+ "CMS_add1_signer",
+ "CMS_TEXT",
+ "CMS_NOCERTS",
+ "CMS_NO_CONTENT_VERIFY",
+ "CMS_NO_ATTR_VERIFY",
+ "CMS_NOSIGS",
+ "CMS_NOINTERN",
+ "CMS_NO_SIGNER_CERT_VERIFY",
+ "CMS_NOVERIFY",
+ "CMS_DETACHED",
+ "CMS_BINARY",
+ "CMS_NOATTR",
+ "CMS_NOSMIMECAP",
+ "CMS_NOOLDMIMETYPE",
+ "CMS_CRLFEOL",
+ "CMS_STREAM",
+ "CMS_NOCRL",
+ "CMS_PARTIAL",
+ "CMS_REUSE_DIGEST",
+ "CMS_USE_KEYID",
+ "CMS_DEBUG_DECRYPT",
+ ],
+ "Cryptography_HAS_EC": [
+ "OPENSSL_EC_NAMED_CURVE",
+ "EC_GROUP_new",
+ "EC_GROUP_free",
+ "EC_GROUP_clear_free",
+ "EC_GROUP_new_curve_GFp",
+ "EC_GROUP_new_by_curve_name",
+ "EC_GROUP_set_curve_GFp",
+ "EC_GROUP_get_curve_GFp",
+ "EC_GROUP_method_of",
+ "EC_GROUP_get0_generator",
+ "EC_GROUP_get_curve_name",
+ "EC_GROUP_get_degree",
+ "EC_GROUP_set_asn1_flag",
+ "EC_GROUP_set_point_conversion_form",
+ "EC_KEY_new",
+ "EC_KEY_free",
+ "EC_get_builtin_curves",
+ "EC_KEY_new_by_curve_name",
+ "EC_KEY_copy",
+ "EC_KEY_dup",
+ "EC_KEY_up_ref",
+ "EC_KEY_set_group",
+ "EC_KEY_get0_private_key",
+ "EC_KEY_set_private_key",
+ "EC_KEY_set_public_key",
+ "EC_KEY_get_enc_flags",
+ "EC_KEY_set_enc_flags",
+ "EC_KEY_set_conv_form",
+ "EC_KEY_get_key_method_data",
+ "EC_KEY_insert_key_method_data",
+ "EC_KEY_set_asn1_flag",
+ "EC_KEY_precompute_mult",
+ "EC_KEY_generate_key",
+ "EC_KEY_check_key",
+ "EC_POINT_new",
+ "EC_POINT_free",
+ "EC_POINT_clear_free",
+ "EC_POINT_copy",
+ "EC_POINT_dup",
+ "EC_POINT_method_of",
+ "EC_POINT_set_to_infinity",
+ "EC_POINT_set_Jprojective_coordinates_GFp",
+ "EC_POINT_get_Jprojective_coordinates_GFp",
+ "EC_POINT_set_affine_coordinates_GFp",
+ "EC_POINT_get_affine_coordinates_GFp",
+ "EC_POINT_set_compressed_coordinates_GFp",
+ "EC_POINT_point2oct",
+ "EC_POINT_oct2point",
+ "EC_POINT_point2bn",
+ "EC_POINT_bn2point",
+ "EC_POINT_point2hex",
+ "EC_POINT_hex2point",
+ "EC_POINT_add",
+ "EC_POINT_dbl",
+ "EC_POINT_invert",
+ "EC_POINT_is_at_infinity",
+ "EC_POINT_is_on_curve",
+ "EC_POINT_cmp",
+ "EC_POINT_make_affine",
+ "EC_POINTs_make_affine",
+ "EC_POINTs_mul",
+ "EC_POINT_mul",
+ "EC_GROUP_precompute_mult",
+ "EC_GROUP_have_precompute_mult",
+ "EC_GFp_simple_method",
+ "EC_GFp_mont_method",
+ "EC_GFp_nist_method",
+ "EC_METHOD_get_field_type",
+ "EVP_PKEY_assign_EC_KEY",
+ "EVP_PKEY_get1_EC_KEY",
+ "EVP_PKEY_set1_EC_KEY",
+ "PEM_write_bio_ECPrivateKey",
+ "i2d_EC_PUBKEY",
+ "d2i_EC_PUBKEY",
+ "d2i_EC_PUBKEY_bio",
+ "i2d_EC_PUBKEY_bio",
+ "d2i_ECPrivateKey",
+ "d2i_ECPrivateKey_bio",
+ "i2d_ECPrivateKey",
+ "i2d_ECPrivateKey_bio",
+ "i2o_ECPublicKey",
+ "o2i_ECPublicKey",
+ "SSL_CTX_set_tmp_ecdh",
+ ],
+
+ "Cryptography_HAS_EC_1_0_1": [
+ "EC_KEY_get_flags",
+ "EC_KEY_set_flags",
+ "EC_KEY_clear_flags",
+ "EC_KEY_set_public_key_affine_coordinates",
+ ],
+
+ "Cryptography_HAS_EC_NISTP_64_GCC_128": [
+ "EC_GFp_nistp224_method",
+ "EC_GFp_nistp256_method",
+ "EC_GFp_nistp521_method",
+ ],
+
+ "Cryptography_HAS_EC2M": [
+ "EC_GF2m_simple_method",
+ "EC_POINT_set_affine_coordinates_GF2m",
+ "EC_POINT_get_affine_coordinates_GF2m",
+ "EC_POINT_set_compressed_coordinates_GF2m",
+ "EC_GROUP_set_curve_GF2m",
+ "EC_GROUP_get_curve_GF2m",
+ "EC_GROUP_new_curve_GF2m",
+ ],
+
+ "Cryptography_HAS_EC_1_0_2": [
+ "EC_curve_nid2nist",
+ ],
+ "Cryptography_HAS_ECDH": [
+ "ECDH_compute_key",
+ "ECDH_get_ex_new_index",
+ "ECDH_set_ex_data",
+ "ECDH_get_ex_data",
+ ],
+ "Cryptography_HAS_ECDSA": [
+ "ECDSA_SIG_new",
+ "ECDSA_SIG_free",
+ "i2d_ECDSA_SIG",
+ "d2i_ECDSA_SIG",
+ "ECDSA_do_sign",
+ "ECDSA_do_sign_ex",
+ "ECDSA_do_verify",
+ "ECDSA_sign_setup",
+ "ECDSA_sign",
+ "ECDSA_sign_ex",
+ "ECDSA_verify",
+ "ECDSA_size",
+ "ECDSA_OpenSSL",
+ "ECDSA_set_default_method",
+ "ECDSA_get_default_method",
+ "ECDSA_set_method",
+ "ECDSA_get_ex_new_index",
+ "ECDSA_set_ex_data",
+ "ECDSA_get_ex_data",
+ ],
+ "Cryptography_HAS_ENGINE_CRYPTODEV": [
+ "ENGINE_load_cryptodev"
+ ],
+ "Cryptography_HAS_REMOVE_THREAD_STATE": [
+ "ERR_remove_thread_state"
+ ],
+ "Cryptography_HAS_098H_ERROR_CODES": [
+ "ASN1_F_B64_READ_ASN1",
+ "ASN1_F_B64_WRITE_ASN1",
+ "ASN1_F_SMIME_READ_ASN1",
+ "ASN1_F_SMIME_TEXT",
+ "ASN1_R_NO_CONTENT_TYPE",
+ "ASN1_R_NO_MULTIPART_BODY_FAILURE",
+ "ASN1_R_NO_MULTIPART_BOUNDARY",
+ ],
+ "Cryptography_HAS_098C_CAMELLIA_CODES": [
+ "EVP_F_CAMELLIA_INIT_KEY",
+ "EVP_R_CAMELLIA_KEY_SETUP_FAILED"
+ ],
+ "Cryptography_HAS_EC_CODES": [
+ "EC_R_UNKNOWN_GROUP",
+ "EC_F_EC_GROUP_NEW_BY_CURVE_NAME"
+ ],
+ "Cryptography_HAS_RSA_R_PKCS_DECODING_ERROR": [
+ "RSA_R_PKCS_DECODING_ERROR"
+ ],
+ "Cryptography_HAS_GCM": [
+ "EVP_CTRL_GCM_GET_TAG",
+ "EVP_CTRL_GCM_SET_TAG",
+ "EVP_CTRL_GCM_SET_IVLEN",
+ ],
+ "Cryptography_HAS_PBKDF2_HMAC": [
+ "PKCS5_PBKDF2_HMAC"
+ ],
+ "Cryptography_HAS_PKEY_CTX": [
+ "EVP_PKEY_CTX_new",
+ "EVP_PKEY_CTX_new_id",
+ "EVP_PKEY_CTX_dup",
+ "EVP_PKEY_CTX_free",
+ "EVP_PKEY_sign",
+ "EVP_PKEY_sign_init",
+ "EVP_PKEY_verify",
+ "EVP_PKEY_verify_init",
+ "Cryptography_EVP_PKEY_encrypt",
+ "EVP_PKEY_encrypt_init",
+ "Cryptography_EVP_PKEY_decrypt",
+ "EVP_PKEY_decrypt_init",
+ "EVP_PKEY_CTX_set_signature_md",
+ "EVP_PKEY_id",
+ "EVP_PKEY_CTX_set_rsa_padding",
+ "EVP_PKEY_CTX_set_rsa_pss_saltlen",
+ ],
+ "Cryptography_HAS_ECDSA_SHA2_NIDS": [
+ "NID_ecdsa_with_SHA224",
+ "NID_ecdsa_with_SHA256",
+ "NID_ecdsa_with_SHA384",
+ "NID_ecdsa_with_SHA512",
+ ],
+ "Cryptography_HAS_EGD": [
+ "RAND_egd",
+ "RAND_egd_bytes",
+ "RAND_query_egd_bytes",
+ ],
+ "Cryptography_HAS_PSS_PADDING": [
+ "RSA_PKCS1_PSS_PADDING",
+ ],
+ "Cryptography_HAS_MGF1_MD": [
+ "EVP_PKEY_CTX_set_rsa_mgf1_md",
+ ],
+ "Cryptography_HAS_TLSv1_1": [
+ "SSL_OP_NO_TLSv1_1",
+ "TLSv1_1_method",
+ "TLSv1_1_server_method",
+ "TLSv1_1_client_method",
+ ],
+
+ "Cryptography_HAS_TLSv1_2": [
+ "SSL_OP_NO_TLSv1_2",
+ "TLSv1_2_method",
+ "TLSv1_2_server_method",
+ "TLSv1_2_client_method",
+ ],
+
+ "Cryptography_HAS_SSL2": [
+ "SSLv2_method",
+ "SSLv2_client_method",
+ "SSLv2_server_method",
+ ],
+
+ "Cryptography_HAS_SSL3_METHOD": [
+ "SSLv3_method",
+ "SSLv3_client_method",
+ "SSLv3_server_method",
+ ],
+
+ "Cryptography_HAS_TLSEXT_HOSTNAME": [
+ "SSL_set_tlsext_host_name",
+ "SSL_get_servername",
+ "SSL_CTX_set_tlsext_servername_callback",
+ ],
+
+ "Cryptography_HAS_TLSEXT_STATUS_REQ_CB": [
+ "SSL_CTX_set_tlsext_status_cb",
+ "SSL_CTX_set_tlsext_status_arg"
+ ],
+
+ "Cryptography_HAS_STATUS_REQ_OCSP_RESP": [
+ "SSL_set_tlsext_status_ocsp_resp",
+ "SSL_get_tlsext_status_ocsp_resp",
+ ],
+
+ "Cryptography_HAS_TLSEXT_STATUS_REQ_TYPE": [
+ "SSL_set_tlsext_status_type",
+ ],
+
+ "Cryptography_HAS_RELEASE_BUFFERS": [
+ "SSL_MODE_RELEASE_BUFFERS",
+ ],
+
+ "Cryptography_HAS_OP_NO_COMPRESSION": [
+ "SSL_OP_NO_COMPRESSION",
+ ],
+
+ "Cryptography_HAS_SSL_OP_MSIE_SSLV2_RSA_PADDING": [
+ "SSL_OP_MSIE_SSLV2_RSA_PADDING",
+ ],
+
+ "Cryptography_HAS_SSL_OP_NO_TICKET": [
+ "SSL_OP_NO_TICKET",
+ ],
+
+ "Cryptography_HAS_SSL_SET_SSL_CTX": [
+ "SSL_set_SSL_CTX",
+ "TLSEXT_NAMETYPE_host_name",
+ ],
+
+ "Cryptography_HAS_NETBSD_D1_METH": [
+ "DTLSv1_method",
+ ],
+
+ "Cryptography_HAS_NEXTPROTONEG": [
+ "SSL_CTX_set_next_protos_advertised_cb",
+ "SSL_CTX_set_next_proto_select_cb",
+ "SSL_select_next_proto",
+ "SSL_get0_next_proto_negotiated",
+ ],
+
+ "Cryptography_HAS_SECURE_RENEGOTIATION": [
+ "SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION",
+ "SSL_OP_LEGACY_SERVER_CONNECT",
+ "SSL_get_secure_renegotiation_support",
+ ],
+
+ "Cryptography_HAS_ALPN": [
+ "SSL_CTX_set_alpn_protos",
+ "SSL_set_alpn_protos",
+ "SSL_CTX_set_alpn_select_cb",
+ "SSL_get0_alpn_selected",
+ ],
+
+ "Cryptography_HAS_COMPRESSION": [
+ "SSL_get_current_compression",
+ "SSL_get_current_expansion",
+ "SSL_COMP_get_name",
+ ],
+
+ "Cryptography_HAS_GET_SERVER_TMP_KEY": [
+ "SSL_get_server_tmp_key",
+ ],
+
+ "Cryptography_HAS_SSL_CTX_SET_CLIENT_CERT_ENGINE": [
+ "SSL_CTX_set_client_cert_engine",
+ ],
+ "Cryptography_HAS_102_VERIFICATION_ERROR_CODES": [
+ 'X509_V_ERR_SUITE_B_INVALID_VERSION',
+ 'X509_V_ERR_SUITE_B_INVALID_ALGORITHM',
+ 'X509_V_ERR_SUITE_B_INVALID_CURVE',
+ 'X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM',
+ 'X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED',
+ 'X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256',
+ 'X509_V_ERR_HOSTNAME_MISMATCH',
+ 'X509_V_ERR_EMAIL_MISMATCH',
+ 'X509_V_ERR_IP_ADDRESS_MISMATCH'
+ ],
+ "Cryptography_HAS_102_VERIFICATION_PARAMS": [
+ "X509_V_FLAG_SUITEB_128_LOS_ONLY",
+ "X509_V_FLAG_SUITEB_192_LOS",
+ "X509_V_FLAG_SUITEB_128_LOS",
+ "X509_VERIFY_PARAM_set1_host",
+ "X509_VERIFY_PARAM_set1_email",
+ "X509_VERIFY_PARAM_set1_ip",
+ "X509_VERIFY_PARAM_set1_ip_asc",
+ "X509_VERIFY_PARAM_set_hostflags",
+ ],
+ "Cryptography_HAS_X509_V_FLAG_TRUSTED_FIRST": [
+ "X509_V_FLAG_TRUSTED_FIRST",
+ ],
+ "Cryptography_HAS_X509_V_FLAG_PARTIAL_CHAIN": [
+ "X509_V_FLAG_PARTIAL_CHAIN",
+ ],
+ "Cryptography_HAS_100_VERIFICATION_ERROR_CODES": [
+ 'X509_V_ERR_DIFFERENT_CRL_SCOPE',
+ 'X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE',
+ 'X509_V_ERR_UNNESTED_RESOURCE',
+ 'X509_V_ERR_PERMITTED_VIOLATION',
+ 'X509_V_ERR_EXCLUDED_VIOLATION',
+ 'X509_V_ERR_SUBTREE_MINMAX',
+ 'X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE',
+ 'X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX',
+ 'X509_V_ERR_UNSUPPORTED_NAME_SYNTAX',
+ 'X509_V_ERR_CRL_PATH_VALIDATION_ERROR',
+ ],
+ "Cryptography_HAS_100_VERIFICATION_PARAMS": [
+ "Cryptography_HAS_100_VERIFICATION_PARAMS",
+ "X509_V_FLAG_EXTENDED_CRL_SUPPORT",
+ "X509_V_FLAG_USE_DELTAS",
+ ],
+ "Cryptography_HAS_X509_V_FLAG_CHECK_SS_SIGNATURE": [
+ "X509_V_FLAG_CHECK_SS_SIGNATURE",
+ ]
+}
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
index 86fac5ce..e18d89c5 100644
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -6,8 +6,10 @@ from __future__ import absolute_import, division, print_function
import os
import threading
+import types
from cryptography.hazmat.bindings._openssl import ffi, lib
+from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES
@ffi.callback("int (*)(unsigned char *, int)", error=-1)
@@ -23,11 +25,25 @@ def _osrandom_rand_status():
return 1
+def build_conditional_library(lib, conditional_names):
+ conditional_lib = types.ModuleType("lib")
+ excluded_names = set()
+ for condition, names in conditional_names.items():
+ if not getattr(lib, condition):
+ excluded_names |= set(names)
+
+ for attr in dir(lib):
+ if attr not in excluded_names:
+ setattr(conditional_lib, attr, getattr(lib, attr))
+
+ return conditional_lib
+
+
class Binding(object):
"""
OpenSSL API wrapper.
"""
- lib = lib
+ lib = None
ffi = ffi
_lib_loaded = False
_locks = None
@@ -74,6 +90,7 @@ class Binding(object):
def _ensure_ffi_initialized(cls):
with cls._init_lock:
if not cls._lib_loaded:
+ cls.lib = build_conditional_library(lib, CONDITIONAL_NAMES)
cls._lib_loaded = True
cls._register_osrandom_engine()