SSL_SESSION_...OCOL_VERSION(3ossl)
π SSL_SESSION_get_protocol_version, SSL_SESSION_set_protocol_version β get and set the session protocol version π
okay bestie, welcome to the 3ossl corner of the manual, this one's short and sweet and honestly kinda iconic β¨
πΈ SYNOPSIS πΈ
like, include the header first obviously:
#include <openssl/ssl.h>
then the two function girlies:
int SSL_SESSION_get_protocol_version(const SSL_SESSION *s);
int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version);
π¦ DESCRIPTION π¦
so SSL_SESSION_get_protocol_version() returns the protocol version number that session s is using. that's it. that's the whole vibe check. π
and SSL_SESSION_set_protocol_version() sets the protocol version associated with the SSL_SESSION object s to the value version. lowkey important detail: this value should be a version constant such as TLS1_3_VERSION etc. β¨ for example, this could be used to set up a session based PSK (peep SSL_CTX_set_psk_use_session_callback(3) if you wanna go deeper π).
π RETURN VALUES π
SSL_SESSION_get_protocol_version() returns a number indicating the protocol version used for the session; this number matches the constants e.g. TLS1_VERSION, TLS1_2_VERSION or TLS1_3_VERSION. so like, very on-brand, no surprises. π
β οΈ okay heads up bestie,SSL_SESSION_get_protocol_version()does not perform a null check on the provided sessionspointer. so don't be handing it a null and then acting shocked, fr fr. π
SSL_SESSION_set_protocol_version() returns 1 on success or 0 on failure. slay or flop, binary queen. π
π SEE ALSO π
π§ HISTORY π§
SSL_SESSION_get_protocol_version()was added in OpenSSL1.1.0βSSL_SESSION_set_protocol_version()was added in OpenSSL1.1.1πΈ
π COPYRIGHT π
Copyright 2001-2018 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, no cap ππ β brought to you by OpenSSL 3.5.6, dated 2026-04-07, mwah πβ¨
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms