1.\" $OpenBSD: BIO_get_ex_new_index.3,v 1.17 2023/11/19 10:26:36 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: November 19 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 UI_get_ex_new_index ,
61.Nm UI_set_ex_data ,
62.Nm UI_get_ex_data ,
63.Nm X509_get_ex_new_index ,
64.Nm X509_set_ex_data ,
65.Nm X509_get_ex_data ,
66.Nm EC_KEY_get_ex_new_index ,
67.Nm EC_KEY_get_ex_data ,
68.Nm EC_KEY_set_ex_data
69.Nd application-specific data
70.Sh SYNOPSIS
71.In openssl/bio.h
72.In openssl/ui.h
73.In openssl/x509.h
74.In openssl/ec.h
75.Ft int
76.Fo TYPE_get_ex_new_index
77.Fa "long argl"
78.Fa "void *argp"
79.Fa "CRYPTO_EX_new *new_func"
80.Fa "CRYPTO_EX_dup *dup_func"
81.Fa "CRYPTO_EX_free *free_func"
82.Fc
83.Ft int
84.Fo TYPE_set_ex_data
85.Fa "TYPE *d"
86.Fa "int idx"
87.Fa "void *arg"
88.Fc
89.Ft void *
90.Fo TYPE_get_ex_data
91.Fa "TYPE *d"
92.Fa "int idx"
93.Fc
94.Ft int
95.Fo TYPE_set_app_data
96.Fa "TYPE *d"
97.Fa "void *arg"
98.Fc
99.Ft void *
100.Fo TYPE_get_app_data
101.Fa "TYPE *d"
102.Fc
103.Sh DESCRIPTION
104In the description here,
105.Vt TYPE
106is used a placeholder for any of the OpenSSL datatypes listed in
107.Xr CRYPTO_get_ex_new_index 3 .
108.Pp
109These functions handle application-specific data in OpenSSL data
110structures.
111Their usage is identical to that of
112.Xr RSA_get_ex_new_index 3 ,
113.Xr RSA_set_ex_data 3 ,
114and
115.Xr RSA_get_ex_data 3 .
116.Pp
117.Fn TYPE_get_ex_new_index
118is a macro that calls
119.Xr CRYPTO_get_ex_new_index 3
120with the correct index value.
121.Pp
122.Fn TYPE_set_ex_data
123is a function that calls
124.Xr CRYPTO_set_ex_data 3
125with an offset into the opaque ex_data part of the
126.Vt TYPE
127object.
128.Pp
129.Fn TYPE_get_ex_data
130is a function that calls
131.Xr CRYPTO_get_ex_data 3
132with an offset into the opaque ex_data part of the
133.Vt TYPE
134object.
135.Pp
136.Fn TYPE_set_app_data
137and
138.Fn TYPE_get_app_data
139are deprecated wrapper macros that call
140.Fn TYPE_set_ex_data
141and
142.Fn TYPE_get_ex_data
143with
144.Fa idx
145set to 0.
146.Sh RETURN VALUES
147.Fn TYPE_get_new_ex_index
148returns a new index on success or \-1 on error.
149.Pp
150.Fn TYPE_set_ex_data
151and
152.Fn TYPE_set_app_data
153return 1 on success or 0 on error.
154.Pp
155.Fn TYPE_get_ex_data
156and
157.Fn TYPE_get_app_data
158return the application data or
159.Dv NULL
160if an error occurred.
161.Sh SEE ALSO
162.Xr BIO_new 3 ,
163.Xr CRYPTO_get_ex_new_index 3 ,
164.Xr RSA_get_ex_new_index 3 ,
165.Xr X509_new 3
166.Sh HISTORY
167.Fn BIO_set_app_data
168and
169.Fn BIO_get_app_data
170first appeared in SSLeay 0.8.1.
171.Fn BIO_get_ex_new_index ,
172.Fn BIO_set_ex_data ,
173and
174.Fn BIO_get_ex_data
175first appeared in SSLeay 0.9.0.
176These functions have been available since
177.Ox 2.4 .
178.Pp
179.Fn X509_get_ex_new_index ,
180.Fn X509_set_ex_data ,
181and
182.Fn X509_get_ex_data
183first appeared in OpenSSL 0.9.5 and have been available since
184.Ox 2.7 .
185.Pp
186.Fn UI_get_ex_new_index ,
187.Fn UI_set_ex_data ,
188and
189.Fn UI_get_ex_data
190first appeared in OpenSSL 0.9.7 and have been available since
191.Ox 3.2 .
192.Pp
193.Fn EC_KEY_get_ex_new_index ,
194.Fn EC_KEY_set_ex_data ,
195and
196.Fn EC_KEY_get_ex_data
197first appeared in OpenSSL 1.1.0 and have been available since
198.Ox 6.5 .
199