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>
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;
}
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;
}