BIO_GET_EX_NEW_INDEX(3)
π
application-specific data: the BIO_get_ex_new_index(3) page π
Okay bestie, welcome to the Library Functions Manual page for BIO_GET_EX_NEW_INDEX(3) from libcrypto. Yes, the whole squad is here: we're talking about hanging your own application-specific data off OpenSSL data structures, and this page is the group chat for all the TYPE_* variants. π«Ά
β¨ NAME β¨
The besties on this page are:
BIO_get_ex_new_indexBIO_set_ex_dataBIO_get_ex_dataBIO_set_app_dataBIO_get_app_dataUI_get_ex_new_indexUI_set_ex_dataUI_get_ex_dataX509_get_ex_new_indexX509_set_ex_dataX509_get_ex_dataEC_KEY_get_ex_new_indexEC_KEY_get_ex_dataEC_KEY_set_ex_data
...and their whole thing is application-specific data. Periodt. π
πΈ SYNOPSIS πΈ
This is the libcrypto situation, so grab these headers:
#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 π
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 giving "one template to rule them all," and honestly? Slay.
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). No new lore, same vibe. β¨
Here's the breakdown, bestie:
TYPE_get_ex_new_index()is a macro that callsCRYPTO_get_ex_new_index(3)with the correct index value.TYPE_set_ex_data()is a function that callsCRYPTO_set_ex_data(3)with an offset into the opaqueex_datapart of theTYPEobject.TYPE_get_ex_data()is a function that callsCRYPTO_get_ex_data(3)with an offset into the opaqueex_datapart of theTYPEobject.
Heads up:TYPE_set_app_data()andTYPE_get_app_data()are deprecated wrapper macros that callTYPE_set_ex_data()andTYPE_get_ex_data()withidxset to0. Deprecated means deprecated β don't pretend you didn't see this. π«Ά
π«Ά RETURN VALUES π«Ά
TYPE_get_new_ex_index()returns a new index on success or-1on error. (Yes, that's the exact spelling in this section β I'm not out here correcting the page.)TYPE_set_ex_data()andTYPE_set_app_data()return1on success or0on error.TYPE_get_ex_data()andTYPE_get_app_data()return the application data orNULLif an error occurred.
π SEE ALSO π
Go read these next, iykyk:
π HISTORY π
The lore is lore-ing:
BIO_set_app_data()andBIO_get_app_data()first appeared in SSLeay 0.8.1.BIO_get_ex_new_index(),BIO_set_ex_data(), andBIO_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(), andX509_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(), andUI_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(), andEC_KEY_get_ex_data()first appeared in OpenSSL 1.1.0 and have been available since OpenBSD 6.5.
π Cute little sign-off: this footer says Debian, June 8, 2025, and BIO_GET_EX_NEW_INDEX(3) β mwah, bye bestie! πβ¨
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms