LIBRESSL-X509_STORE_CTX_GET_EX_NEW_INDEX(3)

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

okay so bestie, this page is from the Library Functions Manual, and the header title is LIBRESSL-X509_STORE_CTX_GET_EX_NEW_INDEX(3) πŸ’… it’s all about stashing application-specific data inside X509_STORE_CTX structures, and honestly? iconic little hooks.

✨ NAME ✨

  • X509_STORE_CTX_get_ex_new_index
  • X509_STORE_CTX_set_ex_data
  • X509_STORE_CTX_get_ex_data
  • X509_STORE_CTX_set_app_data
  • X509_STORE_CTX_get_app_data

β€” all of these add application specific data to X509_STORE_CTX structures 🫢


🌸 SYNOPSIS 🌸

library libcrypto and this include, bestie:

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

int
X509_STORE_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
X509_STORE_CTX_set_ex_data(X509_STORE_CTX *d, int idx, void *arg);

void *
X509_STORE_CTX_get_ex_data(X509_STORE_CTX *d, int idx);

int
X509_STORE_CTX_set_app_data(X509_STORE_CTX *d, void *arg);

void *
X509_STORE_CTX_get_app_data(X509_STORE_CTX *d);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so these functions handle application specific data in X509_STORE_CTX structures. Their usage is identical to that of RSA_get_ex_new_index(3), RSA_set_ex_data(3), and RSA_get_ex_data(3) β€” literally same energy, just for X509_STORE_CTX πŸ’–

This mechanism is used internally by the ssl(3) library to store the SSL structure associated with a verification operation in an X509_STORE_CTX structure. no cap, it’s the little internal hiding spot πŸ‘‘

X509_STORE_CTX_set_app_data() and X509_STORE_CTX_get_app_data() are macros calling X509_STORE_CTX_set_ex_data() and X509_STORE_CTX_get_ex_data(), respectively, with an idx of 0. so they’re the shortcut besties πŸŽ€


πŸ’€ RETURN VALUES πŸ’€

  • X509_STORE_CTX_get_ex_new_index() returns a new index or -1 on failure. slay when it works, sad little -1 when it doesn’t.
  • X509_STORE_CTX_set_ex_data() and X509_STORE_CTX_set_app_data() return 1 on success or 0 on failure. clean binary vibes.
  • X509_STORE_CTX_get_ex_data() and X509_STORE_CTX_get_app_data() return the application data or NULL on failure. NULL may also be valid application data, but currently these functions can only fail if given an invalid idx argument. so like… NULL is not always a red flag, bestie πŸ™ˆ

🌈 SEE ALSO 🌈

go read these next, fr fr πŸ“š


πŸ‘‘ HISTORY πŸ‘‘

X509_STORE_CTX_set_app_data() and X509_STORE_CTX_get_app_data() first appeared in SSLeay 0.8.0, and X509_STORE_CTX_get_ex_new_index(), X509_STORE_CTX_set_ex_data(), and X509_STORE_CTX_get_ex_data() in SSLeay 0.9.0. All these functions have been available since OpenBSD 2.4. history lesson served, periodt πŸ’…


mwah πŸ’‹ signing off from the Debian source/version, dated June 8, 202X, with the page title X509_STORE_CTX_GET_EX_NEW_INDEX(3) β€” bye bestie, go add your app data responsibly 🫢✨

πŸ“¦ where this page comes from