summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/RSA_get_ex_new_index.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-04 10:17:17 +0000
committerschwarze <>2016-11-04 10:17:17 +0000
commit195fe5e91c60bd205043b4bea113abdff1c67bcc (patch)
tree1d15fe02d83a7ffb422ebe78c34ee1117da63e59 /src/lib/libcrypto/man/RSA_get_ex_new_index.3
parent00872265b9546fcf2d5795aa3a120c35142d268b (diff)
downloadopenbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.gz
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.tar.bz2
openbsd-195fe5e91c60bd205043b4bea113abdff1c67bcc.zip
convert RSA manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/RSA_get_ex_new_index.3')
-rw-r--r--src/lib/libcrypto/man/RSA_get_ex_new_index.3227
1 files changed, 227 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/RSA_get_ex_new_index.3 b/src/lib/libcrypto/man/RSA_get_ex_new_index.3
new file mode 100644
index 0000000000..b61084a18e
--- /dev/null
+++ b/src/lib/libcrypto/man/RSA_get_ex_new_index.3
@@ -0,0 +1,227 @@
1.Dd $Mdocdate: November 4 2016 $
2.Dt RSA_GET_EX_NEW_INDEX 3
3.Os
4.Sh NAME
5.Nm RSA_get_ex_new_index ,
6.Nm RSA_set_ex_data ,
7.Nm RSA_get_ex_data
8.Nd add application specific data to RSA structures
9.Sh SYNOPSIS
10.In openssl/rsa.h
11.Ft int
12.Fo RSA_get_ex_new_index
13.Fa "long argl"
14.Fa "void *argp"
15.Fa "CRYPTO_EX_new *new_func"
16.Fa "CRYPTO_EX_dup *dup_func"
17.Fa "CRYPTO_EX_free *free_func"
18.Fc
19.Ft int
20.Fo RSA_set_ex_data
21.Fa "RSA *r"
22.Fa "int idx"
23.Fa "void *arg"
24.Fc
25.Ft void *
26.Fo RSA_get_ex_data
27.Fa "RSA *r"
28.Fa "int idx"
29.Fc
30.Ft typedef int
31.Fo CRYPTO_EX_new
32.Fa "void *parent"
33.Fa "void *ptr"
34.Fa "CRYPTO_EX_DATA *ad"
35.Fa "int idx"
36.Fa "long argl"
37.Fa "void *argp"
38.Fc
39.Ft typedef void
40.Fo CRYPTO_EX_free
41.Fa "void *parent"
42.Fa "void *ptr"
43.Fa "CRYPTO_EX_DATA *ad"
44.Fa "int idx"
45.Fa "long argl"
46.Fa "void *argp"
47.Fc
48.Ft typedef int
49.Fo CRYPTO_EX_dup
50.Fa "CRYPTO_EX_DATA *to"
51.Fa "CRYPTO_EX_DATA *from"
52.Fa "void *from_d"
53.Fa "int idx"
54.Fa "long argl"
55.Fa "void *argp"
56.Fc
57.Sh DESCRIPTION
58Several OpenSSL structures can have application specific data attached
59to them.
60This has several potential uses, it can be used to cache data associated
61with a structure (for example the hash of some part of the structure) or
62some additional data (for example a handle to the data in an external
63library).
64.Pp
65Since the application data can be anything at all it is passed and
66retrieved as a
67.Vt void *
68type.
69.Pp
70The
71.Fn RSA_get_ex_new_index
72function is initially called to "register" some new application specific
73data.
74It takes three optional function pointers which are called when the
75parent structure (in this case an RSA structure) is initially created,
76when it is copied and when it is freed up.
77If any or all of these function pointer arguments are not used, they
78should be set to
79.Dv NULL .
80The precise manner in which these function pointers are called is
81described in more detail below.
82.Fn RSA_get_ex_new_index
83also takes additional long and pointer parameters which will be passed
84to the supplied functions but which otherwise have no special meaning.
85It returns an index which should be stored (typically in a static
86variable) and passed as the
87.Fa idx
88parameter in the remaining functions.
89Each successful call to
90.Fn RSA_get_ex_new_index
91will return an index greater than any previously returned.
92This is
93important because the optional functions are called in order of
94increasing index value.
95.Pp
96.Fn RSA_set_ex_data
97is used to set application specific data, the data is supplied in the
98.Fa arg
99parameter and its precise meaning is up to the application.
100.Pp
101.Fn RSA_get_ex_data
102is used to retrieve application specific data.
103The data is returned to the application, this will be the same value as
104supplied to a previous
105.Fn RSA_set_ex_data
106call.
107.Pp
108.Fa new_func
109is called when a structure is initially allocated (for example with
110.Xr RSA_new 3 .
111The parent structure members will not have any meaningful values at this
112point.
113This function will typically be used to allocate any application
114specific structure.
115.Pp
116.Fa free_func
117is called when a structure is being freed up.
118The dynamic parent structure members should not be accessed because they
119will be freed up when this function is called.
120.Pp
121.Fa new_func
122and
123.Fa free_func
124take the same parameters.
125.Fa parent
126is a pointer to the parent
127.Vt RSA
128structure.
129.Fa ptr
130is the application specific data (this won't be of much use in
131.Fa new_func ) .
132.Fa ad
133is a pointer to the
134.Vt CRYPTO_EX_DATA
135structure from the parent
136.Vt RSA
137structure: the functions
138.Fn CRYPTO_get_ex_data
139and
140.Fn CRYPTO_set_ex_data
141can be called to manipulate it.
142The
143.Fa idx
144parameter is the index: this will be the same value returned by
145.Fn RSA_get_ex_new_index
146when the functions were initially registered.
147Finally the
148.Fa argl
149and
150.Fa argp
151parameters are the values originally passed to the same corresponding
152parameters when
153.Fn RSA_get_ex_new_index
154was called.
155.Pp
156.Fa dup_func
157is called when a structure is being copied.
158Pointers to the destination and source
159.Vt CRYPTO_EX_DATA
160structures are passed in the
161.Fa to
162and
163.Fa from
164parameters, respectively.
165The
166.Fa from_d
167parameter is passed a pointer to the source application data when the
168function is called.
169When the function returns, the value is copied to the destination:
170the application can thus modify the data pointed to by
171.Fa from_d
172and have different values in the source and destination.
173The
174.Fa idx ,
175.Fa argl ,
176and
177.Fa argp
178parameters are the same as those in
179.Fa new_func
180and
181.Fa free_func .
182.Sh RETURN VALUES
183.Fn RSA_get_ex_new_index
184returns a new index or -1 on failure.
185Note that 0 is a valid index value.
186.Pp
187.Fn RSA_set_ex_data
188returns 1 on success or 0 on failure.
189.Pp
190.Fn RSA_get_ex_data
191returns the application data or
192.Dv NULL
193on failure.
194.Dv NULL
195may also be valid application data, but currently it can only fail if
196given an invalid
197.Fa idx
198parameter.
199.Pp
200.Fa new_func
201and
202.Fa dup_func
203should return 0 for failure and 1 for success.
204.Pp
205On failure an error code can be obtained from
206.Xr ERR_get_error 3 .
207.Sh SEE ALSO
208.Xr CRYPTO_set_ex_data 3 ,
209.Xr rsa 3
210.Sh HISTORY
211.Fn RSA_get_ex_new_index ,
212.Fn RSA_set_ex_data ,
213and
214.Fn RSA_get_ex_data
215are available since SSLeay 0.9.0.
216.Sh BUGS
217.Fa dup_func
218is currently never called.
219.Pp
220The return value of
221.Fa new_func
222is ignored.
223.Pp
224The
225.Fa new_func
226function isn't very useful because no meaningful values are present in
227the parent RSA structure when it is called.