1.\" $OpenBSD: BIO_get_ex_new_index.3,v 1.14 2023/07/21 04:39:49 tb Exp $ 2.\" full merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 3.\" 4.\" This file was written by Rich Salz <rsalz@akamai.com>. 5.\" Copyright (c) 2015, 2016 The OpenSSL Project. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in 16.\" the documentation and/or other materials provided with the 17.\" distribution. 18.\" 19.\" 3. All advertising materials mentioning features or use of this 20.\" software must display the following acknowledgment: 21.\" "This product includes software developed by the OpenSSL Project 22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" 23.\" 24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to 25.\" endorse or promote products derived from this software without 26.\" prior written permission. For written permission, please contact 27.\" openssl-core@openssl.org. 28.\" 29.\" 5. Products derived from this software may not be called "OpenSSL" 30.\" nor may "OpenSSL" appear in their names without prior written 31.\" permission of the OpenSSL Project. 32.\" 33.\" 6. Redistributions of any form whatsoever must retain the following 34.\" acknowledgment: 35.\" "This product includes software developed by the OpenSSL Project 36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" 37.\" 38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY 39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR 42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 49.\" OF THE POSSIBILITY OF SUCH DAMAGE. 50.\" 51.Dd $Mdocdate: July 21 2023 $ 52.Dt BIO_GET_EX_NEW_INDEX 3 53.Os 54.Sh NAME 55.Nm BIO_get_ex_new_index , 56.Nm BIO_set_ex_data , 57.Nm BIO_get_ex_data , 58.Nm BIO_set_app_data , 59.Nm BIO_get_app_data , 60.Nm ENGINE_get_ex_new_index , 61.Nm ENGINE_set_ex_data , 62.Nm ENGINE_get_ex_data , 63.Nm UI_get_ex_new_index , 64.Nm UI_set_ex_data , 65.Nm UI_get_ex_data , 66.Nm X509_get_ex_new_index , 67.Nm X509_set_ex_data , 68.Nm X509_get_ex_data , 69.Nm EC_KEY_get_ex_new_index , 70.Nm EC_KEY_get_ex_data , 71.Nm EC_KEY_set_ex_data 72.Nd application-specific data 73.Sh SYNOPSIS 74.In openssl/bio.h 75.In openssl/engine.h 76.In openssl/ui.h 77.In openssl/x509.h 78.In openssl/ec.h 79.Ft int 80.Fo TYPE_get_ex_new_index 81.Fa "long argl" 82.Fa "void *argp" 83.Fa "CRYPTO_EX_new *new_func" 84.Fa "CRYPTO_EX_dup *dup_func" 85.Fa "CRYPTO_EX_free *free_func" 86.Fc 87.Ft int 88.Fo TYPE_set_ex_data 89.Fa "TYPE *d" 90.Fa "int idx" 91.Fa "void *arg" 92.Fc 93.Ft void * 94.Fo TYPE_get_ex_data 95.Fa "TYPE *d" 96.Fa "int idx" 97.Fc 98.Ft int 99.Fo TYPE_set_app_data 100.Fa "TYPE *d" 101.Fa "void *arg" 102.Fc 103.Ft void * 104.Fo TYPE_get_app_data 105.Fa "TYPE *d" 106.Fc 107.Sh DESCRIPTION 108In the description here, 109.Vt TYPE 110is used a placeholder for any of the OpenSSL datatypes listed in 111.Xr CRYPTO_get_ex_new_index 3 . 112.Pp 113These functions handle application-specific data in OpenSSL data 114structures. 115Their usage is identical to that of 116.Xr RSA_get_ex_new_index 3 , 117.Xr RSA_set_ex_data 3 , 118and 119.Xr RSA_get_ex_data 3 . 120.Pp 121.Fn TYPE_get_ex_new_index 122is a macro that calls 123.Xr CRYPTO_get_ex_new_index 3 124with the correct index value. 125.Pp 126.Fn TYPE_set_ex_data 127is a function that calls 128.Xr CRYPTO_set_ex_data 3 129with an offset into the opaque exdata part of the 130.Vt TYPE 131object. 132.Pp 133.Fn TYPE_get_ex_data 134is a function that calls 135.Xr CRYPTO_get_ex_data 3 136with an offset into the opaque exdata part of the 137.Vt TYPE 138object. 139.Pp 140.Fn TYPE_set_app_data 141and 142.Fn TYPE_get_app_data 143are deprecated wrappers that call 144.Fn TYPE_set_ex_data 145and 146.Fn TYPE_get_ex_data 147with 148.Fa idx 149set to 0. 150.Sh RETURN VALUES 151.Fn TYPE_get_new_ex_index 152returns a new index on success or \-1 on error. 153.Pp 154.Fn TYPE_set_ex_data 155and 156.Fn TYPE_set_app_data 157return 1 on success or 0 on error. 158.Pp 159.Fn TYPE_get_ex_data 160and 161.Fn TYPE_get_app_data 162return the application data or 163.Dv NULL 164if an error occurred. 165.Sh SEE ALSO 166.Xr BIO_new 3 , 167.Xr CRYPTO_get_ex_new_index 3 , 168.Xr RSA_get_ex_new_index 3 , 169.Xr X509_new 3 170.Sh HISTORY 171.Fn BIO_set_app_data 172and 173.Fn BIO_get_app_data 174first appeared in SSLeay 0.8.1. 175.Fn BIO_get_ex_new_index , 176.Fn BIO_set_ex_data , 177and 178.Fn BIO_get_ex_data 179first appeared in SSLeay 0.9.0. 180These functions have been available since 181.Ox 2.4 . 182.Pp 183.Fn X509_get_ex_new_index , 184.Fn X509_set_ex_data , 185and 186.Fn X509_get_ex_data 187first appeared in OpenSSL 0.9.5 and have been available since 188.Ox 2.7 . 189.Pp 190.Fn ENGINE_get_ex_new_index , 191.Fn ENGINE_set_ex_data , 192.Fn ENGINE_get_ex_data , 193.Fn UI_get_ex_new_index , 194.Fn UI_set_ex_data , 195and 196.Fn UI_get_ex_data 197first appeared in OpenSSL 0.9.7 and have been available since 198.Ox 3.2 . 199.Pp 200.Fn EC_KEY_get_ex_new_index , 201.Fn EC_KEY_set_ex_data , 202and 203.Fn EC_KEY_get_ex_data 204first appeared in OpenSSL 1.1.0 and have been available since 205.Ox 6.5 . 206