SSL_COPY_SESSION_ID(3)

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

πŸ’… SSL_COPY_SESSION_ID(3) πŸ’…

okay so bestie, we're in SSL_COPY_SESSION_ID territory β€” that's the <italic>Library Functions Manual</italic> section, so grab a lil snack and let's go πŸ“


✨ NAME ✨

SSL_copy_session_id β€” the function that copies session deets from one SSL object to another, no cap 🫢


🌸 SYNOPSIS 🌸

library β€œlibssl” libcrypto #include <openssl/ssl.h>

int
SSL_copy_session_id(SSL *to, const SSL *from);

πŸŽ€ DESCRIPTION πŸŽ€

k so SSL_copy_session_id() literally takes all this data from from and drops it into to. the way it just… copies. iconic.

  • the pointer to the SSL_SESSION object, and it increments its reference count by 1 β€” sharing is caring, but be responsible okay? 😌
  • the pointer to the SSL_METHOD object; and like, heads up, if that changes the method, protocol-specific data gets reinitialized β€” it's giving fresh start energy ✨
  • the pointer to the CERT object, again with the reference count bumped by 1 πŸ’–
  • the session ID context

fr fr, this function is used internally by SSL_dup(3) and by BIO_ssl_copy_session_id(3) β€” our behind-the-scenes main character πŸ‘‘


⭐ RETURN VALUES ⭐

SSL_copy_session_id() returns 1 when it slays and 0 on error. that's it, that's the whole vibe check 😭


πŸ¦‹ SEE ALSO πŸ¦‹

BIO_ssl_copy_session_id(3), ssl(3), SSL_dup(3), SSL_get_session(3), SSL_SESSION_get_id(3), SSL_SESSION_new(3), SSL_set_session(3), SSL_set_session_id_context(3)

(yes, go read all of them. i'll wait πŸ’…)


🌈 HISTORY 🌈

SSL_copy_session_id() appeared in SSLeay 0.4 or earlier β€” like, ancient ancient β€” and has been available since OpenBSD 2.4. she's been booked and busy for decades at this point πŸ‘‘


πŸ’€ BUGS πŸ’€

ok so this is the part where we get serious for a sec πŸ™ˆ β€” failures of CRYPTO_add(3) are silently ignored and may leave to in an invalid or inconsistent state. like, no error, no nothing, just vibes and possibly corruption. be careful bestie 😭


so yeah that's the whole page 🧚 mwah, go forth and copy sessions responsibly πŸ’œ

β€” from your girl, written up for the Debian build, dated June 8, 2025, page SSL_COPY_SESSION_ID(3) πŸŽ€

πŸ“¦ where this page comes from