diff options
author | schwarze <> | 2016-11-04 10:17:17 +0000 |
---|---|---|
committer | schwarze <> | 2016-11-04 10:17:17 +0000 |
commit | 195fe5e91c60bd205043b4bea113abdff1c67bcc (patch) | |
tree | 1d15fe02d83a7ffb422ebe78c34ee1117da63e59 /src/lib/libcrypto/man/RSA_get_ex_new_index.3 | |
parent | 00872265b9546fcf2d5795aa3a120c35142d268b (diff) | |
download | openbsd-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.3 | 227 |
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 | ||
58 | Several OpenSSL structures can have application specific data attached | ||
59 | to them. | ||
60 | This has several potential uses, it can be used to cache data associated | ||
61 | with a structure (for example the hash of some part of the structure) or | ||
62 | some additional data (for example a handle to the data in an external | ||
63 | library). | ||
64 | .Pp | ||
65 | Since the application data can be anything at all it is passed and | ||
66 | retrieved as a | ||
67 | .Vt void * | ||
68 | type. | ||
69 | .Pp | ||
70 | The | ||
71 | .Fn RSA_get_ex_new_index | ||
72 | function is initially called to "register" some new application specific | ||
73 | data. | ||
74 | It takes three optional function pointers which are called when the | ||
75 | parent structure (in this case an RSA structure) is initially created, | ||
76 | when it is copied and when it is freed up. | ||
77 | If any or all of these function pointer arguments are not used, they | ||
78 | should be set to | ||
79 | .Dv NULL . | ||
80 | The precise manner in which these function pointers are called is | ||
81 | described in more detail below. | ||
82 | .Fn RSA_get_ex_new_index | ||
83 | also takes additional long and pointer parameters which will be passed | ||
84 | to the supplied functions but which otherwise have no special meaning. | ||
85 | It returns an index which should be stored (typically in a static | ||
86 | variable) and passed as the | ||
87 | .Fa idx | ||
88 | parameter in the remaining functions. | ||
89 | Each successful call to | ||
90 | .Fn RSA_get_ex_new_index | ||
91 | will return an index greater than any previously returned. | ||
92 | This is | ||
93 | important because the optional functions are called in order of | ||
94 | increasing index value. | ||
95 | .Pp | ||
96 | .Fn RSA_set_ex_data | ||
97 | is used to set application specific data, the data is supplied in the | ||
98 | .Fa arg | ||
99 | parameter and its precise meaning is up to the application. | ||
100 | .Pp | ||
101 | .Fn RSA_get_ex_data | ||
102 | is used to retrieve application specific data. | ||
103 | The data is returned to the application, this will be the same value as | ||
104 | supplied to a previous | ||
105 | .Fn RSA_set_ex_data | ||
106 | call. | ||
107 | .Pp | ||
108 | .Fa new_func | ||
109 | is called when a structure is initially allocated (for example with | ||
110 | .Xr RSA_new 3 . | ||
111 | The parent structure members will not have any meaningful values at this | ||
112 | point. | ||
113 | This function will typically be used to allocate any application | ||
114 | specific structure. | ||
115 | .Pp | ||
116 | .Fa free_func | ||
117 | is called when a structure is being freed up. | ||
118 | The dynamic parent structure members should not be accessed because they | ||
119 | will be freed up when this function is called. | ||
120 | .Pp | ||
121 | .Fa new_func | ||
122 | and | ||
123 | .Fa free_func | ||
124 | take the same parameters. | ||
125 | .Fa parent | ||
126 | is a pointer to the parent | ||
127 | .Vt RSA | ||
128 | structure. | ||
129 | .Fa ptr | ||
130 | is the application specific data (this won't be of much use in | ||
131 | .Fa new_func ) . | ||
132 | .Fa ad | ||
133 | is a pointer to the | ||
134 | .Vt CRYPTO_EX_DATA | ||
135 | structure from the parent | ||
136 | .Vt RSA | ||
137 | structure: the functions | ||
138 | .Fn CRYPTO_get_ex_data | ||
139 | and | ||
140 | .Fn CRYPTO_set_ex_data | ||
141 | can be called to manipulate it. | ||
142 | The | ||
143 | .Fa idx | ||
144 | parameter is the index: this will be the same value returned by | ||
145 | .Fn RSA_get_ex_new_index | ||
146 | when the functions were initially registered. | ||
147 | Finally the | ||
148 | .Fa argl | ||
149 | and | ||
150 | .Fa argp | ||
151 | parameters are the values originally passed to the same corresponding | ||
152 | parameters when | ||
153 | .Fn RSA_get_ex_new_index | ||
154 | was called. | ||
155 | .Pp | ||
156 | .Fa dup_func | ||
157 | is called when a structure is being copied. | ||
158 | Pointers to the destination and source | ||
159 | .Vt CRYPTO_EX_DATA | ||
160 | structures are passed in the | ||
161 | .Fa to | ||
162 | and | ||
163 | .Fa from | ||
164 | parameters, respectively. | ||
165 | The | ||
166 | .Fa from_d | ||
167 | parameter is passed a pointer to the source application data when the | ||
168 | function is called. | ||
169 | When the function returns, the value is copied to the destination: | ||
170 | the application can thus modify the data pointed to by | ||
171 | .Fa from_d | ||
172 | and have different values in the source and destination. | ||
173 | The | ||
174 | .Fa idx , | ||
175 | .Fa argl , | ||
176 | and | ||
177 | .Fa argp | ||
178 | parameters are the same as those in | ||
179 | .Fa new_func | ||
180 | and | ||
181 | .Fa free_func . | ||
182 | .Sh RETURN VALUES | ||
183 | .Fn RSA_get_ex_new_index | ||
184 | returns a new index or -1 on failure. | ||
185 | Note that 0 is a valid index value. | ||
186 | .Pp | ||
187 | .Fn RSA_set_ex_data | ||
188 | returns 1 on success or 0 on failure. | ||
189 | .Pp | ||
190 | .Fn RSA_get_ex_data | ||
191 | returns the application data or | ||
192 | .Dv NULL | ||
193 | on failure. | ||
194 | .Dv NULL | ||
195 | may also be valid application data, but currently it can only fail if | ||
196 | given an invalid | ||
197 | .Fa idx | ||
198 | parameter. | ||
199 | .Pp | ||
200 | .Fa new_func | ||
201 | and | ||
202 | .Fa dup_func | ||
203 | should return 0 for failure and 1 for success. | ||
204 | .Pp | ||
205 | On 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 , | ||
213 | and | ||
214 | .Fn RSA_get_ex_data | ||
215 | are available since SSLeay 0.9.0. | ||
216 | .Sh BUGS | ||
217 | .Fa dup_func | ||
218 | is currently never called. | ||
219 | .Pp | ||
220 | The return value of | ||
221 | .Fa new_func | ||
222 | is ignored. | ||
223 | .Pp | ||
224 | The | ||
225 | .Fa new_func | ||
226 | function isn't very useful because no meaningful values are present in | ||
227 | the parent RSA structure when it is called. | ||