SSL_CTX_SET_SSL_VERSION(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… SSL_CTX_SET_SSL_VERSION(3ossl) β€” the OpenSSL glow-up page

okay bestie, welcome to the OpenSSL 3ossl manual, this one's all about choosing a new TLS/SSL method and honestly it's giving "small functions, big feelings." Let's get into it πŸŽ€


✨ NAME ✨

SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method β€” choose a new TLS/SSL method πŸ¦‹

✨ SYNOPSIS ✨

#include <openssl/ssl.h>

int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);

int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
const SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);

✨ DESCRIPTION ✨

so SSL_CTX_set_ssl_version() sets a brand new default TLS/SSL method for all the SSL objects that get newly created from this ctx. πŸ’– Most of the configuration attached to the SSL_CTX object is retained, BUT β€” and this is the plot twist β€” the configured TLS ciphers get reset to the default values. gone. not like us. 😭

SSL objects that were already created from this SSL_CTX with SSL_new(3) are not affected, except when SSL_clear(3) is being called, as described below. iykyk.

SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the SSL_CTX. simple, iconic, no notes.

SSL_set_ssl_method() sets a new TLS/SSL method for a particular ssl object. it may be reset when SSL_clear() is called. πŸ™ˆ

SSL_get_ssl_method() returns a pointer to the TLS/SSL method set in ssl. slay.

🌸 NOTES 🌸

the available method choices are described in SSL_CTX_new(3). go look, bestie, that's where the menu is πŸ“‹

when SSL_clear(3) is called and no session is connected to an SSL object, the method of the SSL object gets reset to the method currently set in the corresponding SSL_CTX object. ✨

⚠️ okay so SSL_CTX_set_version() has unusual semantics and no clear use case β€” genuinely it would usually be preferable to create a new SSL_CTX object than to try to reuse an existing one in this fashion. its usage is considered deprecated. πŸ’€ like, don't. just make a new one.

SSL_set_ssl_method() cannot be used to change a non-QUIC SSL object to a QUIC SSL object or vice versa, or change a QUIC SSL object from one QUIC method to another. that's a hard no, not me trying, it's just not happening πŸ™…β€β™€οΈ

🫢 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. 😬 go read the receipts.
  • 1 β€” the operation succeeded. we love a win πŸ’…

SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL pointers. fr fr, never NULL. 🌈

πŸ¦‹ SEE ALSO πŸ¦‹

SSL_CTX_new(3), SSL_new(3), SSL_clear(3), ssl(7), SSL_set_connect_state(3)

πŸ‘‘ HISTORY πŸ‘‘

SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0. it's giving "we've moved on." ⭐

Copyright 2000-2023 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!! πŸŽ€ written by the OpenSSL girlies, version 3.5.6, dated 2026-04-07 β€” mwah, go forth and pick your methods wisely πŸ’–βœ¨πŸ«Ά

πŸ“¦ where this page comes from