1.\" $OpenBSD: BIO_get_ex_new_index.3,v 1.13 2022/12/23 17:52:32 schwarze 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: December 23 2022 $ 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.Nm ECDH_get_ex_new_index , 73.Nm ECDH_set_ex_data , 74.Nm ECDH_get_ex_data , 75.Nm ECDSA_get_ex_new_index , 76.Nm ECDSA_set_ex_data , 77.Nm ECDSA_get_ex_data 78.Nd application-specific data 79.Sh SYNOPSIS 80.In openssl/bio.h 81.In openssl/engine.h 82.In openssl/ui.h 83.In openssl/x509.h 84.In openssl/ec.h 85.In openssl/ecdh.h 86.In openssl/ecdsa.h 87.Ft int 88.Fo TYPE_get_ex_new_index 89.Fa "long argl" 90.Fa "void *argp" 91.Fa "CRYPTO_EX_new *new_func" 92.Fa "CRYPTO_EX_dup *dup_func" 93.Fa "CRYPTO_EX_free *free_func" 94.Fc 95.Ft int 96.Fo TYPE_set_ex_data 97.Fa "TYPE *d" 98.Fa "int idx" 99.Fa "void *arg" 100.Fc 101.Ft void * 102.Fo TYPE_get_ex_data 103.Fa "TYPE *d" 104.Fa "int idx" 105.Fc 106.Ft int 107.Fo TYPE_set_app_data 108.Fa "TYPE *d" 109.Fa "void *arg" 110.Fc 111.Ft void * 112.Fo TYPE_get_app_data 113.Fa "TYPE *d" 114.Fc 115.Sh DESCRIPTION 116In the description here, 117.Vt TYPE 118is used a placeholder for any of the OpenSSL datatypes listed in 119.Xr CRYPTO_get_ex_new_index 3 . 120.Pp 121These functions handle application-specific data in OpenSSL data 122structures. 123Their usage is identical to that of 124.Xr RSA_get_ex_new_index 3 , 125.Xr RSA_set_ex_data 3 , 126and 127.Xr RSA_get_ex_data 3 . 128.Pp 129.Fn TYPE_get_ex_new_index 130is a macro that calls 131.Xr CRYPTO_get_ex_new_index 3 132with the correct index value. 133.Pp 134.Fn TYPE_set_ex_data 135is a function that calls 136.Xr CRYPTO_set_ex_data 3 137with an offset into the opaque exdata part of the 138.Vt TYPE 139object. 140.Pp 141.Fn TYPE_get_ex_data 142is a function that calls 143.Xr CRYPTO_get_ex_data 3 144with an offset into the opaque exdata part of the 145.Vt TYPE 146object. 147.Pp 148.Fn TYPE_set_app_data 149and 150.Fn TYPE_get_app_data 151are deprecated wrappers that call 152.Fn TYPE_set_ex_data 153and 154.Fn TYPE_get_ex_data 155with 156.Fa idx 157set to 0. 158.Sh RETURN VALUES 159.Fn TYPE_get_new_ex_index 160returns a new index on success or \-1 on error. 161.Pp 162.Fn TYPE_set_ex_data 163and 164.Fn TYPE_set_app_data 165return 1 on success or 0 on error. 166.Pp 167.Fn TYPE_get_ex_data 168and 169.Fn TYPE_get_app_data 170return the application data or 171.Dv NULL 172if an error occurred. 173.Sh SEE ALSO 174.Xr BIO_new 3 , 175.Xr CRYPTO_get_ex_new_index 3 , 176.Xr RSA_get_ex_new_index 3 , 177.Xr X509_new 3 178.Sh HISTORY 179.Fn BIO_set_app_data 180and 181.Fn BIO_get_app_data 182first appeared in SSLeay 0.8.1. 183.Fn BIO_get_ex_new_index , 184.Fn BIO_set_ex_data , 185and 186.Fn BIO_get_ex_data 187first appeared in SSLeay 0.9.0. 188These functions have been available since 189.Ox 2.4 . 190.Pp 191.Fn X509_get_ex_new_index , 192.Fn X509_set_ex_data , 193and 194.Fn X509_get_ex_data 195first appeared in OpenSSL 0.9.5 and have been available since 196.Ox 2.7 . 197.Pp 198.Fn ENGINE_get_ex_new_index , 199.Fn ENGINE_set_ex_data , 200.Fn ENGINE_get_ex_data , 201.Fn UI_get_ex_new_index , 202.Fn UI_set_ex_data , 203and 204.Fn UI_get_ex_data 205first appeared in OpenSSL 0.9.7 and have been available since 206.Ox 3.2 . 207.Pp 208.Fn ECDH_get_ex_new_index , 209.Fn ECDH_set_ex_data , 210.Fn ECDH_get_ex_data , 211.Fn ECDSA_get_ex_new_index , 212.Fn ECDSA_set_ex_data , 213and 214.Fn ECDSA_get_ex_data 215first appeared in OpenSSL 0.9.8 and have been available since 216.Ox 4.5 . 217.Pp 218.Fn EC_KEY_get_ex_new_index , 219.Fn EC_KEY_set_ex_data , 220and 221.Fn EC_KEY_get_ex_data 222first appeared in OpenSSL 1.1.0 and have been available since 223.Ox 6.5 . 224