Skip to content

Commit 8fd2d36

Browse files
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 936f71e) Co-authored-by: David Benjamin <davidben@davidben.net>
1 parent b60c3d2 commit 8fd2d36

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
@@ -3518,7 +3518,7 @@ set_min_max_proto_version(PySSLContext *self, PyObject *arg, int what)
35183518
static PyObject *
35193519
get_minimum_version(PySSLContext *self, void *c)
35203520
{
3521-
int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MIN_PROTO_VERSION, 0, NULL);
3521+
int v = SSL_CTX_get_min_proto_version(self->ctx);
35223522
if (v == 0) {
35233523
v = PY_PROTO_MINIMUM_SUPPORTED;
35243524
}
@@ -3534,7 +3534,7 @@ set_minimum_version(PySSLContext *self, PyObject *arg, void *c)
35343534
static PyObject *
35353535
get_maximum_version(PySSLContext *self, void *c)
35363536
{
3537-
int v = SSL_CTX_ctrl(self->ctx, SSL_CTRL_GET_MAX_PROTO_VERSION, 0, NULL);
3537+
int v = SSL_CTX_get_max_proto_version(self->ctx);
35383538
if (v == 0) {
35393539
v = PY_PROTO_MAXIMUM_SUPPORTED;
35403540
}

0 commit comments

Comments
 (0)