SSL_CTX_SET_SSL_VERSION(3)
β¨ SSL_CTX_SET_SSL_VERSION(3) β¨
okay bestie, this is a page from the Library Functions Manual for libssl, and it's genuinely iconic. it lives in libcrypto too (they're besties), and before you do literally anything you're gonna #include <openssl/ssl.h>. no cap. π
πΈ NAME πΈ
SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_CTX_get_ssl_method, SSL_get_ssl_method β choose a new TLS/SSL method π¦
π SYNOPSIS π
library βlibsslβ libcrypto #include <openssl/ssl.h>
int
SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
int
SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
const SSL_METHOD *
SSL_CTX_get_ssl_method(SSL_CTX *ctx);
const SSL_METHOD *
SSL_get_ssl_method(SSL *ssl);
π DESCRIPTION π
so. four functions. two of them set stuff, two of them get stuff. it's giving duality. β
SSL_CTX_set_ssl_version() sets a new default TLS/SSL method for SSL objects that are newly created from this ctx. and here's the tea: SSL objects you already made with SSL_new(3) are not affected β except when SSL_clear(3) is called. so don't @ them, they're not listening π
SSL_set_ssl_method() sets a new TLS/SSL method for one particular SSL object, s. it may be reset when SSL_clear(3) is called. yep, may. lowkey chaotic of it but okay.
SSL_CTX_get_ssl_method() and SSL_get_ssl_method() return a function pointer to the TLS/SSL method set in ctx and ssl, respectively. they're the read-only girlies. π
the available method choices are described in SSL_CTX_new(3) β go check that one out, it's a whole mood.
and the β¨plot twistβ¨: when SSL_clear(3) is called and no session is connected to an SSL object, the method of that SSL object gets reset to the method currently set in the corresponding SSL_CTX object. so it snaps back to the context's vibe. main character energy fr fr. π
π₯ RETURN VALUES π₯
the following return values can occur for SSL_CTX_set_ssl_version() and SSL_set_ssl_method():
0β the new choice failed. check the error stack to find out the reason π (the error stack is literally where the receipts are)1β the operation succeeded π slay
π«Ά SEE ALSO π«Ά
ssl(3), SSL_clear(3), SSL_CTX_new(3), SSL_new(3), SSL_set_connect_state(3)
all of these are worth a read, iykyk π
π HISTORY π
SSL_CTX_set_ssl_version(), SSL_set_ssl_method(), and SSL_get_ssl_method() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4. absolute elders. respect. π§
SSL_CTX_get_ssl_method() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 7.0. the baby of the group, and honestly? ate. π
okay that's the whole page bestie, go forth and pick your methods wisely ππ
β written from the Debian edition, dated June 8, 2025, and it's literally titled SSL_CTX_SET_SSL_VERSION(3) in case you forgot what you were reading. mwah. π
β¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2000, 2001, 2005 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms