Merge from vendor branch AWK:
[dragonfly.git] / secure / lib / libcrypto / man / RSA_get_ex_new_index.3
1 .\" Automatically generated by Pod::Man version 1.15
2 .\" Wed Feb 19 16:42:58 2003
3 .\"
4 .\" Standard preamble:
5 .\" ======================================================================
6 .de Sh \" Subsection heading
7 .br
8 .if t .Sp
9 .ne 5
10 .PP
11 \fB\\$1\fR
12 .PP
13 ..
14 .de Sp \" Vertical space (when we can't use .PP)
15 .if t .sp .5v
16 .if n .sp
17 ..
18 .de Ip \" List item
19 .br
20 .ie \\n(.$>=3 .ne \\$3
21 .el .ne 3
22 .IP "\\$1" \\$2
23 ..
24 .de Vb \" Begin verbatim text
25 .ft CW
26 .nf
27 .ne \\$1
28 ..
29 .de Ve \" End verbatim text
30 .ft R
31
32 .fi
33 ..
34 .\" Set up some character translations and predefined strings.  \*(-- will
35 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
36 .\" double quote, and \*(R" will give a right double quote.  | will give a
37 .\" real vertical bar.  \*(C+ will give a nicer C++.  Capital omega is used
38 .\" to do unbreakable dashes and therefore won't be available.  \*(C` and
39 .\" \*(C' expand to `' in nroff, nothing in troff, for use with C<>
40 .tr \(*W-|\(bv\*(Tr
41 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
42 .ie n \{\
43 .    ds -- \(*W-
44 .    ds PI pi
45 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
46 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
47 .    ds L" ""
48 .    ds R" ""
49 .    ds C` ""
50 .    ds C' ""
51 'br\}
52 .el\{\
53 .    ds -- \|\(em\|
54 .    ds PI \(*p
55 .    ds L" ``
56 .    ds R" ''
57 'br\}
58 .\"
59 .\" If the F register is turned on, we'll generate index entries on stderr
60 .\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and
61 .\" index entries marked with X<> in POD.  Of course, you'll have to process
62 .\" the output yourself in some meaningful fashion.
63 .if \nF \{\
64 .    de IX
65 .    tm Index:\\$1\t\\n%\t"\\$2"
66 ..
67 .    nr % 0
68 .    rr F
69 .\}
70 .\"
71 .\" For nroff, turn off justification.  Always turn off hyphenation; it
72 .\" makes way too many mistakes in technical documents.
73 .hy 0
74 .if n .na
75 .\"
76 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
77 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
78 .bd B 3
79 .    \" fudge factors for nroff and troff
80 .if n \{\
81 .    ds #H 0
82 .    ds #V .8m
83 .    ds #F .3m
84 .    ds #[ \f1
85 .    ds #] \fP
86 .\}
87 .if t \{\
88 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89 .    ds #V .6m
90 .    ds #F 0
91 .    ds #[ \&
92 .    ds #] \&
93 .\}
94 .    \" simple accents for nroff and troff
95 .if n \{\
96 .    ds ' \&
97 .    ds ` \&
98 .    ds ^ \&
99 .    ds , \&
100 .    ds ~ ~
101 .    ds /
102 .\}
103 .if t \{\
104 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
105 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
106 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
107 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
108 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
109 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
110 .\}
111 .    \" troff and (daisy-wheel) nroff accents
112 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
113 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
114 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
115 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
116 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
117 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
118 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
119 .ds ae a\h'-(\w'a'u*4/10)'e
120 .ds Ae A\h'-(\w'A'u*4/10)'E
121 .    \" corrections for vroff
122 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
123 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
124 .    \" for low resolution devices (crt and lpr)
125 .if \n(.H>23 .if \n(.V>19 \
126 \{\
127 .    ds : e
128 .    ds 8 ss
129 .    ds o a
130 .    ds d- d\h'-1'\(ga
131 .    ds D- D\h'-1'\(hy
132 .    ds th \o'bp'
133 .    ds Th \o'LP'
134 .    ds ae ae
135 .    ds Ae AE
136 .\}
137 .rm #[ #] #H #V #F C
138 .\" ======================================================================
139 .\"
140 .IX Title "RSA_get_ex_new_index 3"
141 .TH RSA_get_ex_new_index 3 "0.9.7a" "2003-02-19" "OpenSSL"
142 .UC
143 .SH "NAME"
144 RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data \- add application specific data to \s-1RSA\s0 structures
145 .SH "SYNOPSIS"
146 .IX Header "SYNOPSIS"
147 .Vb 1
148 \& #include <openssl/rsa.h>
149 .Ve
150 .Vb 4
151 \& int RSA_get_ex_new_index(long argl, void *argp,
152 \&                CRYPTO_EX_new *new_func,
153 \&                CRYPTO_EX_dup *dup_func,
154 \&                CRYPTO_EX_free *free_func);
155 .Ve
156 .Vb 1
157 \& int RSA_set_ex_data(RSA *r, int idx, void *arg);
158 .Ve
159 .Vb 1
160 \& void *RSA_get_ex_data(RSA *r, int idx);
161 .Ve
162 .Vb 6
163 \& typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
164 \&                int idx, long argl, void *argp);
165 \& typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
166 \&                int idx, long argl, void *argp);
167 \& typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, 
168 \&                int idx, long argl, void *argp);
169 .Ve
170 .SH "DESCRIPTION"
171 .IX Header "DESCRIPTION"
172 Several OpenSSL structures can have application specific data attached to them.
173 This has several potential uses, it can be used to cache data associated with
174 a structure (for example the hash of some part of the structure) or some
175 additional data (for example a handle to the data in an external library).
176 .PP
177 Since the application data can be anything at all it is passed and retrieved
178 as a \fBvoid *\fR type.
179 .PP
180 The \fB\f(BIRSA_get_ex_new_index()\fB\fR function is initially called to \*(L"register\*(R" some
181 new application specific data. It takes three optional function pointers which
182 are called when the parent structure (in this case an \s-1RSA\s0 structure) is
183 initially created, when it is copied and when it is freed up. If any or all of
184 these function pointer arguments are not used they should be set to \s-1NULL\s0. The
185 precise manner in which these function pointers are called is described in more
186 detail below. \fB\f(BIRSA_get_ex_new_index()\fB\fR also takes additional long and pointer
187 parameters which will be passed to the supplied functions but which otherwise
188 have no special meaning. It returns an \fBindex\fR which should be stored
189 (typically in a static variable) and passed used in the \fBidx\fR parameter in
190 the remaining functions. Each successful call to \fB\f(BIRSA_get_ex_new_index()\fB\fR
191 will return an index greater than any previously returned, this is important
192 because the optional functions are called in order of increasing index value.
193 .PP
194 \&\fB\f(BIRSA_set_ex_data()\fB\fR is used to set application specific data, the data is
195 supplied in the \fBarg\fR parameter and its precise meaning is up to the
196 application.
197 .PP
198 \&\fB\f(BIRSA_get_ex_data()\fB\fR is used to retrieve application specific data. The data
199 is returned to the application, this will be the same value as supplied to
200 a previous \fB\f(BIRSA_set_ex_data()\fB\fR call.
201 .PP
202 \&\fB\f(BInew_func()\fB\fR is called when a structure is initially allocated (for example
203 with \fB\f(BIRSA_new()\fB\fR. The parent structure members will not have any meaningful
204 values at this point. This function will typically be used to allocate any
205 application specific structure.
206 .PP
207 \&\fB\f(BIfree_func()\fB\fR is called when a structure is being freed up. The dynamic parent
208 structure members should not be accessed because they will be freed up when
209 this function is called.
210 .PP
211 \&\fB\f(BInew_func()\fB\fR and \fB\f(BIfree_func()\fB\fR take the same parameters. \fBparent\fR is a
212 pointer to the parent \s-1RSA\s0 structure. \fBptr\fR is a the application specific data
213 (this wont be of much use in \fB\f(BInew_func()\fB\fR. \fBad\fR is a pointer to the
214 \&\fB\s-1CRYPTO_EX_DATA\s0\fR structure from the parent \s-1RSA\s0 structure: the functions
215 \&\fB\f(BICRYPTO_get_ex_data()\fB\fR and \fB\f(BICRYPTO_set_ex_data()\fB\fR can be called to manipulate
216 it. The \fBidx\fR parameter is the index: this will be the same value returned by
217 \&\fB\f(BIRSA_get_ex_new_index()\fB\fR when the functions were initially registered. Finally
218 the \fBargl\fR and \fBargp\fR parameters are the values originally passed to the same
219 corresponding parameters when \fB\f(BIRSA_get_ex_new_index()\fB\fR was called.
220 .PP
221 \&\fB\f(BIdup_func()\fB\fR is called when a structure is being copied. Pointers to the
222 destination and source \fB\s-1CRYPTO_EX_DATA\s0\fR structures are passed in the \fBto\fR and
223 \&\fBfrom\fR parameters respectively. The \fBfrom_d\fR parameter is passed a pointer to
224 the source application data when the function is called, when the function returns
225 the value is copied to the destination: the application can thus modify the data
226 pointed to by \fBfrom_d\fR and have different values in the source and destination.
227 The \fBidx\fR, \fBargl\fR and \fBargp\fR parameters are the same as those in \fB\f(BInew_func()\fB\fR
228 and \fB\f(BIfree_func()\fB\fR.
229 .SH "RETURN VALUES"
230 .IX Header "RETURN VALUES"
231 \&\fB\f(BIRSA_get_ex_new_index()\fB\fR returns a new index or \-1 on failure (note 0 is a valid
232 index value).
233 .PP
234 \&\fB\f(BIRSA_set_ex_data()\fB\fR returns 1 on success or 0 on failure.
235 .PP
236 \&\fB\f(BIRSA_get_ex_data()\fB\fR returns the application data or 0 on failure. 0 may also
237 be valid application data but currently it can only fail if given an invalid \fBidx\fR
238 parameter.
239 .PP
240 \&\fB\f(BInew_func()\fB\fR and \fB\f(BIdup_func()\fB\fR should return 0 for failure and 1 for success.
241 .PP
242 On failure an error code can be obtained from ERR_get_error(3).
243 .SH "BUGS"
244 .IX Header "BUGS"
245 \&\fB\f(BIdup_func()\fB\fR is currently never called.
246 .PP
247 The return value of \fB\f(BInew_func()\fB\fR is ignored.
248 .PP
249 The \fB\f(BInew_func()\fB\fR function isn't very useful because no meaningful values are
250 present in the parent \s-1RSA\s0 structure when it is called.
251 .SH "SEE ALSO"
252 .IX Header "SEE ALSO"
253 rsa(3), CRYPTO_set_ex_data(3)
254 .SH "HISTORY"
255 .IX Header "HISTORY"
256 \&\fIRSA_get_ex_new_index()\fR, \fIRSA_set_ex_data()\fR and \fIRSA_get_ex_data()\fR are
257 available since SSLeay 0.9.0.