diff options
author | schwarze <> | 2016-12-24 21:42:30 +0000 |
---|---|---|
committer | schwarze <> | 2016-12-24 21:42:30 +0000 |
commit | 823ebb4bac20fa9711aa3eeabca11eed198723da (patch) | |
tree | ea4c6283036d6c98a0a9f626a810b24f1beff039 /src/lib | |
parent | d38aea3af37495c4f8f32f6d68e1f458590f658a (diff) | |
download | openbsd-823ebb4bac20fa9711aa3eeabca11eed198723da.tar.gz openbsd-823ebb4bac20fa9711aa3eeabca11eed198723da.tar.bz2 openbsd-823ebb4bac20fa9711aa3eeabca11eed198723da.zip |
Very carefully tweak OpenSSL doc/man3/d2i_X509.pod and create a new
ASN1_item_d2i(3) manual page from it. Enough text remains to keep
Stephen Henson's Copyright.
The eight functions documented in this new page are listed in
<openssl/asn1.h> and in Symbols.list, so they are public even though
OpenSSL does not document them. They are very important because
hundreds of documented, much-used public interface functions are
trivial wrappers around them, sharing their complicated semantics
and their copious CAVEATS and BUGS.
The plan is for the many pages documenting the wrappers to become
very concise, to focus on the few type-dependent specifics, and to
point to this new page for the details of the semantics, for the
CAVEATS, and for the BUGS.
While here, write a companion page ASN1_item_new(3) from scratch.
The user interface described in that page scares the hell out of
me, and i think people writing code to handle ASN.1 ought to be
aware of that dangerous user interface design, or they will sooner
or later get trapped.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_item_d2i.3 | 408 | ||||
-rw-r--r-- | src/lib/libcrypto/man/ASN1_item_new.3 | 103 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 4 |
3 files changed, 514 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/ASN1_item_d2i.3 b/src/lib/libcrypto/man/ASN1_item_d2i.3 new file mode 100644 index 0000000000..52707f017a --- /dev/null +++ b/src/lib/libcrypto/man/ASN1_item_d2i.3 | |||
@@ -0,0 +1,408 @@ | |||
1 | .\" $OpenBSD: ASN1_item_d2i.3,v 1.1 2016/12/24 21:42:29 schwarze Exp $ | ||
2 | .\" OpenSSL doc/man3/d2i_X509.pod b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
3 | .\" | ||
4 | .\" This file is a derived work. | ||
5 | .\" The changes are covered by the following Copyright and license: | ||
6 | .\" | ||
7 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | ||
8 | .\" | ||
9 | .\" Permission to use, copy, modify, and distribute this software for any | ||
10 | .\" purpose with or without fee is hereby granted, provided that the above | ||
11 | .\" copyright notice and this permission notice appear in all copies. | ||
12 | .\" | ||
13 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
14 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
15 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
16 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
17 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
18 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
19 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
20 | .\" | ||
21 | .\" The original file was written by Dr. Stephen Henson <steve@openssl.org>. | ||
22 | .\" Copyright (c) 2002, 2003, 2015 The OpenSSL Project. All rights reserved. | ||
23 | .\" | ||
24 | .\" Redistribution and use in source and binary forms, with or without | ||
25 | .\" modification, are permitted provided that the following conditions | ||
26 | .\" are met: | ||
27 | .\" | ||
28 | .\" 1. Redistributions of source code must retain the above copyright | ||
29 | .\" notice, this list of conditions and the following disclaimer. | ||
30 | .\" | ||
31 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
32 | .\" notice, this list of conditions and the following disclaimer in | ||
33 | .\" the documentation and/or other materials provided with the | ||
34 | .\" distribution. | ||
35 | .\" | ||
36 | .\" 3. All advertising materials mentioning features or use of this | ||
37 | .\" software must display the following acknowledgment: | ||
38 | .\" "This product includes software developed by the OpenSSL Project | ||
39 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
40 | .\" | ||
41 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
42 | .\" endorse or promote products derived from this software without | ||
43 | .\" prior written permission. For written permission, please contact | ||
44 | .\" openssl-core@openssl.org. | ||
45 | .\" | ||
46 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
47 | .\" nor may "OpenSSL" appear in their names without prior written | ||
48 | .\" permission of the OpenSSL Project. | ||
49 | .\" | ||
50 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
51 | .\" acknowledgment: | ||
52 | .\" "This product includes software developed by the OpenSSL Project | ||
53 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
54 | .\" | ||
55 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
56 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
57 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
58 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
59 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
60 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
61 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
62 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
63 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
64 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
67 | .\" | ||
68 | .Dd $Mdocdate: December 24 2016 $ | ||
69 | .Dt ASN1_ITEM_D2I 3 | ||
70 | .Os | ||
71 | .Sh NAME | ||
72 | .Nm ASN1_item_d2i , | ||
73 | .Nm ASN1_item_d2i_bio , | ||
74 | .Nm ASN1_item_d2i_fp , | ||
75 | .Nm ASN1_item_i2d , | ||
76 | .Nm ASN1_item_i2d_bio , | ||
77 | .Nm ASN1_item_i2d_fp , | ||
78 | .Nm ASN1_item_dup , | ||
79 | .Nm ASN1_item_print | ||
80 | .Nd decode and encode ASN.1 objects | ||
81 | .Sh SYNOPSIS | ||
82 | .In openssl/asn1.h | ||
83 | .Ft ASN1_VALUE * | ||
84 | .Fo ASN1_item_d2i | ||
85 | .Fa "ASN1_VALUE **val_out" | ||
86 | .Fa "const unsigned char **der_in" | ||
87 | .Fa "long length" | ||
88 | .Fa "const ASN1_ITEM *it" | ||
89 | .Fc | ||
90 | .Ft void * | ||
91 | .Fo ASN1_item_d2i_bio | ||
92 | .Fa "const ASN1_ITEM *it" | ||
93 | .Fa "BIO *in_bio" | ||
94 | .Fa "void *val_out" | ||
95 | .Fc | ||
96 | .Ft void * | ||
97 | .Fo ASN1_item_d2i_fp | ||
98 | .Fa "const ASN1_ITEM *it" | ||
99 | .Fa "FILE *in_fp" | ||
100 | .Fa "void *val_out" | ||
101 | .Fc | ||
102 | .Ft int | ||
103 | .Fo ASN1_item_i2d | ||
104 | .Fa "ASN1_VALUE *val_in" | ||
105 | .Fa "unsigned char **der_out" | ||
106 | .Fa "const ASN1_ITEM *it" | ||
107 | .Fc | ||
108 | .Ft int | ||
109 | .Fo ASN1_item_i2d_bio | ||
110 | .Fa "const ASN1_ITEM *it" | ||
111 | .Fa "BIO *out_bio" | ||
112 | .Fa "void *val_in" | ||
113 | .Fc | ||
114 | .Ft int | ||
115 | .Fo ASN1_item_i2d_fp | ||
116 | .Fa "const ASN1_ITEM *it" | ||
117 | .Fa "FILE *out_fp" | ||
118 | .Fa "void *val_in" | ||
119 | .Fc | ||
120 | .Ft void * | ||
121 | .Fo ASN1_item_dup | ||
122 | .Fa "const ASN1_ITEM *it" | ||
123 | .Fa "void *val_in" | ||
124 | .Fc | ||
125 | .Ft int | ||
126 | .Fo ASN1_item_print | ||
127 | .Fa "BIO *out_bio" | ||
128 | .Fa "ASN1_VALUE *val_in" | ||
129 | .Fa "int indent" | ||
130 | .Fa "const ASN1_ITEM *it" | ||
131 | .Fa "const ASN1_PCTX *pctx" | ||
132 | .Fc | ||
133 | .Sh DESCRIPTION | ||
134 | These functions convert ASN.1 values from their DER encoding to | ||
135 | internal C structures | ||
136 | .Pq Dq d2i | ||
137 | and vice versa | ||
138 | .Pq Dq i2d . | ||
139 | Unlike the C structures which contain pointers to sub-objects, DER | ||
140 | is a serialized encoding, suitable for transfer over the network | ||
141 | and for storage in a file. | ||
142 | .Pp | ||
143 | .Fn ASN1_item_d2i | ||
144 | interpretes | ||
145 | .Pf * Fa der_in | ||
146 | as a DER- or BER-encoded byte array and decodes | ||
147 | .Fa length | ||
148 | bytes. | ||
149 | If successful, | ||
150 | .Pf * Fa der_in | ||
151 | is advanced to the byte following the parsed data. | ||
152 | .Pp | ||
153 | If decoding succeeds and | ||
154 | .Pf * Fa val_out | ||
155 | is | ||
156 | .Dv NULL , | ||
157 | a new object is allocated. | ||
158 | .Pp | ||
159 | If decoding succeeds and | ||
160 | .Pf * Fa val_out | ||
161 | is not | ||
162 | .Dv NULL , | ||
163 | it is assumed to point to a valid populated object and an attempt | ||
164 | is made to reuse it. | ||
165 | It must not be an empty structure such as one returned by | ||
166 | .Xr ASN1_item_new 3 | ||
167 | or by one of the various type-specific | ||
168 | .Fn *_new | ||
169 | functions. | ||
170 | This | ||
171 | .Dq reuse | ||
172 | capability is present for backward compatibility, but its use is | ||
173 | strongly discouraged; see the | ||
174 | .Sx BUGS | ||
175 | section below. | ||
176 | .Pp | ||
177 | .Fn ASN1_item_d2i_bio | ||
178 | and | ||
179 | .Fn ASN1_item_d2i_fp | ||
180 | are similar to | ||
181 | .Fn ASN1_item_d2i | ||
182 | except that they read from a | ||
183 | .Vt BIO | ||
184 | or | ||
185 | .Vt FILE , | ||
186 | respectively. | ||
187 | .Pp | ||
188 | .Fn ASN1_item_i2d | ||
189 | encodes the object pointed to by | ||
190 | .Fa val_in | ||
191 | into DER format. | ||
192 | If | ||
193 | .Fa der_out | ||
194 | is not | ||
195 | .Dv NULL , | ||
196 | it writes the DER-encoded data to the buffer at | ||
197 | .Pf * Fa der_out | ||
198 | and increments it to point after the data just written. | ||
199 | .Pp | ||
200 | If | ||
201 | .Pf * Fa der_out | ||
202 | is | ||
203 | .Dv NULL , | ||
204 | memory is allocated for a buffer, and | ||
205 | .Pf * Fa der_out | ||
206 | is not incremented, but points to the start of the data just written. | ||
207 | .Pp | ||
208 | .Fn ASN1_item_i2d_bio | ||
209 | and | ||
210 | .Fn ASN1_item_i2d_fp | ||
211 | are similar to | ||
212 | .Fn ASN1_item_i2d | ||
213 | except that they write to a | ||
214 | .Vt BIO | ||
215 | or | ||
216 | .Vt FILE , | ||
217 | respectively. | ||
218 | .Pp | ||
219 | .Fn ASN1_item_dup | ||
220 | creates a deep copy of | ||
221 | .Fa val_in | ||
222 | by calling | ||
223 | .Fn ASN1_item_i2d | ||
224 | and | ||
225 | .Fn ASN1_item_d2i . | ||
226 | .Sh RETURN VALUES | ||
227 | If succesful, | ||
228 | .Fn ASN1_item_d2i , | ||
229 | .Fn ASN1_item_d2i_bio , | ||
230 | and | ||
231 | .Fn ASN1_item_d2i_fp | ||
232 | return a pointer to the decoded ASN.1 value. | ||
233 | In addition, if | ||
234 | .Fa val_out | ||
235 | is not | ||
236 | .Dv NULL , | ||
237 | the pointer is also written to | ||
238 | .Pf * Fa val_out. | ||
239 | If an error occurs, | ||
240 | .Dv NULL | ||
241 | is returned. | ||
242 | .Pp | ||
243 | .Fn ASN1_item_i2d | ||
244 | returns the number of bytes written | ||
245 | or a negative value if an error occurs. | ||
246 | .Pp | ||
247 | .Fn ASN1_item_i2d_bio | ||
248 | and | ||
249 | .Fn ASN1_item_i2d_fp | ||
250 | return 1 for success or 0 for failure. | ||
251 | .Pp | ||
252 | .Fn ASN1_item_dup | ||
253 | returns the new | ||
254 | .Vt ASN1_VALUE | ||
255 | object or | ||
256 | .Dv NULL | ||
257 | if an error occurs. | ||
258 | .Sh EXAMPLES | ||
259 | Many type-specific wrapper functions exist. | ||
260 | Using those wrappers is recommended in application code | ||
261 | because it restores part of the type safety that the low-level | ||
262 | interfaces described in the present manual page lack. | ||
263 | .Pp | ||
264 | For example, to allocate a buffer and write the DER encoding of an | ||
265 | .Vt X509 | ||
266 | object into it: | ||
267 | .Bd -literal -offset indent | ||
268 | X509 *x; | ||
269 | unsigned char *buf; | ||
270 | int len; | ||
271 | |||
272 | buf = NULL; | ||
273 | len = i2d_X509(x, &buf); | ||
274 | if (len < 0) | ||
275 | /* error */ | ||
276 | .Ed | ||
277 | .Pp | ||
278 | Attempt to decode a buffer: | ||
279 | .Bd -literal -offset indent | ||
280 | X509 *x; | ||
281 | unsigned char *buf, *p; | ||
282 | int len; | ||
283 | |||
284 | /* Set up buf and len to point to the input buffer. */ | ||
285 | p = buf; | ||
286 | x = d2i_X509(NULL, &p, len); | ||
287 | if (x == NULL) | ||
288 | /* error */ | ||
289 | .Ed | ||
290 | .Pp | ||
291 | Equivalent technique: | ||
292 | .Bd -literal -offset indent | ||
293 | X509 *x; | ||
294 | unsigned char *buf, *p; | ||
295 | int len; | ||
296 | |||
297 | /* Set up buf and len to point to the input buffer. */ | ||
298 | p = buf; | ||
299 | x = NULL; | ||
300 | |||
301 | if (d2i_X509(&x, &p, len) == NULL) | ||
302 | /* error */ | ||
303 | .Ed | ||
304 | .Sh SEE ALSO | ||
305 | .Xr ASN1_item_new 3 | ||
306 | .Sh CAVEATS | ||
307 | If the type described by | ||
308 | .Fa it | ||
309 | fails to match the true type of | ||
310 | .Fa val_in | ||
311 | or | ||
312 | .Pf * Fa val_out , | ||
313 | buffer overflows and segmentation faults are likely to occur. | ||
314 | For more details about why the type | ||
315 | .Vt ASN1_VALUE | ||
316 | constitutes dangerous user interface design, see | ||
317 | .Xr ASN1_item_new 3 . | ||
318 | .Pp | ||
319 | The encoded data is in binary form and may contain embedded NUL bytes. | ||
320 | Functions such as | ||
321 | .Xr strlen 3 | ||
322 | will not return the correct length of the encoded data. | ||
323 | .Pp | ||
324 | While the way that | ||
325 | .Pf * Fa der_in | ||
326 | and | ||
327 | .Pf * Fa der_out | ||
328 | are incremented after the operation supports the typical usage | ||
329 | patterns of reading or writing one object after another, this | ||
330 | behaviour can trap the unwary. | ||
331 | .Pp | ||
332 | Using a temporary pointer into the buffer is mandatory. | ||
333 | A common mistake is to attempt to use a buffer directly as follows: | ||
334 | .Bd -literal -offset indent | ||
335 | X509 *x; | ||
336 | unsigned char *buf; | ||
337 | int len; | ||
338 | |||
339 | len = i2d_X509(x, NULL); | ||
340 | buf = malloc(len); | ||
341 | i2d_X509(x, &buf); | ||
342 | /* do something with buf[] */ | ||
343 | free(buf); | ||
344 | .Ed | ||
345 | .Pp | ||
346 | This code will result in | ||
347 | .Va buf | ||
348 | apparently containing garbage because it was incremented during | ||
349 | .Fn i2d_X509 | ||
350 | to point after the data just written. | ||
351 | Also | ||
352 | .Va buf | ||
353 | will no longer contain the pointer allocated by | ||
354 | .Xr malloc 3 | ||
355 | and the subsequent call to | ||
356 | .Xr free 3 | ||
357 | is likely to crash. | ||
358 | .Pp | ||
359 | Another trap to avoid is misuse of the | ||
360 | .Fa val_out | ||
361 | argument: | ||
362 | .Bd -literal -offset indent | ||
363 | X509 *x; | ||
364 | |||
365 | if (d2i_X509(&x, &p, len) == NULL) | ||
366 | /* error */ | ||
367 | .Ed | ||
368 | .Pp | ||
369 | This will probably crash somewhere in | ||
370 | .Fn d2i_X509 | ||
371 | because | ||
372 | .Va x | ||
373 | is uninitialized and an attempt will be made to interpret its invalid | ||
374 | content as an | ||
375 | .Vt X509 | ||
376 | object, typically causing a segmentation violation. | ||
377 | If | ||
378 | .Va x | ||
379 | is set to | ||
380 | .Dv NULL | ||
381 | first, then this will not happen. | ||
382 | .Sh BUGS | ||
383 | If the | ||
384 | .Dq reuse | ||
385 | capability is used, a valid object is passed in via | ||
386 | .Pf * Fa val_out , | ||
387 | and an error occurs, then the object is not freed and may be left | ||
388 | in an invalid or inconsistent state. | ||
389 | .Pp | ||
390 | In some versions of OpenSSL, the | ||
391 | .Dq reuse | ||
392 | behaviour is broken such that some parts of the reused object may | ||
393 | persist if they are not present in the new one. | ||
394 | .Pp | ||
395 | In many versions of OpenSSL, | ||
396 | .Fn ASN1_item_i2d | ||
397 | will not return an error if mandatory fields are not initialized | ||
398 | due to a programming error. | ||
399 | In that case, the encoded structure may contain invalid data and | ||
400 | some fields may be missing entirely, such that trying to parse it | ||
401 | with | ||
402 | .Fn ASN1_item_d2i | ||
403 | may fail. | ||
404 | .Pp | ||
405 | Any function which encodes an object may return a stale encoding | ||
406 | if the object has been modified after deserialization or previous | ||
407 | serialization. | ||
408 | This is because some objects cache the encoding for efficiency reasons. | ||
diff --git a/src/lib/libcrypto/man/ASN1_item_new.3 b/src/lib/libcrypto/man/ASN1_item_new.3 new file mode 100644 index 0000000000..0444bbe15a --- /dev/null +++ b/src/lib/libcrypto/man/ASN1_item_new.3 | |||
@@ -0,0 +1,103 @@ | |||
1 | .\" $OpenBSD: ASN1_item_new.3,v 1.1 2016/12/24 21:42:29 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: December 24 2016 $ | ||
18 | .Dt ASN1_ITEM_NEW 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm ASN1_item_new , | ||
22 | .Nm ASN1_item_free | ||
23 | .Nd generic ASN.1 value constructor and destructor | ||
24 | .Sh SYNOPSIS | ||
25 | .In openssl/asn1.h | ||
26 | .Ft ASN1_VALUE * | ||
27 | .Fo ASN1_item_new | ||
28 | .Fa "const ASN1_ITEM *it" | ||
29 | .Fc | ||
30 | .Ft void | ||
31 | .Fo ASN1_item_free | ||
32 | .Fa "ASN1_VALUE *val_in" | ||
33 | .Fa "const ASN1_ITEM *it" | ||
34 | .Fc | ||
35 | .Sh DESCRIPTION | ||
36 | .Fn ASN1_item_new | ||
37 | allocates and initializes an empty ASN.1 value | ||
38 | of the type described by the global static object | ||
39 | .Fa it . | ||
40 | .Pp | ||
41 | .Fn ASN1_item_free | ||
42 | frees an ASN.1 value of the type described by | ||
43 | .Fa it . | ||
44 | If the true type of | ||
45 | .Fa val_in | ||
46 | fails to match the specified | ||
47 | .Fa it , | ||
48 | buffer overflows and segmentation faults are likely to occur. | ||
49 | It is not possible to recover the type of an | ||
50 | .Vt ASN1_VALUE | ||
51 | object by inspecting it; the type always needs to be remembered | ||
52 | separately. | ||
53 | .Pp | ||
54 | .Vt ASN1_VALUE | ||
55 | is an incomplete type, and pointers to it always require casting | ||
56 | to the correct complete type before they can be dereferenced. | ||
57 | For all practical purposes, a pointer to | ||
58 | .Vt ASN1_VALUE | ||
59 | is equivalent to a | ||
60 | .Vt void | ||
61 | pointer. | ||
62 | .Pp | ||
63 | Depending on | ||
64 | .Fa it , | ||
65 | there are more than 150 different types that | ||
66 | .Fn ASN1_item_new | ||
67 | may return. | ||
68 | Most of them are pointers to structures or pointers to arrays of | ||
69 | structures, but there are a few exceptions, for example: | ||
70 | If | ||
71 | .Fa it | ||
72 | is | ||
73 | .Dv ASN1_NULL_it , | ||
74 | .Fn ASN1_item_new | ||
75 | returns a specific invalid pointer representing the unique | ||
76 | .Vt ASN1_NULL | ||
77 | object. | ||
78 | If | ||
79 | .Fa it | ||
80 | is | ||
81 | .Dv ASN1_BOOLEAN_it | ||
82 | or | ||
83 | .Dv LONG_it , | ||
84 | .Fn ASN1_item_new | ||
85 | does not return a pointer at all, but a | ||
86 | .Vt long | ||
87 | value cast to | ||
88 | .Vt ASN1_VALUE * . | ||
89 | .Sh RETURN VALUES | ||
90 | .Fn ASN1_item_new | ||
91 | returns the new | ||
92 | .Vt ASN1_VALUE | ||
93 | object or | ||
94 | .Dv NULL | ||
95 | if an error occurs. | ||
96 | .Sh SEE ALSO | ||
97 | .Xr ASN1_item_d2i 3 , | ||
98 | .Xr OBJ_nid2obj 3 | ||
99 | .Sh BUGS | ||
100 | The | ||
101 | .Vt ASN1_VALUE | ||
102 | type compromises type safety and invites programming mistakes that | ||
103 | will typically have severe consequences. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 7d013ab44b..a7d1d9a7e6 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.100 2016/12/24 01:00:48 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.101 2016/12/24 21:42:30 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -11,6 +11,8 @@ MAN= \ | |||
11 | ASN1_TIME_set.3 \ | 11 | ASN1_TIME_set.3 \ |
12 | ASN1_TYPE_get.3 \ | 12 | ASN1_TYPE_get.3 \ |
13 | ASN1_generate_nconf.3 \ | 13 | ASN1_generate_nconf.3 \ |
14 | ASN1_item_d2i.3 \ | ||
15 | ASN1_item_new.3 \ | ||
14 | ASN1_time_parse.3 \ | 16 | ASN1_time_parse.3 \ |
15 | AUTHORITY_KEYID_new.3 \ | 17 | AUTHORITY_KEYID_new.3 \ |
16 | BASIC_CONSTRAINTS_new.3 \ | 18 | BASIC_CONSTRAINTS_new.3 \ |