Initial import from FreeBSD RELENG_4:
[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
4.\" Standard preamble:
5.\" ====================================================================== Sh \" Subsection heading
8.if t .Sp 5
13.. Sp \" Vertical space (when we can't use .PP)
15.if t .sp .5v
16.if n .sp
17.. Ip \" List item \\n(.$>=3 .ne \\$3
21.el .ne 3
22.IP "\\$1" \\$2
23.. Vb \" Begin verbatim text
25.ft CW \\$1
28.. Ve \" End verbatim text
30.ft R
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<> \(*W-|\(bv\*(Tr
41.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' 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' ""
53. ds -- \|\(em\|
54. ds PI \(*p
55. ds L" ``
56. ds R" ''
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"
67. nr % 0
68. rr F
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
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. 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
87.if t \{\
88. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
89. ds #V .6m
90. ds #F 0
91. ds #[ \&
92. ds #] \&
94. \" simple accents for nroff and troff
95.if n \{\
96. ds ' \&
97. ds ` \&
98. ds ^ \&
99. ds , \&
100. ds ~ ~
101. ds /
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'
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 \
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
137.rm #[ #] #H #V #F C
138.\" ======================================================================
140.IX Title "RSA_get_ex_new_index 3"
141.TH RSA_get_ex_new_index 3 "0.9.7a" "2003-02-19" "OpenSSL"
143.SH "NAME"
144RSA_get_ex_new_index, RSA_set_ex_data, RSA_get_ex_data \- add application specific data to \s-1RSA\s0 structures
146.IX Header "SYNOPSIS"
147.Vb 1
148\& #include <openssl/rsa.h>
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);
156.Vb 1
157\& int RSA_set_ex_data(RSA *r, int idx, void *arg);
159.Vb 1
160\& void *RSA_get_ex_data(RSA *r, int idx);
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);
172Several OpenSSL structures can have application specific data attached to them.
173This has several potential uses, it can be used to cache data associated with
174a structure (for example the hash of some part of the structure) or some
175additional data (for example a handle to the data in an external library).
177Since the application data can be anything at all it is passed and retrieved
178as a \fBvoid *\fR type.
180The \fB\f(BIRSA_get_ex_new_index()\fB\fR function is initially called to \*(L"register\*(R" some
181new application specific data. It takes three optional function pointers which
182are called when the parent structure (in this case an \s-1RSA\s0 structure) is
183initially created, when it is copied and when it is freed up. If any or all of
184these function pointer arguments are not used they should be set to \s-1NULL\s0. The
185precise manner in which these function pointers are called is described in more
186detail below. \fB\f(BIRSA_get_ex_new_index()\fB\fR also takes additional long and pointer
187parameters which will be passed to the supplied functions but which otherwise
188have 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
190the remaining functions. Each successful call to \fB\f(BIRSA_get_ex_new_index()\fB\fR
191will return an index greater than any previously returned, this is important
192because the optional functions are called in order of increasing index value.
194\&\fB\f(BIRSA_set_ex_data()\fB\fR is used to set application specific data, the data is
195supplied in the \fBarg\fR parameter and its precise meaning is up to the
198\&\fB\f(BIRSA_get_ex_data()\fB\fR is used to retrieve application specific data. The data
199is returned to the application, this will be the same value as supplied to
200a previous \fB\f(BIRSA_set_ex_data()\fB\fR call.
202\&\fB\f(BInew_func()\fB\fR is called when a structure is initially allocated (for example
203with \fB\f(BIRSA_new()\fB\fR. The parent structure members will not have any meaningful
204values at this point. This function will typically be used to allocate any
205application specific structure.
207\&\fB\f(BIfree_func()\fB\fR is called when a structure is being freed up. The dynamic parent
208structure members should not be accessed because they will be freed up when
209this function is called.
211\&\fB\f(BInew_func()\fB\fR and \fB\f(BIfree_func()\fB\fR take the same parameters. \fBparent\fR is a
212pointer 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
216it. 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
218the \fBargl\fR and \fBargp\fR parameters are the values originally passed to the same
219corresponding parameters when \fB\f(BIRSA_get_ex_new_index()\fB\fR was called.
221\&\fB\f(BIdup_func()\fB\fR is called when a structure is being copied. Pointers to the
222destination 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
224the source application data when the function is called, when the function returns
225the value is copied to the destination: the application can thus modify the data
226pointed to by \fBfrom_d\fR and have different values in the source and destination.
227The \fBidx\fR, \fBargl\fR and \fBargp\fR parameters are the same as those in \fB\f(BInew_func()\fB\fR
228and \fB\f(BIfree_func()\fB\fR.
231\&\fB\f(BIRSA_get_ex_new_index()\fB\fR returns a new index or \-1 on failure (note 0 is a valid
232index value).
234\&\fB\f(BIRSA_set_ex_data()\fB\fR returns 1 on success or 0 on failure.
236\&\fB\f(BIRSA_get_ex_data()\fB\fR returns the application data or 0 on failure. 0 may also
237be valid application data but currently it can only fail if given an invalid \fBidx\fR
240\&\fB\f(BInew_func()\fB\fR and \fB\f(BIdup_func()\fB\fR should return 0 for failure and 1 for success.
242On 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.
247The return value of \fB\f(BInew_func()\fB\fR is ignored.
249The \fB\f(BInew_func()\fB\fR function isn't very useful because no meaningful values are
250present in the parent \s-1RSA\s0 structure when it is called.
252.IX Header "SEE ALSO"
253rsa(3), CRYPTO_set_ex_data(3)
255.IX Header "HISTORY"
256\&\fIRSA_get_ex_new_index()\fR, \fIRSA_set_ex_data()\fR and \fIRSA_get_ex_data()\fR are
257available since SSLeay 0.9.0.