Skip to content

Commit 79b17ca

Browse files
committed
Check for BoringSSL in the EVP bindings
1 parent e74b5f9 commit 79b17ca

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
@@ -288,6 +288,12 @@ def cryptography_has_bn_flags():
288288
]
289289

290290

291+
def cryptography_has_evp_pkey_dh():
292+
return [
293+
"EVP_PKEY_set1_DH",
294+
]
295+
296+
291297
# This is a mapping of
292298
# {condition: function-returning-names-dependent-on-that-condition} so we can
293299
# loop over them and delete unsupported names at runtime. It will be removed
@@ -343,4 +349,5 @@ def cryptography_has_bn_flags():
343349
"Cryptography_HAS_SSL_COOKIE": cryptography_has_ssl_cookie,
344350
"Cryptography_HAS_PKCS7_FUNCS": cryptography_has_pkcs7_funcs,
345351
"Cryptography_HAS_BN_FLAGS": cryptography_has_bn_flags,
352+
"Cryptography_HAS_EVP_PKEY_DH": cryptography_has_evp_pkey_dh,
346353
}

0 commit comments

Comments
 (0)