SSL_CTX_SET_...PROTO_VERSION(3ossl)
π SSL_CTX_SET_...PROTO_VERSION π
okay bestie, welcome to the 3ossl manual page, and trust, this one is a whole vibe. it's giving "stop turning off TLS versions by hand, i'm begging you" β¨
πΈ NAME πΈ
SSL_CTX_set_min_proto_version, SSL_CTX_set_max_proto_version, SSL_CTX_get_min_proto_version, SSL_CTX_get_max_proto_version, SSL_set_min_proto_version, SSL_set_max_proto_version, SSL_get_min_proto_version, SSL_get_max_proto_version β get and set the minimum and maximum supported protocol version, no cap π
π¦ SYNOPSIS π¦
#include <openssl/ssl.h>
int SSL_CTX_set_min_proto_version(SSL_CTX *ctx, int version);
int SSL_CTX_set_max_proto_version(SSL_CTX *ctx, int version);
int SSL_CTX_get_min_proto_version(SSL_CTX *ctx);
int SSL_CTX_get_max_proto_version(SSL_CTX *ctx);
int SSL_set_min_proto_version(SSL *ssl, int version);
int SSL_set_max_proto_version(SSL *ssl, int version);
int SSL_get_min_proto_version(SSL *ssl);
int SSL_get_max_proto_version(SSL *ssl);
like look at that symmetry. the ctx girlies and the ssl girlies, living their parallel lives π
β¨ DESCRIPTION β¨
so these functions get or set the minimum and maximum supported protocol versions for the ctx or the ssl. that's the whole job, and they do it gorgeously.
they work in combination with the options you set via SSL_CTX_set_options(3), which also make it possible to disable specific protocol versions. BUT β and this is the main character plot twist β use these functions instead of disabling specific protocol versions. that's not a suggestion, that's the instruction. periodt. π
setting the minimum or maximum version to 0 (that's the default, btw) will enable protocol versions down to the lowest version, or up to the highest version supported by the library, respectively. and the supported versions might be controlled by system configuration, so it's not always just about you, bestie.
the getters return 0 in case ctx or ssl have been configured to automatically use the lowest or highest version supported by the library. so if you get a 0 back, that's not an error, that's just her being flexible π§
currently supported versions are:
SSL3_VERSIONTLS1_VERSIONTLS1_1_VERSIONTLS1_2_VERSIONTLS1_3_VERSION
for TLS β and for DTLS you've got:
DTLS1_VERSIONDTLS1_2_VERSION
heads up bestie: in the current version of OpenSSL only QUICv1 is supported in conjunction with TLSv1.3. calling these functions on a QUIC object has no effect. like, nothing. she's not listening. π
π RETURN VALUES π
- the setter functions return
1on success and0on failure. iconic behaviour, honestly. - the getter functions return the configured version, or
0for auto-configuration of lowest or highest protocol, respectively.
π NOTES π
all these functions are implemented using macros. so if you were planning to take their address or something weird β nope, they're macros, iykyk π
π SEE ALSO π
ssl(7), SSL_CTX_set_options(3), SSL_CONF_cmd(3)
go read them, they're all part of the same friend group π
π HISTORY π
- the setter functions were added in OpenSSL 1.1.0
- the getter functions were added in OpenSSL 1.1.1
glow-up timeline fr fr β
π«Ά COPYRIGHT π«Ά
Copyright 2016-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie!! this was OpenSSL 3.5.9, dated 2026-09-2 β mwah, go set your proto versions responsibly π πβ¨
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms