SSL_SESSION_NEW(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– SSL_SESSION_NEW(3) πŸ’–

okay bestie, so this one is from the Library Functions Manual and it's literally all about making shiny new SSL_SESSION objects. it's giving "I just created a whole TLS session, no big deal" energy. you're gonna slay this, i promise 🫢


✨ NAME ✨

SSL_SESSION_new, SSL_SESSION_dup β€” construct a new SSL_SESSION object


🌸 SYNOPSIS 🌸

library β€œlibssl” libcrypto

#include <openssl/ssl.h>
SSL_SESSION *
SSL_SESSION_new(void);

SSL_SESSION *
SSL_SESSION_dup(const SSL_SESSION *src);

πŸ’… DESCRIPTION πŸ’…

SSL_SESSION_new() allocates and initializes a new SSL_SESSION object. it's lowkey doing a whole glow-up for your session: the reference count is set to 1, the time is set to the current time, and the timeout is set to five minutes. periodt. ⏰

when the object is no longer needed (like, it's not the main character anymore), it can be destructed with SSL_SESSION_free(3). bye bestie πŸ‘‹

SSL_SESSION_new() is used internally, for example by SSL_connect(3). so like, it's literally working behind the scenes 24/7. iconic behavior, tbh.

SSL_SESSION_dup() creates a deep copy of src β€” with a few exceptions that you NEED to know about, bestie:

  • the reference count is set to 1
  • the peer certificate is shared with src
  • the new session is not part of any session cache

it's giving "twin but not totally identical" energy. same vibes, different reference count. πŸͺž


πŸ‘‘ RETURN VALUES πŸ‘‘

SSL_SESSION_new() and SSL_SESSION_dup() return the new SSL_SESSION object β€” or NULL if insufficient memory is available. sad girl hours 😭

after failure, ERR_get_error(3) returns ERR_R_MALLOC_FAILURE. so like, at least the error message knows what's up.


πŸ¦‹ SEE ALSO πŸ¦‹

d2i_SSL_SESSION(3), PEM_read_SSL_SESSION(3), ssl(3), SSL_connect(3), SSL_copy_session_id(3), SSL_CTX_add_session(3), SSL_CTX_sess_set_get_cb(3), SSL_get_session(3), SSL_SESSION_free(3), SSL_SESSION_get0_peer(3), SSL_SESSION_get_compress_id(3), SSL_SESSION_get_ex_new_index(3), SSL_SESSION_get_id(3), SSL_SESSION_get_master_key(3), SSL_SESSION_get_protocol_version(3), SSL_SESSION_get_time(3), SSL_SESSION_has_ticket(3), SSL_SESSION_is_resumable(3), SSL_SESSION_print(3), SSL_SESSION_set1_id_context(3), SSL_set_session(3)


🌈 HISTORY 🌈

SSL_SESSION_new() first appeared in SSLeay 0.5.2 and has been available since OpenBSD 2.4. og status fr fr πŸ’€

SSL_SESSION_dup() first appeared in OpenSSL 1.1.1 and has been available since OpenBSD 7.9. a newer icon has entered the chat ✨


okay that's the whole page, bestie! now go forth and construct those sessions. i'm obsessed with you for reading all this πŸŽ€πŸ’œ

Debian β€’ October 24, 2025 β€’ SSL_SESSION_NEW(3) β€” mwah, kisses from your favorite manual page πŸ’‹

πŸ“¦ where this page comes from