Skip to content

Commit

Permalink
patches pyca#5379
Browse files Browse the repository at this point in the history
re-adds setters for tls-bindings
  • Loading branch information
th3b0x committed Dec 2, 2020
1 parent 1be144a commit 7d60786
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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,
}

0 comments on commit 7d60786

Please sign in to comment.