diff options
| author | schwarze <> | 2021-07-11 19:03:45 +0000 |
|---|---|---|
| committer | schwarze <> | 2021-07-11 19:03:45 +0000 |
| commit | 50cf9b8627997e8f4afdd30db8b001d2a0a24e49 (patch) | |
| tree | bd52a4263ef995e390ec84a472870e94b5ab44d9 /src | |
| parent | 8382da87d2675e27bf4e94fb49c63feb542df36f (diff) | |
| download | openbsd-50cf9b8627997e8f4afdd30db8b001d2a0a24e49.tar.gz openbsd-50cf9b8627997e8f4afdd30db8b001d2a0a24e49.tar.bz2 openbsd-50cf9b8627997e8f4afdd30db8b001d2a0a24e49.zip | |
new manual page ASN1_parse_dump(3)
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_STRING_print_ex.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_TYPE_get.3 | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_get_object.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/ASN1_parse_dump.3 | 210 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 |
5 files changed, 222 insertions, 7 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 index 43673bc0f7..2d48a42c4d 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_print_ex.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.16 2021/07/06 16:05:44 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_print_ex.3,v 1.17 2021/07/11 19:03:45 schwarze Exp $ |
| 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 | 2 | .\" full merge up to: OpenSSL bb9ad09e Jun 6 00:43:05 2016 -0400 |
| 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 | 3 | .\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800 |
| 4 | .\" | 4 | .\" |
| @@ -50,7 +50,7 @@ | |||
| 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 52 | .\" | 52 | .\" |
| 53 | .Dd $Mdocdate: July 6 2021 $ | 53 | .Dd $Mdocdate: July 11 2021 $ |
| 54 | .Dt ASN1_STRING_PRINT_EX 3 | 54 | .Dt ASN1_STRING_PRINT_EX 3 |
| 55 | .Os | 55 | .Os |
| 56 | .Sh NAME | 56 | .Sh NAME |
| @@ -220,6 +220,7 @@ returns 1 on success or 0 on error. | |||
| 220 | .Fn ASN1_tag2str | 220 | .Fn ASN1_tag2str |
| 221 | returns a static string. | 221 | returns a static string. |
| 222 | .Sh SEE ALSO | 222 | .Sh SEE ALSO |
| 223 | .Xr ASN1_parse_dump 3 , | ||
| 223 | .Xr ASN1_STRING_new 3 , | 224 | .Xr ASN1_STRING_new 3 , |
| 224 | .Xr X509_NAME_print_ex 3 , | 225 | .Xr X509_NAME_print_ex 3 , |
| 225 | .Xr X509_signature_dump 3 | 226 | .Xr X509_signature_dump 3 |
diff --git a/src/lib/libcrypto/man/ASN1_TYPE_get.3 b/src/lib/libcrypto/man/ASN1_TYPE_get.3 index a31f762335..284ad61b34 100644 --- a/src/lib/libcrypto/man/ASN1_TYPE_get.3 +++ b/src/lib/libcrypto/man/ASN1_TYPE_get.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.11 2019/08/26 11:41:31 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_TYPE_get.3,v 1.12 2021/07/11 19:03:45 schwarze Exp $ |
| 2 | .\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 | 2 | .\" OpenSSL 99d63d46 Mon Jun 6 00:43:05 2016 -0400 |
| 3 | .\" | 3 | .\" |
| 4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
| @@ -65,7 +65,7 @@ | |||
| 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
| 67 | .\" | 67 | .\" |
| 68 | .Dd $Mdocdate: August 26 2019 $ | 68 | .Dd $Mdocdate: July 11 2021 $ |
| 69 | .Dt ASN1_TYPE_GET 3 | 69 | .Dt ASN1_TYPE_GET 3 |
| 70 | .Os | 70 | .Os |
| 71 | .Sh NAME | 71 | .Sh NAME |
| @@ -275,8 +275,10 @@ returns 1 if the copying succeeds or 0 if it fails. | |||
| 275 | returns 0 for a match or non-zero for a mismatch. | 275 | returns 0 for a match or non-zero for a mismatch. |
| 276 | .Sh SEE ALSO | 276 | .Sh SEE ALSO |
| 277 | .Xr ASN1_generate_nconf 3 , | 277 | .Xr ASN1_generate_nconf 3 , |
| 278 | .Xr ASN1_get_object 3 , | ||
| 278 | .Xr ASN1_item_free 3 , | 279 | .Xr ASN1_item_free 3 , |
| 279 | .Xr ASN1_OBJECT_new 3 , | 280 | .Xr ASN1_OBJECT_new 3 , |
| 281 | .Xr ASN1_parse_dump 3 , | ||
| 280 | .Xr ASN1_put_object 3 , | 282 | .Xr ASN1_put_object 3 , |
| 281 | .Xr ASN1_STRING_dup 3 , | 283 | .Xr ASN1_STRING_dup 3 , |
| 282 | .Xr ASN1_STRING_new 3 , | 284 | .Xr ASN1_STRING_new 3 , |
diff --git a/src/lib/libcrypto/man/ASN1_get_object.3 b/src/lib/libcrypto/man/ASN1_get_object.3 index a6dc288a06..781b12ad5a 100644 --- a/src/lib/libcrypto/man/ASN1_get_object.3 +++ b/src/lib/libcrypto/man/ASN1_get_object.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: ASN1_get_object.3,v 1.1 2021/07/11 15:30:21 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_get_object.3,v 1.2 2021/07/11 19:03:45 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -181,7 +181,8 @@ argument was too small. | |||
| 181 | .El | 181 | .El |
| 182 | .Sh SEE ALSO | 182 | .Sh SEE ALSO |
| 183 | .Xr ASN1_item_d2i 3 , | 183 | .Xr ASN1_item_d2i 3 , |
| 184 | .Xr ASN1_item_new 3 | 184 | .Xr ASN1_item_new 3 , |
| 185 | .Xr ASN1_parse_dump 3 | ||
| 185 | .Sh STANDARDS | 186 | .Sh STANDARDS |
| 186 | ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: | 187 | ITU-T Recommendation X.690, also known as ISO/IEC 8825-1: |
| 187 | Information technology - ASN.1 encoding rules: | 188 | Information technology - ASN.1 encoding rules: |
diff --git a/src/lib/libcrypto/man/ASN1_parse_dump.3 b/src/lib/libcrypto/man/ASN1_parse_dump.3 new file mode 100644 index 0000000000..240d2d338e --- /dev/null +++ b/src/lib/libcrypto/man/ASN1_parse_dump.3 | |||
| @@ -0,0 +1,210 @@ | |||
| 1 | .\" $OpenBSD: ASN1_parse_dump.3,v 1.1 2021/07/11 19:03:45 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 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: July 11 2021 $ | ||
| 18 | .Dt ASN1_PARSE_DUMP 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm ASN1_parse_dump , | ||
| 22 | .Nm ASN1_parse | ||
| 23 | .Nd parse BER and print information about it | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .In openssl/asn1.h | ||
| 26 | .Ft int | ||
| 27 | .Fo ASN1_parse_dump | ||
| 28 | .Fa "BIO *bio" | ||
| 29 | .Fa "const unsigned char *ber_in" | ||
| 30 | .Fa "long length" | ||
| 31 | .Fa "int indent" | ||
| 32 | .Fa "int dump" | ||
| 33 | .Fc | ||
| 34 | .Ft int | ||
| 35 | .Fo ASN1_parse | ||
| 36 | .Fa "BIO *bio" | ||
| 37 | .Fa "const unsigned char *ber_in" | ||
| 38 | .Fa "long length" | ||
| 39 | .Fa "int indent" | ||
| 40 | .Fc | ||
| 41 | .Sh DESCRIPTION | ||
| 42 | .Fn ASN1_parse_dump | ||
| 43 | parses BER-encoded values and prints information about them to | ||
| 44 | .Fa bio . | ||
| 45 | On function entry, | ||
| 46 | .Pf * Fa ber_in | ||
| 47 | is expected to point to the first identifier octet of an encoded value. | ||
| 48 | At most | ||
| 49 | .Fa length | ||
| 50 | bytes are inspected. | ||
| 51 | .Pp | ||
| 52 | For each value successfully parsed, the following information is printed: | ||
| 53 | .Bl -enum | ||
| 54 | .It | ||
| 55 | The index of its first identifier octet relative to | ||
| 56 | .Fa ber_in | ||
| 57 | as a decimal number followed by a colon. | ||
| 58 | For the first value parsed and printed, this is | ||
| 59 | .Qq 0:\& . | ||
| 60 | .It | ||
| 61 | The nesting depth as a decimal integer. | ||
| 62 | For the first value parsed and printed, this is | ||
| 63 | .Qq d=0 . | ||
| 64 | .It | ||
| 65 | The header length in bytes, including the identifier octets and the | ||
| 66 | length octets, as a decimal integer. | ||
| 67 | For example, for a boolean value, this is | ||
| 68 | .Qq hl=2 | ||
| 69 | because the encoding of a boolean value contains | ||
| 70 | one identifier octet (0x01) and one length octet (also 0x01, | ||
| 71 | because one content octet follows after the header). | ||
| 72 | .It | ||
| 73 | If the value is encoded using the definite form for the length octets, | ||
| 74 | the number encoded in the length octets as a decimal integer. | ||
| 75 | This is the number of content octets that follow. | ||
| 76 | For example, for a boolean value, this is | ||
| 77 | .Qq l=1 . | ||
| 78 | If the value is encoded using a length octet indicating the indefinite form, | ||
| 79 | .Qq l=inf | ||
| 80 | is printed instead. | ||
| 81 | .It | ||
| 82 | If the value is primitive, | ||
| 83 | .Qq prim:\& | ||
| 84 | is printed; | ||
| 85 | if it is constructed, | ||
| 86 | .Qq cons:\& . | ||
| 87 | .It | ||
| 88 | The next field depends on the class of the tag: | ||
| 89 | .Bl -tag -width Ds | ||
| 90 | .It Dv V_ASN1_PRIVATE | ||
| 91 | .Qq priv | ||
| 92 | followed by the decimal tag number in square brackets | ||
| 93 | .It Dv V_ASN1_CONTEXT_SPECIFIC | ||
| 94 | .Qq cont | ||
| 95 | followed by the decimal tag number in square brackets | ||
| 96 | .It Dv V_ASN1_APPLICATION | ||
| 97 | .Qq appl | ||
| 98 | followed by the decimal tag number in square brackets | ||
| 99 | .It V_ASN1_UNIVERSAL | ||
| 100 | If the tag number is 30 or less, the return value from | ||
| 101 | .Xr ASN1_tag2str 3 | ||
| 102 | is printed; otherwise, | ||
| 103 | .Qq <ASN1 | ||
| 104 | followed by the decimal tag number and a closing angle bracket. | ||
| 105 | .El | ||
| 106 | .El | ||
| 107 | .Pp | ||
| 108 | For constructed values, the contained values are recursively printed. | ||
| 109 | .Pp | ||
| 110 | Primitive values are processed as follows: | ||
| 111 | .Bl -tag -width Ds | ||
| 112 | .It Dv V_ASN1_BOOLEAN | ||
| 113 | Its integer value is printed as a decimal number. | ||
| 114 | .It Dv V_ASN1_INTEGER | ||
| 115 | Decoded with | ||
| 116 | .Xr d2i_ASN1_INTEGER 3 , | ||
| 117 | printed as a hexadecimal number with an even number of digits. | ||
| 118 | .It Dv V_ASN1_ENUMERATED | ||
| 119 | Decoded with | ||
| 120 | .Xr d2i_ASN1_ENUMERATED 3 , | ||
| 121 | printed as a hexadecimal number with an even number of digits. | ||
| 122 | .It Dv V_ASN1_OBJECT | ||
| 123 | Decoded with | ||
| 124 | .Xr d2i_ASN1_OBJECT 3 , | ||
| 125 | printed with | ||
| 126 | .Xr i2a_ASN1_OBJECT 3 . | ||
| 127 | .It Dv V_ASN1_OCTET_STRING | ||
| 128 | Decoded with | ||
| 129 | .Xr d2i_ASN1_OCTET_STRING 3 . | ||
| 130 | If the data consists only of printable ASCII characters, line feeds, | ||
| 131 | carriage returns and horizontal tabs, it is printed as an ASCII string. | ||
| 132 | .Pp | ||
| 133 | Otherwise, the | ||
| 134 | .Fa dump | ||
| 135 | argument decides the format. | ||
| 136 | If it is zero, a raw hex dump is emissed, consisting of two hexadecimal | ||
| 137 | digits for every data byte. | ||
| 138 | If | ||
| 139 | .Fa dump | ||
| 140 | is non-zero, | ||
| 141 | .Xr BIO_dump_indent 3 | ||
| 142 | is used. | ||
| 143 | Unless | ||
| 144 | .Fa dump | ||
| 145 | is \-1, the data is truncated after | ||
| 146 | .Fa dump | ||
| 147 | bytes. | ||
| 148 | .It Dv V_ASN1_PRINTABLESTRING | ||
| 149 | Printed as an ASCII string. | ||
| 150 | The same applies to | ||
| 151 | .Dv V_ASN1_IA5STRING , | ||
| 152 | .Dv V_ASN1_T61STRING , | ||
| 153 | .Dv V_ASN1_NUMERICSTRING , | ||
| 154 | .Dv V_ASN1_VISIBLESTRING , | ||
| 155 | .Dv V_ASN1_UTF8STRING , | ||
| 156 | .Dv V_ASN1_UTCTIME , | ||
| 157 | and | ||
| 158 | .Dv V_ASN1_GENERALIZEDTIME . | ||
| 159 | .It Other tags | ||
| 160 | If the | ||
| 161 | .Fa dump | ||
| 162 | argument is 0, their data is silently ignored. | ||
| 163 | If | ||
| 164 | .Fa dump | ||
| 165 | is non-zero, | ||
| 166 | .Xr BIO_dump_indent 3 | ||
| 167 | is used. | ||
| 168 | Unless | ||
| 169 | .Fa dump | ||
| 170 | is \-1, the data is truncated after | ||
| 171 | .Fa dump | ||
| 172 | bytes. | ||
| 173 | .El | ||
| 174 | .Pp | ||
| 175 | .Fn ASN1_parse | ||
| 176 | is identical to | ||
| 177 | .Fn ASN1_parse_dump | ||
| 178 | woth 0 passed as the | ||
| 179 | .Fa dump | ||
| 180 | argument. | ||
| 181 | .Sh RETURN VALUES | ||
| 182 | These functions return 1 for success or 0 for failure. | ||
| 183 | .Pp | ||
| 184 | In particular, they print an error message to | ||
| 185 | .Fa bio , | ||
| 186 | abort parsing and printing, and return 0 | ||
| 187 | when parsing or decoding fails, when a recursive call fails, | ||
| 188 | when encountering a value extending beyond | ||
| 189 | .Fa length , | ||
| 190 | or when encountering a nesting level in excess of 128. | ||
| 191 | They also abort parsing and printing and return 0 | ||
| 192 | when any printing operation fails. | ||
| 193 | .Sh SEE ALSO | ||
| 194 | .Xr ASN1_get_object 3 , | ||
| 195 | .Xr ASN1_item_d2i 3 , | ||
| 196 | .Xr ASN1_item_new 3 , | ||
| 197 | .Xr ASN1_STRING_print 3 , | ||
| 198 | .Xr ASN1_TYPE_new 3 | ||
| 199 | .Sh HISTORY | ||
| 200 | .Fn ASN1_parse | ||
| 201 | first appeared in SSLeay 0.5.1 and has been available since | ||
| 202 | .Ox 2.4 . | ||
| 203 | .Pp | ||
| 204 | .Fn ASN1_parse_dump | ||
| 205 | first appeared in OpenSSL 0.9.6 and has been available since | ||
| 206 | .Ox 2.9 . | ||
| 207 | .Sh BUGS | ||
| 208 | The content of values tagged as | ||
| 209 | .Dv V_ASN1_BMPSTRING | ||
| 210 | is silently ignored and none of it is printed. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index be22431dc1..f910d81c22 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.177 2021/07/11 15:30:21 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.178 2021/07/11 19:03:45 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -17,6 +17,7 @@ MAN= \ | |||
| 17 | ASN1_get_object.3 \ | 17 | ASN1_get_object.3 \ |
| 18 | ASN1_item_d2i.3 \ | 18 | ASN1_item_d2i.3 \ |
| 19 | ASN1_item_new.3 \ | 19 | ASN1_item_new.3 \ |
| 20 | ASN1_parse_dump.3 \ | ||
| 20 | ASN1_put_object.3 \ | 21 | ASN1_put_object.3 \ |
| 21 | ASN1_time_parse.3 \ | 22 | ASN1_time_parse.3 \ |
| 22 | AUTHORITY_KEYID_new.3 \ | 23 | AUTHORITY_KEYID_new.3 \ |
