8000 gh-95095: Use SSL_CTX_get_max_proto_version instead of SSL_CTX_ctrl (… · python/cpython@936f71e · GitHub
[go: up one dir, main page]

Skip to content

Commit 936f71e

Browse files
authored
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
1 parent a6daaf2 commit 936f71e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/_ssl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,7 +3515,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
35153515
static PyObject *
35163516
get_minimum_version(PySSLContext *self, void *c)
35173517
{
3518-
int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL);
3518+
int v = SSL_CTX_get_min_proto_version(self->ctx);
35193519
if (v == 0) {
35203520
v = PY_PROTO_MINIMUM_SUPPORTED;
35213521
}
@@ -3531,7 +3531,7 @@ set_minimum_version(PySSLContext *self, PyObject *arg, void *c)
35313531
static PyObject *
35323532
get_maximum_version(PySSLContext *self, void *c)
35333533
{
3534-
int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL);
3534+
int v = SSL_CTX_get_max_proto_version(self->ctx);
35353535
if (v == 0) {
35363536
v = PY_PROTO_MAXIMUM_SUPPORTED;
35373537
}

0 commit comments

Comments
 (0)
0