Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing tls bindings for new OpenSSL APIs #5599

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/_cffi_src/openssl/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
static const long Cryptography_HAS_VERIFIED_CHAIN;
static const long Cryptography_HAS_KEYLOG;
static const long Cryptography_HAS_GET_PROTO_VERSION;
static const long Cryptography_HAS_SET_PROTO_VERSION;

/* Internally invented symbol to tell us if SSL_MODE_RELEASE_BUFFERS is
* supported
Expand Down Expand Up @@ -696,4 +697,15 @@
#else
static const long Cryptography_HAS_GET_PROTO_VERSION = 1;
#endif

#if CRYPTOGRAPHY_OPENSSL_LESS_THAN_110 && !CRYPTOGRAPHY_IS_LIBRESSL
static const long Cryptography_HAS_SET_PROTO_VERSION = 0;

long (*SSL_CTX_set_min_proto_version)(SSL_CTX *) = NULL;
long (*SSL_CTX_set_max_proto_version)(SSL_CTX *) = NULL;
long (*SSL_set_min_proto_version)(SSL *) = NULL;
long (*SSL_set_max_proto_version)(SSL *) = NULL;
#else
static const long Cryptography_HAS_SET_PROTO_VERSION = 1;
#endif
"""
10 changes: 10 additions & 0 deletions src/cryptography/hazmat/bindings/openssl/_conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ def cryptography_has_get_proto_version():
]


def cryptography_has_set_proto_version():
return [
"SSL_CTX_set_min_proto_version",
"SSL_CTX_set_max_proto_version",
"SSL_set_min_proto_version",
"SSL_set_max_proto_version",
]


# This is a mapping of
# {condition: function-returning-names-dependent-on-that-condition} so we can
# loop over them and delete unsupported names at runtime. It will be removed
Expand Down Expand Up @@ -319,4 +328,5 @@ def cryptography_has_get_proto_version():
"Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain,
"Cryptography_HAS_SRTP": cryptography_has_srtp,
"Cryptography_HAS_GET_PROTO_VERSION": cryptography_has_get_proto_version,
"Cryptography_HAS_SET_PROTO_VERSION": cryptography_has_set_proto_version,
}