SSL_SESSION_...OCOL_VERSION(3ossl)
π SSL_SESSION_get_protocol_version, SSL_SESSION_set_protocol_version π
okay bestie, welcome to the 3ossl manual page for the OpenSSL functions SSL_SESSION_get_protocol_version and SSL_SESSION_set_protocol_version. yes that is a whole mouthful, no i will not be shortening it. it's giving "get and set the session protocol version" and honestly? iconic. π
β¨ NAME β¨
SSL_SESSION_get_protocol_version, SSL_SESSION_set_protocol_version β bestie, these two are your get-and-set girlies for the session protocol version. one reads it, one writes it. that's the whole vibe. π
π SYNOPSIS π
so first things first, you gotta pull in the header, no cap:
#include <openssl/ssl.h>
int SSL_SESSION_get_protocol_version(const SSL_SESSION *s);
int SSL_SESSION_set_protocol_version(SSL_SESSION *s, int version);
look at them. two little functions. one of them is const and one of them is not, and if you don't know why that matters yet, we'll get there. π¦
πΈ DESCRIPTION πΈ
SSL_SESSION_get_protocol_version() returns the protocol version number used by session s. that's it. that's the function. it tells you which protocol version that session is on, and it does it without any drama. main character energy fr fr. β¨
SSL_SESSION_set_protocol_version() sets the protocol version associated with the SSL_SESSION object s to the value version. and bestie, that version value should be a version constant, like TLS1_3_VERSION etc. don't just be out here making up numbers, okay? π
π‘ the docs literally say 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). so like, that's a real thing you can do. iykyk. π«Ά
π RETURN VALUES π
SSL_SESSION_get_protocol_version() returns a number indicating the protocol version used for the session. and that number matches the constants, e.g. TLS1_VERSION, TLS1_2_VERSION or TLS1_3_VERSION. so it's not giving mysterious vibes, it's giving "here's your constant, bestie." β
π lowkey important, highkey a footgun: the SSL_SESSION_get_protocol_version() function does not perform a null check on the provided session s pointer. so if you hand it a null pointer, that's on you. no safety net. no vibe check. protect yourself. π
SSL_SESSION_set_protocol_version() returns 1 on success or 0 on failure. classic. we love a binary. π
π§ SEE ALSO π§
go read those too, bestie, they're part of the lore. πβ¨
π HISTORY π
- The
SSL_SESSION_get_protocol_version()function was added in OpenSSL1.1.0. - The
SSL_SESSION_set_protocol_version()function was added in OpenSSL1.1.1.
so the getter is the older sibling and the setter came along a version later. siblings, your honor. π«Ά
π 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>.
like, read the license, bestie. it's short. it's giving legally binding but make it cute. π
okay that's the whole page!! go forth and version your sessions responsibly, you absolute icon. π
this has been 3.5.9 energy, dated 2026-09-29, brought to you by the 3ossl girlies. mwah. πβ¨π
π¦ 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