diff options
author | schwarze <> | 2021-11-23 13:52:27 +0000 |
---|---|---|
committer | schwarze <> | 2021-11-23 13:52:27 +0000 |
commit | 78eb35459b09366e67f2b74a1cc209dbbd6bc6a8 (patch) | |
tree | 6b70fb9b079c074c39bc178d609a3170041c8f0b /src/lib | |
parent | 3af9d78c8b9e9f755a890250766ee91b89d49302 (diff) | |
download | openbsd-78eb35459b09366e67f2b74a1cc209dbbd6bc6a8.tar.gz openbsd-78eb35459b09366e67f2b74a1cc209dbbd6bc6a8.tar.bz2 openbsd-78eb35459b09366e67f2b74a1cc209dbbd6bc6a8.zip |
document a2i_ASN1_INTEGER(3),
i2a_ASN1_ENUMERATED(3), and a2i_ASN1_ENUMERATED(3)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_INTEGER_get.3 | 41 | ||||
-rw-r--r-- | src/lib/libcrypto/man/i2a_ASN1_STRING.3 | 163 |
2 files changed, 135 insertions, 69 deletions
diff --git a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 index 1ed993efa6..df5a3bc821 100644 --- a/src/lib/libcrypto/man/ASN1_INTEGER_get.3 +++ b/src/lib/libcrypto/man/ASN1_INTEGER_get.3 | |||
@@ -1,11 +1,11 @@ | |||
1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.4 2021/11/20 13:06:26 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_INTEGER_get.3,v 1.5 2021/11/23 13:52:27 schwarze Exp $ |
2 | .\" selective merge up to: | 2 | .\" selective merge up to: |
3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" OpenSSL man3/ASN1_INTEGER_get_int64 24a535ea Sep 22 13:14:20 2020 +0100 |
4 | .\" | 4 | .\" |
5 | .\" This file is a derived work. | 5 | .\" This file is a derived work. |
6 | .\" The changes are covered by the following Copyright and license: | 6 | .\" The changes are covered by the following Copyright and license: |
7 | .\" | 7 | .\" |
8 | .\" Copyright (c) 2018, 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> | 8 | .\" Copyright (c) 2018, 2021 Ingo Schwarze <schwarze@openbsd.org> |
9 | .\" | 9 | .\" |
10 | .\" Permission to use, copy, modify, and distribute this software for any | 10 | .\" Permission to use, copy, modify, and distribute this software for any |
11 | .\" purpose with or without fee is hereby granted, provided that the above | 11 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -66,7 +66,7 @@ | |||
66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 66 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 67 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
68 | .\" | 68 | .\" |
69 | .Dd $Mdocdate: November 20 2021 $ | 69 | .Dd $Mdocdate: November 23 2021 $ |
70 | .Dt ASN1_INTEGER_GET 3 | 70 | .Dt ASN1_INTEGER_GET 3 |
71 | .Os | 71 | .Os |
72 | .Sh NAME | 72 | .Sh NAME |
@@ -76,7 +76,6 @@ | |||
76 | .Nm ASN1_INTEGER_dup , | 76 | .Nm ASN1_INTEGER_dup , |
77 | .Nm BN_to_ASN1_INTEGER , | 77 | .Nm BN_to_ASN1_INTEGER , |
78 | .Nm ASN1_INTEGER_to_BN , | 78 | .Nm ASN1_INTEGER_to_BN , |
79 | .Nm i2a_ASN1_INTEGER , | ||
80 | .Nm ASN1_ENUMERATED_get , | 79 | .Nm ASN1_ENUMERATED_get , |
81 | .Nm ASN1_ENUMERATED_set , | 80 | .Nm ASN1_ENUMERATED_set , |
82 | .Nm BN_to_ASN1_ENUMERATED , | 81 | .Nm BN_to_ASN1_ENUMERATED , |
@@ -112,11 +111,6 @@ | |||
112 | .Fa "const ASN1_INTEGER *ai" | 111 | .Fa "const ASN1_INTEGER *ai" |
113 | .Fa "BIGNUM *bn" | 112 | .Fa "BIGNUM *bn" |
114 | .Fc | 113 | .Fc |
115 | .Ft int | ||
116 | .Fo i2a_ASN1_INTEGER | ||
117 | .Fa "BIO *out_bio" | ||
118 | .Fa "const ASN1_INTEGER *a" | ||
119 | .Fc | ||
120 | .Ft long | 114 | .Ft long |
121 | .Fo ASN1_ENUMERATED_get | 115 | .Fo ASN1_ENUMERATED_get |
122 | .Fa "const ASN1_ENUMERATED *a" | 116 | .Fa "const ASN1_ENUMERATED *a" |
@@ -212,16 +206,6 @@ Otherwise, the existing object | |||
212 | .Fa bn | 206 | .Fa bn |
213 | is used instead. | 207 | is used instead. |
214 | .Pp | 208 | .Pp |
215 | .Fn i2a_ASN1_INTEGER | ||
216 | writes a hexadecimal representation of | ||
217 | .Fa a | ||
218 | to | ||
219 | .Fa out_bio . | ||
220 | The output optionally starts with a minus sign, | ||
221 | followed by an even number of upper case ASCII hexadecimal digits. | ||
222 | After each group of 70 digits, a backslash and a linefeed | ||
223 | are inserted before the next digit. | ||
224 | .Pp | ||
225 | .Fn ASN1_ENUMERATED_get , | 209 | .Fn ASN1_ENUMERATED_get , |
226 | .Fn ASN1_ENUMERATED_set , | 210 | .Fn ASN1_ENUMERATED_set , |
227 | .Fn BN_to_ASN1_ENUMERATED , | 211 | .Fn BN_to_ASN1_ENUMERATED , |
@@ -294,17 +278,6 @@ object of | |||
294 | if an error occurs. | 278 | if an error occurs. |
295 | They can fail if the passed type is incorrect (due to a programming error) | 279 | They can fail if the passed type is incorrect (due to a programming error) |
296 | or due to memory allocation failures. | 280 | or due to memory allocation failures. |
297 | .Pp | ||
298 | In case of success, | ||
299 | .Fn i2a_ASN1_INTEGER | ||
300 | returns the total number of bytes written, which is at least 2. | ||
301 | It returns 0 if | ||
302 | .Fa a | ||
303 | is | ||
304 | .Dv NULL | ||
305 | or -1 if | ||
306 | .Xr BIO_write 3 | ||
307 | fails. | ||
308 | .Sh SEE ALSO | 281 | .Sh SEE ALSO |
309 | .Xr ASN1_INTEGER_new 3 , | 282 | .Xr ASN1_INTEGER_new 3 , |
310 | .Xr ASN1_STRING_length 3 | 283 | .Xr ASN1_STRING_length 3 |
@@ -313,9 +286,8 @@ fails. | |||
313 | first appeared in SSLeay 0.5.1. | 286 | first appeared in SSLeay 0.5.1. |
314 | .Fn ASN1_INTEGER_get , | 287 | .Fn ASN1_INTEGER_get , |
315 | .Fn BN_to_ASN1_INTEGER , | 288 | .Fn BN_to_ASN1_INTEGER , |
316 | .Fn ASN1_INTEGER_to_BN , | ||
317 | and | 289 | and |
318 | .Fn i2a_ASN1_INTEGER | 290 | .Fn ASN1_INTEGER_to_BN |
319 | first appeared in SSLeay 0.6.0. | 291 | first appeared in SSLeay 0.6.0. |
320 | .Fn ASN1_INTEGER_cmp | 292 | .Fn ASN1_INTEGER_cmp |
321 | and | 293 | and |
@@ -348,9 +320,8 @@ imply that these functions should be avoided if possible. | |||
348 | .Sh BUGS | 320 | .Sh BUGS |
349 | .Fn ASN1_INTEGER_cmp , | 321 | .Fn ASN1_INTEGER_cmp , |
350 | .Fn ASN1_INTEGER_dup , | 322 | .Fn ASN1_INTEGER_dup , |
351 | .Fn ASN1_INTEGER_to_BN , | ||
352 | and | 323 | and |
353 | .Fn i2a_ASN1_INTEGER | 324 | .Fn ASN1_INTEGER_to_BN |
354 | do not check whether their arguments are really of the type | 325 | do not check whether their arguments are really of the type |
355 | .Dv V_ASN1_INTEGER | 326 | .Dv V_ASN1_INTEGER |
356 | or | 327 | or |
diff --git a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 index fa5f071c14..bf6266350e 100644 --- a/src/lib/libcrypto/man/i2a_ASN1_STRING.3 +++ b/src/lib/libcrypto/man/i2a_ASN1_STRING.3 | |||
@@ -1,6 +1,6 @@ | |||
1 | .\" $OpenBSD: i2a_ASN1_STRING.3,v 1.1 2021/11/15 10:41:11 schwarze Exp $ | 1 | .\" $OpenBSD: i2a_ASN1_STRING.3,v 1.2 2021/11/23 13:52:27 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2019, 2021 Ingo Schwarze <schwarze@openbsd.org> |
4 | .\" | 4 | .\" |
5 | .\" Permission to use, copy, modify, and distribute this software for any | 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 | 6 | .\" purpose with or without fee is hereby granted, provided that the above |
@@ -14,12 +14,16 @@ | |||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | .\" | 16 | .\" |
17 | .Dd $Mdocdate: November 15 2021 $ | 17 | .Dd $Mdocdate: November 23 2021 $ |
18 | .Dt I2A_ASN1_STRING 3 | 18 | .Dt I2A_ASN1_STRING 3 |
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
21 | .Nm i2a_ASN1_STRING , | 21 | .Nm i2a_ASN1_STRING , |
22 | .Nm a2i_ASN1_STRING | 22 | .Nm i2a_ASN1_INTEGER , |
23 | .Nm i2a_ASN1_ENUMERATED , | ||
24 | .Nm a2i_ASN1_STRING , | ||
25 | .Nm a2i_ASN1_INTEGER , | ||
26 | .Nm a2i_ASN1_ENUMERATED | ||
23 | .Nd hexadecimal dump of an ASN.1 string | 27 | .Nd hexadecimal dump of an ASN.1 string |
24 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
25 | .In openssl/asn1.h | 29 | .In openssl/asn1.h |
@@ -30,16 +34,43 @@ | |||
30 | .Fa "int type" | 34 | .Fa "int type" |
31 | .Fc | 35 | .Fc |
32 | .Ft int | 36 | .Ft int |
37 | .Fo i2a_ASN1_INTEGER | ||
38 | .Fa "BIO *out_bio" | ||
39 | .Fa "const ASN1_INTEGER *a" | ||
40 | .Fc | ||
41 | .Ft int | ||
42 | .Fo i2a_ASN1_ENUMERATED | ||
43 | .Fa "BIO *out_bio" | ||
44 | .Fa "const i2a_ASN1_ENUMERATED *a" | ||
45 | .Fc | ||
46 | .Ft int | ||
33 | .Fo a2i_ASN1_STRING | 47 | .Fo a2i_ASN1_STRING |
34 | .Fa "BIO *in_bio" | 48 | .Fa "BIO *in_bio" |
35 | .Fa "ASN1_STRING *out_string" | 49 | .Fa "ASN1_STRING *out_string" |
36 | .Fa "char *buffer" | 50 | .Fa "char *buffer" |
37 | .Fa "int size" | 51 | .Fa "int size" |
38 | .Fc | 52 | .Fc |
53 | .Ft int | ||
54 | .Fo a2i_ASN1_INTEGER | ||
55 | .Fa "BIO *in_bio" | ||
56 | .Fa "ASN1_INTEGER *out_string" | ||
57 | .Fa "char *buffer" | ||
58 | .Fa "int size" | ||
59 | .Fc | ||
60 | .Ft int | ||
61 | .Fo a2i_ASN1_ENUMERATED | ||
62 | .Fa "BIO *in_bio" | ||
63 | .Fa "ASN1_ENUMERATED *out_string" | ||
64 | .Fa "char *buffer" | ||
65 | .Fa "int size" | ||
66 | .Fc | ||
39 | .Sh DESCRIPTION | 67 | .Sh DESCRIPTION |
40 | The function | 68 | The functions |
41 | .Fn i2a_ASN1_STRING | 69 | .Fn i2a_ASN1_STRING , |
42 | writes a hexadecimal representation of | 70 | .Fn i2a_ASN1_INTEGER , |
71 | and | ||
72 | .Fn i2a_ASN1_ENUMERATED | ||
73 | write a hexadecimal representation of | ||
43 | .Fa a | 74 | .Fa a |
44 | to | 75 | to |
45 | .Fa out_bio . | 76 | .Fa out_bio . |
@@ -57,33 +88,61 @@ If the | |||
57 | .Xr ASN1_STRING_length 3 | 88 | .Xr ASN1_STRING_length 3 |
58 | of | 89 | of |
59 | .Fa a | 90 | .Fa a |
60 | is 0, the single digit | 91 | is 0, instead a pair of zero digits |
61 | .Ql 0 | 92 | .Pq Qq 00 |
62 | is written instead. | 93 | is written by |
94 | .Fn i2a_ASN1_INTEGER | ||
95 | and | ||
96 | .Fn i2a_ASN1_ENUMERATED | ||
97 | and a single zero digit | ||
98 | .Pq Qq 0 | ||
99 | by | ||
100 | .Fn i2a_ASN1_STRING . | ||
63 | If | 101 | If |
64 | .Fa a | 102 | .Fa a |
65 | is a | 103 | is a |
66 | .Dv NULL | 104 | .Dv NULL |
67 | pointer, nothing is written. | 105 | pointer, nothing is written. |
68 | .Pp | 106 | .Pp |
69 | The function | 107 | If |
70 | .Fn a2i_ASN1_STRING | 108 | .Fa a |
71 | parses a hexadecimal representation of an ASN.1 string into | 109 | represents a negative integer, |
110 | .Fn i2a_ASN1_INTEGER | ||
111 | prepends a minus sign to the output. | ||
112 | .Pp | ||
113 | The functions | ||
114 | .Fn a2i_ASN1_STRING , | ||
115 | .Fn a2i_ASN1_INTEGER , | ||
116 | and | ||
117 | .Fn a2i_ASN1_ENUMERATED | ||
118 | parse a hexadecimal representation of an ASN.1 string into | ||
72 | .Fa out_string . | 119 | .Fa out_string . |
73 | Both lower-case and upper-case hexadecimal digits are accepted. | 120 | Both lower-case and upper-case hexadecimal digits are accepted. |
74 | Every pair of input digits is converted into one output byte. | 121 | Every pair of input digits is converted into one output byte. |
75 | At least one pair of input digits is required. | ||
76 | .Pp | 122 | .Pp |
77 | On every input line, the trailing newline character and an optional | 123 | On every input line, the trailing newline character and an optional |
78 | carrier return character character preceding it are ignored. | 124 | carrier return character character preceding it are ignored. |
79 | The trailing newline need not be present on the last line. | 125 | The trailing newline need not be present on the last line. |
80 | If there is a backslash character before the newline character, | 126 | If there is a backslash character before the newline character, |
81 | parsing is continued on the next input line. | 127 | parsing is continued on the next input line. |
82 | In particular, | 128 | .Pp |
129 | At least one pair of input digits is required by | ||
130 | .Fn a2i_ASN1_INTEGER | ||
131 | and | ||
132 | .Fn a2i_ASN1_ENUMERATED , | ||
133 | whereas | ||
83 | .Fn a2i_ASN1_STRING | 134 | .Fn a2i_ASN1_STRING |
84 | is able to parse the output of | 135 | converts empty input to an empty string. |
136 | .Pp | ||
137 | These functions are able to parse the output of | ||
138 | .Fn i2a_ASN1_ENUMERATED . | ||
139 | They can parse the output of | ||
140 | .Fn i2a_ASN1_INTEGER | ||
141 | unless | ||
142 | .Fa a | ||
143 | was negative, and they can parse the output of | ||
85 | .Fn i2a_ASN1_STRING | 144 | .Fn i2a_ASN1_STRING |
86 | except when the | 145 | unless the |
87 | .Xr ASN1_STRING_length 3 | 146 | .Xr ASN1_STRING_length 3 |
88 | of | 147 | of |
89 | .Fa a | 148 | .Fa a |
@@ -92,39 +151,69 @@ was 0. | |||
92 | Parsing fails if an input line contains an odd number of input | 151 | Parsing fails if an input line contains an odd number of input |
93 | digits or if memory allocation fails. | 152 | digits or if memory allocation fails. |
94 | .Pp | 153 | .Pp |
95 | This function uses the | 154 | These functions use the |
96 | .Fa buffer | 155 | .Fa buffer |
97 | provided by the caller and assumes it is at least | 156 | provided by the caller and assume it is at least |
98 | .Fa size | 157 | .Fa size |
99 | bytes long. | 158 | bytes long. |
100 | It is unspecified what the buffer contains after the function returns. | 159 | It is unspecified what the buffer contains after the functions return. |
101 | .Sh RETURN VALUES | 160 | .Sh RETURN VALUES |
102 | The function | 161 | The functions |
103 | .Fn i2a_ASN1_STRING | 162 | .Fn i2a_ASN1_STRING , |
104 | returns the number of bytes written or \-1 if | 163 | .Fn i2a_ASN1_INTEGER , |
164 | and | ||
165 | .Fn i2a_ASN1_ENUMERATED | ||
166 | return the number of bytes written or \-1 if | ||
105 | .Xr BIO_write 3 | 167 | .Xr BIO_write 3 |
106 | fails. | 168 | fails. |
169 | In particular, they all return 0 when | ||
170 | .Fa a | ||
171 | is a | ||
172 | .Dv NULL | ||
173 | pointer. | ||
174 | .Fn i2a_ASN1_STRING | ||
175 | returns 1 for an empty string or an even number greater than 1 | ||
176 | for a string that is not empty. | ||
177 | .Fn i2a_ASN1_INTEGER | ||
178 | returns an even number greater than 1 for positive input | ||
179 | or an odd number greater than 2 for negative input. | ||
180 | .Fn i2a_ASN1_ENUMERATED | ||
181 | always returns a non-negative even number when successful. | ||
107 | .Pp | 182 | .Pp |
108 | The function | 183 | The functions |
109 | .Fn a2i_ASN1_STRING | 184 | .Fn a2i_ASN1_STRING , |
110 | is intended to return 1 for success or 0 for failure, but see the | 185 | .Fn a2i_ASN1_INTEGER , |
186 | and | ||
187 | .Fn a2i_ASN1_ENUMERATED | ||
188 | are intended to return 1 for success or 0 for failure, but see the | ||
111 | .Sx BUGS | 189 | .Sx BUGS |
112 | section for a number of traps. | 190 | section for a number of traps. |
113 | .Sh SEE ALSO | 191 | .Sh SEE ALSO |
114 | .Xr ASN1_STRING_length 3 , | 192 | .Xr ASN1_STRING_length 3 , |
115 | .Xr ASN1_STRING_new 3 , | 193 | .Xr ASN1_STRING_new 3 , |
116 | .Xr ASN1_STRING_print_ex 3 , | 194 | .Xr ASN1_STRING_print_ex 3 , |
117 | .Xr i2a_ASN1_INTEGER 3 , | ||
118 | .Xr i2a_ASN1_OBJECT 3 | 195 | .Xr i2a_ASN1_OBJECT 3 |
119 | .Sh HISTORY | 196 | .Sh HISTORY |
120 | These functions first appeared in SSLeay 0.6.5. | 197 | .Fn i2a_ASN1_INTEGER |
121 | The function | 198 | and |
199 | .Fn a2i_ASN1_INTEGER | ||
200 | first appeared in SSLeay 0.6.0. | ||
201 | .Fn i2a_ASN1_STRING | ||
202 | and | ||
203 | .Fn a2i_ASN1_STRING | ||
204 | first appeared in SSLeay 0.6.5. | ||
122 | .Fn a2i_ASN1_STRING | 205 | .Fn a2i_ASN1_STRING |
123 | has been part of the public API since SSLeay 0.6.5 and | 206 | has been part of the public API since SSLeay 0.6.5 and |
124 | .Fn i2a_ASN1_STRING | 207 | .Fn i2a_ASN1_STRING |
125 | since SSLeay 0.8.0. | 208 | since SSLeay 0.8.0. |
126 | They have been available since | 209 | These functions have been available since |
127 | .Ox 2.4 . | 210 | .Ox 2.4 . |
211 | .Pp | ||
212 | .Fn i2a_ASN1_ENUMERATED | ||
213 | and | ||
214 | .Fn a2i_ASN1_ENUMERATED | ||
215 | first appeared in OpenSSL 0.9.2 and have been available since | ||
216 | .Ox 2.6 . | ||
128 | .Sh BUGS | 217 | .Sh BUGS |
129 | If the first call to | 218 | If the first call to |
130 | .Xr BIO_gets 3 | 219 | .Xr BIO_gets 3 |
@@ -142,7 +231,10 @@ returns a partial line, for example because the given | |||
142 | .Fa size | 231 | .Fa size |
143 | is insufficient to contain one of the input lines | 232 | is insufficient to contain one of the input lines |
144 | or for reasons specific to the BIO type, | 233 | or for reasons specific to the BIO type, |
145 | .Fn a2i_ASN1_STRING | 234 | .Fn a2i_ASN1_STRING , |
235 | .Fn a2i_ASN1_INTEGER , | ||
236 | and | ||
237 | .Fn a2i_ASN1_ENUMERATED | ||
146 | may fail or silently return a truncated result. | 238 | may fail or silently return a truncated result. |
147 | The caller is responsible for providing a | 239 | The caller is responsible for providing a |
148 | .Fa buffer | 240 | .Fa buffer |
@@ -150,9 +242,12 @@ of sufficient size to contain the longest possible input line | |||
150 | and for choosing a BIO of a type that only returns complete | 242 | and for choosing a BIO of a type that only returns complete |
151 | input lines and does not perform partial reads. | 243 | input lines and does not perform partial reads. |
152 | .Pp | 244 | .Pp |
153 | The function | 245 | The functions |
154 | .Fn a2i_ASN1_STRING | 246 | .Fn a2i_ASN1_STRING , |
155 | does not support non-blocking BIOs. | 247 | .Fn a2i_ASN1_INTEGER , |
248 | and | ||
249 | .Fn a2i_ASN1_ENUMERATED | ||
250 | do not support non-blocking BIOs. | ||
156 | Reading is terminated as soon as | 251 | Reading is terminated as soon as |
157 | .Xr BIO_gets 3 | 252 | .Xr BIO_gets 3 |
158 | returns a value less than 1. | 253 | returns a value less than 1. |