diff options
author | schwarze <> | 2016-12-29 17:42:54 +0000 |
---|---|---|
committer | schwarze <> | 2016-12-29 17:42:54 +0000 |
commit | 7781532a7e07551fc711f0c428ef7e10c94c290d (patch) | |
tree | a26479fd9a167a31fb644c2e1751b1b81c7e7d4c | |
parent | c676033a384662fb10e10ac441942e4d0a902014 (diff) | |
download | openbsd-7781532a7e07551fc711f0c428ef7e10c94c290d.tar.gz openbsd-7781532a7e07551fc711f0c428ef7e10c94c290d.tar.bz2 openbsd-7781532a7e07551fc711f0c428ef7e10c94c290d.zip |
Write d2i_ASN1_NULL(3) manual page from scratch.
Both functions are listed in <openssl/asn1.h>
and in OpenSSL doc/man3/d2i_X509.pod.
After reading the code, i'm not amused. You wouldn't think that
it might take eight stack levels to decode a constant sixteen bit
value that does not even allow a single content octet, or would
you? Nota bene, this is an average of four stack levels for each
non-zero bit decoded... :-(
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/d2i_ASN1_NULL.3 | 84 |
2 files changed, 86 insertions, 1 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 6065762acd..c6443f3e3f 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.108 2016/12/28 20:36:33 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.109 2016/12/29 17:42:54 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -227,6 +227,7 @@ MAN= \ | |||
227 | X509_verify_cert.3 \ | 227 | X509_verify_cert.3 \ |
228 | X509v3_get_ext_by_NID.3 \ | 228 | X509v3_get_ext_by_NID.3 \ |
229 | crypto.3 \ | 229 | crypto.3 \ |
230 | d2i_ASN1_NULL.3 \ | ||
230 | d2i_ASN1_OBJECT.3 \ | 231 | d2i_ASN1_OBJECT.3 \ |
231 | d2i_AUTHORITY_KEYID.3 \ | 232 | d2i_AUTHORITY_KEYID.3 \ |
232 | d2i_BASIC_CONSTRAINTS.3 \ | 233 | d2i_BASIC_CONSTRAINTS.3 \ |
diff --git a/src/lib/libcrypto/man/d2i_ASN1_NULL.3 b/src/lib/libcrypto/man/d2i_ASN1_NULL.3 new file mode 100644 index 0000000000..8efcee69f3 --- /dev/null +++ b/src/lib/libcrypto/man/d2i_ASN1_NULL.3 | |||
@@ -0,0 +1,84 @@ | |||
1 | .\" $OpenBSD: d2i_ASN1_NULL.3,v 1.1 2016/12/29 17:42:54 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 29 2016 $ | ||
18 | .Dt D2I_ASN1_NULL 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm d2i_ASN1_NULL , | ||
22 | .Nm i2d_ASN1_NULL | ||
23 | .Nd decode and encode an ASN.1 NULL type | ||
24 | .Sh SYNOPSIS | ||
25 | .In openssl/asn1.h | ||
26 | .Ft ASN1_NULL * | ||
27 | .Fo d2i_ASN1_NULL | ||
28 | .Fa "ASN1_NULL **val_out" | ||
29 | .Fa "const unsigned char **der_in" | ||
30 | .Fa "long length" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo i2d_ASN1_NULL | ||
34 | .Fa "ASN1_NULL *val_in" | ||
35 | .Fa "unsigned char **der_out" | ||
36 | .Fc | ||
37 | .Sh DESCRIPTION | ||
38 | These functions decode and encode the ASN.1 value NULL of type NULL. | ||
39 | For details about the semantics, examples, caveats, and bugs, see | ||
40 | .Xr ASN1_item_d2i 3 . | ||
41 | .Pp | ||
42 | .Fn d2i_ASN1_NULL | ||
43 | verifies that the BER-encoded value at | ||
44 | .Pf * Fa der_in | ||
45 | is NULL and of type NULL. | ||
46 | It fails if | ||
47 | .Fa length | ||
48 | is less than 2 or if the first two bytes of | ||
49 | .Pf * Fa der_in | ||
50 | differ from 0x05 and 0x00. | ||
51 | In case of success, | ||
52 | .Pf * Fa der_in | ||
53 | is advanced by two bytes and | ||
54 | .Pf * Fa val_out | ||
55 | is set to a specific invalid pointer representing the unique | ||
56 | .Vt ASN1_NULL | ||
57 | object. | ||
58 | .Pp | ||
59 | .Fn i2d_ASN1_NULL | ||
60 | ignores | ||
61 | .Fa val_in | ||
62 | and encodes the ASN.1 value NULL of type NULL using DER. | ||
63 | Specifically, it writes the identifier octet for the type NULL, | ||
64 | 0x05, followed by the length octet 0x00, and no content or | ||
65 | end-of-content octets. | ||
66 | .Sh RETURN VALUES | ||
67 | .Fn d2i_ASN1_NULL | ||
68 | returns a specific invalid pointer representing the unique | ||
69 | .Vt ASN1_NULL | ||
70 | object or | ||
71 | .Dv NULL | ||
72 | if an error occurs. | ||
73 | .Pp | ||
74 | .Fn i2d_ASN1_NULL | ||
75 | returns 2 if successful or 0 if an error occurs. | ||
76 | .Sh SEE ALSO | ||
77 | .Xr ASN1_item_d2i 3 , | ||
78 | .Xr ASN1_item_new 3 | ||
79 | .Sh STANDARDS | ||
80 | ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: | ||
81 | Information technology - ASN.1 encoding rules: | ||
82 | Specification of Basic Encoding Rules (BER), Canonical Encoding | ||
83 | Rules (CER) and Distinguished Encoding Rules (DER), | ||
84 | section 8.8: Encoding of null value | ||