LIBRESSL-SSL_SESSION_SET1_ID_CONTEXT(3)

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

✨ NAME ✨

SSL_SESSION_get0_id_context, SSL_SESSION_set1_id_context β€” get and set the SSL ID context associated with a session πŸŽ€

🌸 SYNOPSIS 🌸

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

const unsigned char *
SSL_SESSION_get0_id_context(const SSL_SESSION *s, unsigned int *len);

int
SSL_SESSION_set1_id_context(SSL_SESSION *s,
    const unsigned char *sid_ctx, unsigned int sid_ctx_len);

πŸ’– DESCRIPTION πŸ’–

okay so SSL_SESSION_get0_id_context() hands you back the ID context associated with s. The length of that ID context in bytes gets written to *len β€” but only if len is not NULL. no cap πŸ¦‹

SSL_SESSION_set1_id_context() takes a copy of the ID context you pass in sid_ctx and associates it with the session s. The length of the ID context is sid_ctx_len, and bestie, it must not exceed SSL_MAX_SID_CTX_LENGTH bytes. that's the vibe check it has to pass πŸ’…

⭐ RETURN VALUES ⭐

  • SSL_SESSION_get0_id_context() β€” returns an internal pointer to an object maintained within s that should not be freed by the caller. leave it alone, she's internal πŸ™ˆ
  • SSL_SESSION_set1_id_context() β€” returns 1 on success or 0 on error. periodt ✨

πŸ¦‹ SEE ALSO πŸ¦‹

πŸ‘‘ HISTORY πŸ‘‘

  • SSL_SESSION_set1_id_context() first appeared in OpenSSL 1.0.1 and has been available since OpenBSD 5.3.
  • SSL_SESSION_get0_id_context() first appeared in OpenSSL 1.1.0 and has been available since OpenBSD 6.3.

xoxo, from the Debian edition, dated June 8, 2025, page SSL_SESSION_SET1_ID_CONTEXT(3) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from