Skip to content

Commit cace4bc

Browse files
committed
Check for BoringSSL in the EVP bindings
1 parent 042754c commit cace4bc

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/_cffi_src/openssl/evp.py

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
static const long Cryptography_HAS_RAW_KEY;
3838
static const long Cryptography_HAS_EVP_DIGESTFINAL_XOF;
3939
static const long Cryptography_HAS_300_FIPS;
40+
static const long Cryptography_HAS_EVP_PKEY_DH;
4041
"""
4142

4243
FUNCTIONS = """
@@ -280,4 +281,11 @@
280281
int (*EVP_default_properties_is_fips_enabled)(OSSL_LIB_CTX *) = NULL;
281282
int (*EVP_default_properties_enable_fips)(OSSL_LIB_CTX *, int) = NULL;
282283
#endif
284+
285+
#if CRYPTOGRAPHY_IS_BORINGSSL
286+
static const long Cryptography_HAS_EVP_PKEY_DH = 0;
287+
int (*EVP_PKEY_set1_DH)(EVP_PKEY *, DH *) = NULL;
288+
#else
289+
static const long Cryptography_HAS_EVP_PKEY_DH = 1;
290+
#endif
283291
"""

src/cryptography/hazmat/bindings/openssl/_conditional.py

+7
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,12 @@ def cryptography_has_bn_flags():
293293
"BN_prime_checks_for_size",
294294
]
295295

296+
def cryptography_has_evp_pkey_dh():
297+
return [
298+
"EVP_PKEY_set1_DH",
299+
]
300+
301+
296302
# This is a mapping of
297303
# {condition: function-returning-names-dependent-on-that-condition} so we can
298304
# loop over them and delete unsupported names at runtime. It will be removed
@@ -349,4 +355,5 @@ def cryptography_has_bn_flags():
349355
"Cryptography_HAS_SSL_COOKIE": cryptography_has_ssl_cookie,
350356
"Cryptography_HAS_PKCS7_FUNCS": cryptography_has_pkcs7_funcs,
351357
"Cryptography_HAS_BN_FLAGS": cryptography_has_bn_flags,
358+
"Cryptography_HAS_EVP_PKEY_DH": cryptography_has_evp_pkey_dh,
352359
}

0 commit comments

Comments
 (0)