summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-07-21 19:11:07 (GMT)
committerGitHub <noreply@github.com>2022-07-21 19:11:07 (GMT)
commit120f226889b3b89e0cb804baccd6e9e3af76a39a (patch)
tree136b1b12572663dbbf6f745abd67f7343dc84dd8 /Modules
parente693f84cf79d81a10c9c63ab46cdf0fe2ebe9c10 (diff)
downloadcpython-120f226889b3b89e0cb804baccd6e9e3af76a39a.zip
cpython-120f226889b3b89e0cb804baccd6e9e3af76a39a.tar.gz
cpython-120f226889b3b89e0cb804baccd6e9e3af76a39a.tar.bz2
gh-95095: Use SSL_CTX_get_max_proto_version instead of SSL_CTX_ctrl (GH-95096)
The wrapper macros are more readable and match the form recommended in the OpenSSL documentation. They also slightly less error-prone, as the mapping of arguments to SSL_CTX_ctrl is not always clear. (Though in this case it's straightforward.) https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_get_max_proto_version.html (cherry picked from commit 936f71e5d4f50f2238b0320d44f7fb5f88e39809) Co-authored-by: David Benjamin <davidben@davidben.net>
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 6d5c019..6071202 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3518,7 +3518,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
static PyObject *
get_minimum_version(PySSLContext *self, void *c)
{
- int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL);
+ int v = SSL_CTX_get_min_proto_version(self->ctx);
if (v == 0) {
v = PY_PROTO_MINIMUM_SUPPORTED;
}
@@ -3534,7 +3534,7 @@ set_minimum_version(PySSLContext *self, PyObject *arg, void *c)
static PyObject *
get_maximum_version(PySSLContext *self, void *c)
{
- int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL);
+ int v = SSL_CTX_get_max_proto_version(self->ctx);
if (v == 0) {
v = PY_PROTO_MAXIMUM_SUPPORTED;
}