BIO_GET_EX_NEW_INDEX(3SSL)
π BIO_GET_EX_NEW_INDEX β the OpenSSL one, bestie
okay so this is from the OpenSSL manual pages (yes the 3SSL ones, you know the vibe) and it's literally the blueprint for stuffing your own lil data into OpenSSL's objects. no cap, it's giving β¨ "I made this struct and I want to keep my stuff in it" β¨ energy. let's get into it π«Ά
πΈ NAME πΈ
okay babes, buckle up, this is a long guest list. all of these cuties live here:
BIO_get_ex_new_index, BIO_set_ex_data, BIO_get_ex_data, BIO_set_app_data, BIO_get_app_data, DH_get_ex_new_index, DH_set_ex_data, DH_get_ex_data, DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data, EC_KEY_get_ex_new_index, EC_KEY_set_ex_data, EC_KEY_get_ex_data, EVP_PKEY_get_ex_new_index, EVP_PKEY_set_ex_data, EVP_PKEY_get_ex_data, RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data, RSA_set_app_data, RSA_get_app_data, SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data, SSL_set_app_data, SSL_get_app_data, SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data, SSL_CTX_set_app_data, SSL_CTX_get_app_data, SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data, SSL_SESSION_set_app_data, SSL_SESSION_get_app_data, UI_get_ex_new_index, UI_set_ex_data, UI_get_ex_data, UI_set_app_data, UI_get_app_data, 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, X509_STORE_get_ex_new_index, X509_STORE_set_ex_data, X509_STORE_get_ex_data, X509_get_ex_new_index, X509_set_ex_data, X509_get_ex_data β and what do they do? application-specific data. that's the whole vibe. π
β¨ SYNOPSIS β¨
the general shape of it all, slay:
#include <openssl/x509.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(const TYPE *d, int idx);
#define TYPE_set_app_data(TYPE *d, void *arg)
#define TYPE_get_app_data(TYPE *d)
β οΈ heads up bestie β the following functions have been deprecated since OpenSSL 3.0, and you can hide them entirely by definingOPENSSL_API_COMPATwith a suitable version value. peepopenssl_user_macros(7)for the deets:
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DH_set_ex_data(DH *type, int idx, void *arg);
void *DH_get_ex_data(DH *type, int idx);
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int DSA_set_ex_data(DSA *type, int idx, void *arg);
void *DSA_get_ex_data(DSA *type, int idx);
int EC_KEY_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int EC_KEY_set_ex_data(EC_KEY *type, int idx, void *arg);
void *EC_KEY_get_ex_data(EC_KEY *type, int idx);
int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
int RSA_set_ex_data(RSA *type, int idx, void *arg);
void *RSA_get_ex_data(RSA *type, int idx);
int RSA_set_app_data(RSA *type, void *arg);
void *RSA_get_app_data(RSA *type);
π DESCRIPTION π
okay so throughout this whole page, TYPE is just a lil placeholder β swap it in for any of the OpenSSL datatypes listed over in CRYPTO_get_ex_new_index(3). it's a β¨ template β¨, iykyk.
π¨ real talk: every function whereTYPEisDH,DSA,RSAorEC_KEYis deprecated. like, dead to us (affectionately). applications should useEVP_PKEY_set_ex_data(),EVP_PKEY_get_ex_data()andEVP_PKEY_get_ex_new_index()instead. periodt.
so what do these even do?? they handle application-specific data for OpenSSL data structures. basically you get to stash your own stuff on their objects. main character energy π
TYPE_get_ex_new_index()β it's a macro, and it callsCRYPTO_get_ex_new_index()with the correct index value. it's out here booking you a fresh slot ποΈTYPE_set_ex_data()β a function that callsCRYPTO_set_ex_data()with an offset into the opaque exdata part of theTYPEobject. and babes,dMUST NOT beNULL. like seriously, don't. πTYPE_get_ex_data()β a function that callsCRYPTO_get_ex_data()with an offset into the opaque exdata part of theTYPEobject. and yep,dMUST NOT beNULLhere either. we been knew π- the app data duo β for compatibility with previous releases, the exdata index of zero is reserved for "application data." there are two lil convenience functions for this, no cap:
TYPE_set_app_data()is a macro that invokesTYPE_set_ex_data()withidxset to zero.TYPE_get_app_data()is a macro that invokesTYPE_get_ex_data()withidxset to zero.
π₯ RETURN VALUES π₯
TYPE_get_ex_new_index()β returns a new index on success, or-1on error. π¬TYPE_set_ex_data()β returns1on success, or0on error.TYPE_get_ex_data()β returns the application data, orNULLif an error occurred. π
π¦ SEE ALSO π¦
π HISTORY π
bestie, listen. these functions were deprecated in OpenSSL 3.0, and the whole list is:
DH_get_ex_new_index(), DH_set_ex_data(), DH_get_ex_data(), DSA_get_ex_new_index(), DSA_set_ex_data(), DSA_get_ex_data(), EC_KEY_get_ex_new_index(), EC_KEY_set_ex_data(), EC_KEY_get_ex_data(), RSA_get_ex_new_index(), RSA_set_ex_data(), RSA_get_ex_data(), RSA_set_app_data() and RSA_get_app_data().
they were gorgeous, they served, but they're legacy now. π
π COPYRIGHT π
Copyright 2015-2025 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π
sending you off with the cute lil sign-off: this was OpenSSL 4.0.3, dated 2026-09-29, and you'll find it filed under BIO_GET_EX_NEW_INDEX(3SSL). go forth and ex_data responsibly π«Άβ¨πΈ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms