BIO_GET_EX_NEW_INDEX(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

πŸ’– BIO_GET_EX_NEW_INDEX(3) πŸ’–

hey bestie 🫢 welcome to BIO_GET_EX_NEW_INDEX(3) β€” this one lives in the Library Functions Manual, and it's the whole application-specific-data situation. no cap, it's giving β€œone page, lots of aliases” energy πŸ’…


πŸŽ€ NAME πŸŽ€

okay so the name section is basically a group chat roll call for all the functions that handle application-specific data:

  • BIO_get_ex_new_index
  • BIO_set_ex_data
  • BIO_get_ex_data
  • BIO_set_app_data
  • BIO_get_app_data
  • UI_get_ex_new_index
  • UI_set_ex_data
  • UI_get_ex_data
  • X509_get_ex_new_index
  • X509_set_ex_data
  • X509_get_ex_data
  • EC_KEY_get_ex_new_index
  • EC_KEY_get_ex_data
  • EC_KEY_set_ex_data

β€” and yes, that final dash is literally application-specific data. iconic ✨


🌸 SYNOPSIS 🌸

bestie, grab these includes exactly as written β€” no freestyling the headers, okay? πŸ’–

#include <openssl/bio.h>
#include <openssl/ui.h>
#include <openssl/x509.h>
#include <openssl/ec.h>

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

int
TYPE_set_ex_data(TYPE *d, int idx, void *arg);

void *
TYPE_get_ex_data(TYPE *d, int idx);

int
TYPE_set_app_data(TYPE *d, void *arg);

void *
TYPE_get_app_data(TYPE *d);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so in this description, TYPE is used as a placeholder for any of the OpenSSL datatypes listed in CRYPTO_get_ex_new_index(3). it's not one specific type, it's the β€œinsert your fave datatype here” vibe πŸ‘‘

these functions handle application-specific data in OpenSSL data 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 the same energy, different type πŸ’«

  • TYPE_get_ex_new_index() β€” this is a macro that calls CRYPTO_get_ex_new_index(3) with the correct index value. macro slay πŸ’…
  • TYPE_set_ex_data() β€” this is a function that calls CRYPTO_set_ex_data(3) with an offset into the opaque ex_data part of the TYPE object.
  • TYPE_get_ex_data() β€” this is a function that calls CRYPTO_get_ex_data(3) with an offset into the opaque ex_data part of the TYPE object.
🚨 deprecated alert, bestie: TYPE_set_app_data() and TYPE_get_app_data() are deprecated wrapper macros that call TYPE_set_ex_data() and TYPE_get_ex_data() with idx set to 0. so cute, so legacy, so β€œwe don't really do that anymore” πŸ™ˆ

⭐ RETURN VALUES ⭐

  • TYPE_get_new_ex_index() β€” returns a new index on success or -1 on error. (yep, that's the spelling on the page β€” I'm not editing the icon πŸ’€)
  • TYPE_set_ex_data() and TYPE_set_app_data() β€” return 1 on success or 0 on error.
  • TYPE_get_ex_data() and TYPE_get_app_data() β€” return the application data or NULL if an error occurred.

πŸ”₯ SEE ALSO πŸ”₯

the β€œgo read these next” lineup, periodt:


🌈 HISTORY 🌈

history lesson, but make it lore 🧚:

  • BIO_set_app_data() and BIO_get_app_data() first appeared in SSLeay 0.8.1. BIO_get_ex_new_index(), BIO_set_ex_data(), and BIO_get_ex_data() first appeared in SSLeay 0.9.0. these functions have been available since OpenBSD 2.4.
  • X509_get_ex_new_index(), X509_set_ex_data(), and X509_get_ex_data() first appeared in OpenSSL 0.9.5 and have been available since OpenBSD 2.7.
  • UI_get_ex_new_index(), UI_set_ex_data(), and UI_get_ex_data() first appeared in OpenSSL 0.9.7 and have been available since OpenBSD 3.2.
  • EC_KEY_get_ex_new_index(), EC_KEY_set_ex_data(), and EC_KEY_get_ex_data() first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.5.

okay that's the whole page, mwah πŸ’‹ this cutie came from Debian, dated November 19, 2023, and the page tag is BIO_GET_EX_NEW_INDEX(3) 🫢✨

πŸ“¦ where this page comes from