diff options
author | schwarze <> | 2021-11-15 10:41:11 +0000 |
---|---|---|
committer | schwarze <> | 2021-11-15 10:41:11 +0000 |
commit | ad83e141cc258e6ba6fb7328d224c613a3cc0510 (patch) | |
tree | 2db8975eae235499c4ae7b5113c7e7a2d0b8e558 /src/lib | |
parent | a4c3c5d1a6bfbff90627fab679b764de5a8028cf (diff) | |
download | openbsd-ad83e141cc258e6ba6fb7328d224c613a3cc0510.tar.gz openbsd-ad83e141cc258e6ba6fb7328d224c613a3cc0510.tar.bz2 openbsd-ad83e141cc258e6ba6fb7328d224c613a3cc0510.zip |
document i2a_ASN1_STRING(3) and a2i_ASN1_STRING(3)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_STRING_new.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/i2a_ASN1_STRING.3 | 158 |
3 files changed, 163 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_new.3 b/src/lib/libcrypto/man/ASN1_STRING_new.3 index ce2e9fdc68..54c5f7163f 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_new.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ASN1_STRING_new.3,v 1.18 2021/10/20 13:14:00 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_new.3,v 1.19 2021/11/15 10:41:11 schwarze Exp $ |
2 | .\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 | 2 | .\" OpenSSL 99d63d46 Tue Mar 24 07:52:24 2015 -0400 |
3 | .\" | 3 | .\" |
4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> | 4 | .\" Copyright (c) 2017 Ingo Schwarze <schwarze@openbsd.org> |
@@ -15,7 +15,7 @@ | |||
15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 15 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 16 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | .\" | 17 | .\" |
18 | .Dd $Mdocdate: October 20 2021 $ | 18 | .Dd $Mdocdate: November 15 2021 $ |
19 | .Dt ASN1_STRING_NEW 3 | 19 | .Dt ASN1_STRING_NEW 3 |
20 | .Os | 20 | .Os |
21 | .Sh NAME | 21 | .Sh NAME |
@@ -212,6 +212,7 @@ is returned and an error code can be retrieved with | |||
212 | .Xr ASN1_TYPE_get 3 , | 212 | .Xr ASN1_TYPE_get 3 , |
213 | .Xr d2i_ASN1_OBJECT 3 , | 213 | .Xr d2i_ASN1_OBJECT 3 , |
214 | .Xr d2i_ASN1_OCTET_STRING 3 , | 214 | .Xr d2i_ASN1_OCTET_STRING 3 , |
215 | .Xr i2a_ASN1_STRING 3 , | ||
215 | .Xr X509_cmp_time 3 , | 216 | .Xr X509_cmp_time 3 , |
216 | .Xr X509_EXTENSION_get_object 3 , | 217 | .Xr X509_EXTENSION_get_object 3 , |
217 | .Xr X509_get_ext_by_OBJ 3 , | 218 | .Xr X509_get_ext_by_OBJ 3 , |
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 4a22484ea3..a1e1c97b81 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.211 2021/11/11 12:06:25 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.212 2021/11/15 10:41:11 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -398,6 +398,7 @@ MAN= \ | |||
398 | des_read_pw.3 \ | 398 | des_read_pw.3 \ |
399 | evp.3 \ | 399 | evp.3 \ |
400 | get_rfc3526_prime_8192.3 \ | 400 | get_rfc3526_prime_8192.3 \ |
401 | i2a_ASN1_STRING.3 \ | ||
401 | i2d_CMS_bio_stream.3 \ | 402 | i2d_CMS_bio_stream.3 \ |
402 | i2d_PKCS7_bio_stream.3 \ | 403 | i2d_PKCS7_bio_stream.3 \ |
403 | lh_new.3 \ | 404 | lh_new.3 \ |
diff --git a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 new file mode 100644 index 0000000000..fa5f071c14 --- /dev/null +++ b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 | |||
@@ -0,0 +1,158 @@ | |||
1 | .\" $OpenBSD: i2a_ASN1_STRING.3,v 1.1 2021/11/15 10:41:11 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: November 15 2021 $ | ||
18 | .Dt I2A_ASN1_STRING 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm i2a_ASN1_STRING , | ||
22 | .Nm a2i_ASN1_STRING | ||
23 | .Nd hexadecimal dump of an ASN.1 string | ||
24 | .Sh SYNOPSIS | ||
25 | .In openssl/asn1.h | ||
26 | .Ft int | ||
27 | .Fo i2a_ASN1_STRING | ||
28 | .Fa "BIO *out_bio" | ||
29 | .Fa "const ASN1_STRING *a" | ||
30 | .Fa "int type" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo a2i_ASN1_STRING | ||
34 | .Fa "BIO *in_bio" | ||
35 | .Fa "ASN1_STRING *out_string" | ||
36 | .Fa "char *buffer" | ||
37 | .Fa "int size" | ||
38 | .Fc | ||
39 | .Sh DESCRIPTION | ||
40 | The function | ||
41 | .Fn i2a_ASN1_STRING | ||
42 | writes a hexadecimal representation of | ||
43 | .Fa a | ||
44 | to | ||
45 | .Fa out_bio . | ||
46 | The | ||
47 | .Fa type | ||
48 | argument is ignored. | ||
49 | .Pp | ||
50 | Each byte of | ||
51 | .Xr ASN1_STRING_get0_data 3 | ||
52 | is written as a number consisting of two upper-case hexadecimal digits. | ||
53 | After each group of 70 digits, a backslash and a linefeed | ||
54 | are inserted before the next digit. | ||
55 | .Pp | ||
56 | If the | ||
57 | .Xr ASN1_STRING_length 3 | ||
58 | of | ||
59 | .Fa a | ||
60 | is 0, the single digit | ||
61 | .Ql 0 | ||
62 | is written instead. | ||
63 | If | ||
64 | .Fa a | ||
65 | is a | ||
66 | .Dv NULL | ||
67 | pointer, nothing is written. | ||
68 | .Pp | ||
69 | The function | ||
70 | .Fn a2i_ASN1_STRING | ||
71 | parses a hexadecimal representation of an ASN.1 string into | ||
72 | .Fa out_string . | ||
73 | Both lower-case and upper-case hexadecimal digits are accepted. | ||
74 | Every pair of input digits is converted into one output byte. | ||
75 | At least one pair of input digits is required. | ||
76 | .Pp | ||
77 | On every input line, the trailing newline character and an optional | ||
78 | carrier return character character preceding it are ignored. | ||
79 | The trailing newline need not be present on the last line. | ||
80 | If there is a backslash character before the newline character, | ||
81 | parsing is continued on the next input line. | ||
82 | In particular, | ||
83 | .Fn a2i_ASN1_STRING | ||
84 | is able to parse the output of | ||
85 | .Fn i2a_ASN1_STRING | ||
86 | except when the | ||
87 | .Xr ASN1_STRING_length 3 | ||
88 | of | ||
89 | .Fa a | ||
90 | was 0. | ||
91 | .Pp | ||
92 | Parsing fails if an input line contains an odd number of input | ||
93 | digits or if memory allocation fails. | ||
94 | .Pp | ||
95 | This function uses the | ||
96 | .Fa buffer | ||
97 | provided by the caller and assumes it is at least | ||
98 | .Fa size | ||
99 | bytes long. | ||
100 | It is unspecified what the buffer contains after the function returns. | ||
101 | .Sh RETURN VALUES | ||
102 | The function | ||
103 | .Fn i2a_ASN1_STRING | ||
104 | returns the number of bytes written or \-1 if | ||
105 | .Xr BIO_write 3 | ||
106 | fails. | ||
107 | .Pp | ||
108 | The function | ||
109 | .Fn a2i_ASN1_STRING | ||
110 | is intended to return 1 for success or 0 for failure, but see the | ||
111 | .Sx BUGS | ||
112 | section for a number of traps. | ||
113 | .Sh SEE ALSO | ||
114 | .Xr ASN1_STRING_length 3 , | ||
115 | .Xr ASN1_STRING_new 3 , | ||
116 | .Xr ASN1_STRING_print_ex 3 , | ||
117 | .Xr i2a_ASN1_INTEGER 3 , | ||
118 | .Xr i2a_ASN1_OBJECT 3 | ||
119 | .Sh HISTORY | ||
120 | These functions first appeared in SSLeay 0.6.5. | ||
121 | The function | ||
122 | .Fn a2i_ASN1_STRING | ||
123 | has been part of the public API since SSLeay 0.6.5 and | ||
124 | .Fn i2a_ASN1_STRING | ||
125 | since SSLeay 0.8.0. | ||
126 | They have been available since | ||
127 | .Ox 2.4 . | ||
128 | .Sh BUGS | ||
129 | If the first call to | ||
130 | .Xr BIO_gets 3 | ||
131 | does not return any data, even if that is caused by a fatal I/O error, | ||
132 | if the BIO type does not support the | ||
133 | .Dq gets | ||
134 | operation, or if it is caused by the BIO being non-blocking, | ||
135 | .Fn a2i_ASN1_STRING | ||
136 | immediately succeeds and returns an empty | ||
137 | .Fa out_string . | ||
138 | .Pp | ||
139 | If | ||
140 | .Fn BIO_gets 3 | ||
141 | returns a partial line, for example because the given | ||
142 | .Fa size | ||
143 | is insufficient to contain one of the input lines | ||
144 | or for reasons specific to the BIO type, | ||
145 | .Fn a2i_ASN1_STRING | ||
146 | may fail or silently return a truncated result. | ||
147 | The caller is responsible for providing a | ||
148 | .Fa buffer | ||
149 | of sufficient size to contain the longest possible input line | ||
150 | and for choosing a BIO of a type that only returns complete | ||
151 | input lines and does not perform partial reads. | ||
152 | .Pp | ||
153 | The function | ||
154 | .Fn a2i_ASN1_STRING | ||
155 | does not support non-blocking BIOs. | ||
156 | Reading is terminated as soon as | ||
157 | .Xr BIO_gets 3 | ||
158 | returns a value less than 1. | ||