LIBRESSL-SSL_CTX_GET_EX_NEW_INDEX(3)

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

πŸ’… SSL_CTX_GET_EX_NEW_INDEX(3) β€” like, the manual page, bestie

okay so this is a page from the Library Functions Manual (yes, that manual, the libssl one, we're in the big leagues now) and it's about the internal application-specific data functions. ngl the name is a whole mouthful but stay with me, it's actually slay once you get it πŸŽ€


✨ NAME ✨

SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data β€” the internal application specific data functions. basically the little secret pockets where you stash your own stuff inside OpenSSL structs 🫢


🌸 SYNOPSIS 🌸

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

int
SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
    CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);

int
SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg);

void *
SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx);

aaand the typedefs, which you should copy exactly because they are literally the whole vibe of how the callbacks look πŸ’–:

typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
               int idx, long argl, void *argp);
typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
               int idx, long argl, void *argp);
typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
               int idx, long argl, void *argp);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, several OpenSSL structures can have application specific data attached to them. cute, right? these functions are used internally by OpenSSL to manipulate that application specific data attached to a specific structure β€” think of them as the backstage crew, not the main character energy, but the show does not go on without them πŸ’…

  • SSL_CTX_get_ex_new_index() β€” used to register a new index for application specific data. like reserving your seat in the struct, periodt ✨
  • SSL_CTX_set_ex_data() β€” used to store application data at arg for idx into the ctx object. your stuff, your index, your pocket πŸŽ€
  • SSL_CTX_get_ex_data() β€” used to retrieve the information for idx from ctx. grabbing it back out, iconic behaviour 🧚

a detailed description for the *_get_ex_new_index() functionality can be found in RSA_get_ex_new_index(3). the *_get_ex_data() and *_set_ex_data() functionality is described in CRYPTO_set_ex_data(3). go read those if you want the deep lore, i'm not gatekeeping the references, iykyk πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯


πŸ‘‘ HISTORY πŸ‘‘

SSL_CTX_get_ex_new_index(), SSL_CTX_set_ex_data(), and SSL_CTX_get_ex_data() first appeared in SSLeay 0.9.0 and have been available since OpenBSD 2.4. so they're like, vintage vintage β€” older than most of us and still serving 🌈⭐


🫢 friendly little reminder: nothing here is dangerous, it's just internal machinery. keep the details exactly as written and you're golden πŸ’–

and that's the page! brought to you by the Debian crew, dated June 8, 2025, filed under SSL_CTX_GET_EX_NEW_INDEX(3). mwah, go forth and attach your data responsibly, bestie πŸ’…πŸŒΈ

πŸ“¦ where this page comes from