diff options
author | schwarze <> | 2021-10-20 15:54:21 +0000 |
---|---|---|
committer | schwarze <> | 2021-10-20 15:54:21 +0000 |
commit | aa8cd1b0cda51b27f8f2323a2831c582b9c0a41a (patch) | |
tree | 920da2155fa77dbbb283454dd9675c12734cd64c /src/lib/libcrypto/man | |
parent | 0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2 (diff) | |
download | openbsd-aa8cd1b0cda51b27f8f2323a2831c582b9c0a41a.tar.gz openbsd-aa8cd1b0cda51b27f8f2323a2831c582b9c0a41a.tar.bz2 openbsd-aa8cd1b0cda51b27f8f2323a2831c582b9c0a41a.zip |
document ASN1_STRING_set_by_NID(3)
and the three functions related to the global mask
Diffstat (limited to 'src/lib/libcrypto/man')
-rw-r--r-- | src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/ASN1_mbstring_copy.3 | 129 |
2 files changed, 129 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 b/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 index c4ae6c9bfa..534443d869 100644 --- a/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 +++ b/src/lib/libcrypto/man/ASN1_STRING_TABLE_add.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ASN1_STRING_TABLE_add.3,v 1.4 2019/06/14 13:59:32 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_STRING_TABLE_add.3,v 1.5 2021/10/20 15:54:21 schwarze Exp $ |
2 | .\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 | 2 | .\" OpenSSL ASN1_STRING_TABLE_add.pod 7b608d08 Jul 27 01:18:50 2017 +0800 |
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: June 14 2019 $ | 18 | .Dd $Mdocdate: October 20 2021 $ |
19 | .Dt ASN1_STRING_TABLE_ADD 3 | 19 | .Dt ASN1_STRING_TABLE_ADD 3 |
20 | .Os | 20 | .Os |
21 | .Sh NAME | 21 | .Sh NAME |
@@ -89,6 +89,7 @@ structure or | |||
89 | if nothing is found. | 89 | if nothing is found. |
90 | .Sh SEE ALSO | 90 | .Sh SEE ALSO |
91 | .Xr ASN1_OBJECT_new 3 , | 91 | .Xr ASN1_OBJECT_new 3 , |
92 | .Xr ASN1_STRING_set_by_NID 3 , | ||
92 | .Xr OBJ_nid2obj 3 | 93 | .Xr OBJ_nid2obj 3 |
93 | .Sh HISTORY | 94 | .Sh HISTORY |
94 | .Fn ASN1_STRING_TABLE_add , | 95 | .Fn ASN1_STRING_TABLE_add , |
diff --git a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 b/src/lib/libcrypto/man/ASN1_mbstring_copy.3 index 0ce110d6ed..ce270c8d5e 100644 --- a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 +++ b/src/lib/libcrypto/man/ASN1_mbstring_copy.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ASN1_mbstring_copy.3,v 1.1 2021/10/20 13:14:00 schwarze Exp $ | 1 | .\" $OpenBSD: ASN1_mbstring_copy.3,v 1.2 2021/10/20 15:54:21 schwarze Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> |
4 | .\" | 4 | .\" |
@@ -19,7 +19,11 @@ | |||
19 | .Os | 19 | .Os |
20 | .Sh NAME | 20 | .Sh NAME |
21 | .Nm ASN1_mbstring_copy , | 21 | .Nm ASN1_mbstring_copy , |
22 | .Nm ASN1_mbstring_ncopy | 22 | .Nm ASN1_mbstring_ncopy , |
23 | .Nm ASN1_STRING_set_by_NID , | ||
24 | .Nm ASN1_STRING_set_default_mask , | ||
25 | .Nm ASN1_STRING_set_default_mask_asc , | ||
26 | .Nm ASN1_STRING_get_default_mask | ||
23 | .Nd copy a mutibyte string into an ASN.1 string object | 27 | .Nd copy a mutibyte string into an ASN.1 string object |
24 | .Sh SYNOPSIS | 28 | .Sh SYNOPSIS |
25 | .In openssl/asn1.h | 29 | .In openssl/asn1.h |
@@ -41,6 +45,24 @@ | |||
41 | .Fa "long minchars" | 45 | .Fa "long minchars" |
42 | .Fa "long maxchars" | 46 | .Fa "long maxchars" |
43 | .Fc | 47 | .Fc |
48 | .Ft ASN1_STRING * | ||
49 | .Fo ASN1_STRING_set_by_NID | ||
50 | .Fa "ASN1_STRING **out" | ||
51 | .Fa "const unsigned char *in" | ||
52 | .Fa "int inbytes" | ||
53 | .Fa "int inform" | ||
54 | .Fa "int nid" | ||
55 | .Fc | ||
56 | .Ft void | ||
57 | .Fo ASN1_STRING_set_default_mask | ||
58 | .Fa "unsigned long mask" | ||
59 | .Fc | ||
60 | .Ft int | ||
61 | .Fo ASN1_STRING_set_default_mask_asc | ||
62 | .Fa "const char *maskname" | ||
63 | .Fc | ||
64 | .Ft unsigned long | ||
65 | .Fn ASN1_STRING_get_default_mask void | ||
44 | .Sh DESCRIPTION | 66 | .Sh DESCRIPTION |
45 | .Fn ASN1_mbstring_copy | 67 | .Fn ASN1_mbstring_copy |
46 | interprets | 68 | interprets |
@@ -137,6 +159,72 @@ inclusive. | |||
137 | If | 159 | If |
138 | .Fa maxchars | 160 | .Fa maxchars |
139 | is 0, no upper limit is enforced on the number of characters. | 161 | is 0, no upper limit is enforced on the number of characters. |
162 | .Pp | ||
163 | .Fn ASN1_STRING_set_by_NID | ||
164 | is similar with the following differences: | ||
165 | .Bl -bullet -width 1n | ||
166 | .It | ||
167 | If | ||
168 | .Fa out | ||
169 | is | ||
170 | .Dv NULL , | ||
171 | a new output object is allocated and returned | ||
172 | instead of skipping the copying. | ||
173 | .It | ||
174 | If | ||
175 | .Fa nid | ||
176 | has a global string table entry that can be retrieved with | ||
177 | .Xr ASN1_STRING_TABLE_get 3 , | ||
178 | .Fa mask , | ||
179 | .Fa minchars , | ||
180 | and | ||
181 | .Fa maxchars | ||
182 | are taken from that string table entry. | ||
183 | For some values of | ||
184 | .Fa nid , | ||
185 | an additional global mask is AND'ed into the mask before using it. | ||
186 | The default value of the global mask is | ||
187 | .Dv B_ASN1_UTF8STRING . | ||
188 | .It | ||
189 | If | ||
190 | .Fa nid | ||
191 | has no global string table entry, | ||
192 | .Dv B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | | ||
193 | .Dv B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | ||
194 | is used instead of the mask taken from the table, | ||
195 | and the global mask is also AND'ed into it. | ||
196 | .It | ||
197 | Even though success and failure happen in the same situations, | ||
198 | the return value is different. | ||
199 | .Xr ASN1_STRING_type 3 | ||
200 | can be used to determine the type of the return value. | ||
201 | .El | ||
202 | .Pp | ||
203 | .Fn ASN1_STRING_set_default_mask | ||
204 | sets the global mask used by | ||
205 | .Fn ASN1_STRING_set_by_NID | ||
206 | to the | ||
207 | .Fa mask | ||
208 | argument. | ||
209 | .Pp | ||
210 | .Fn ASN1_STRING_set_default_mask_asc | ||
211 | sets the global mask as follows: | ||
212 | .Bl -column utf8only | ||
213 | .It Ar maskname Ta Ar mask | ||
214 | .It Qo default Qc Ta anything | ||
215 | .It Qo nombstr Qc Ta anything except Dv B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | ||
216 | .It Qo pkix Qc Ta anything except Dv B_ASN1_T61STRING | ||
217 | .It Qo utf8only Qc Ta Dv B_ASN1_UTF8STRING | ||
218 | .El | ||
219 | .Pp | ||
220 | If the | ||
221 | .Fa maskname | ||
222 | argument starts with the substring | ||
223 | .Qq MASK:\& , | ||
224 | the rest of it is interpreted as an | ||
225 | .Vt unsigned long | ||
226 | value using | ||
227 | .Xr strtoul 3 . | ||
140 | .Sh RETURN VALUES | 228 | .Sh RETURN VALUES |
141 | .Fn ASN1_mbstring_copy | 229 | .Fn ASN1_mbstring_copy |
142 | and | 230 | and |
@@ -165,10 +253,45 @@ contains fewer than | |||
165 | or more than | 253 | or more than |
166 | .Fa maxchars | 254 | .Fa maxchars |
167 | characters. | 255 | characters. |
256 | .Pp | ||
257 | .Fn ASN1_STRING_set_by_NID | ||
258 | returns the new or changed ASN.1 string object or | ||
259 | .Dv NULL | ||
260 | on failure. | ||
261 | .Pp | ||
262 | .Fn ASN1_STRING_set_default_mask_asc | ||
263 | returns 1 if successful or 0 if | ||
264 | .Qq MASK:\& | ||
265 | is not followed by a number, if the number is followed by a non-numeric | ||
266 | character, or if the | ||
267 | .Fa maskname | ||
268 | is invalid. | ||
269 | .Pp | ||
270 | .Fn ASN1_STRING_get_default_mask | ||
271 | returns the global mask. | ||
168 | .Sh SEE ALSO | 272 | .Sh SEE ALSO |
169 | .Xr ASN1_STRING_new 3 , | 273 | .Xr ASN1_STRING_new 3 , |
170 | .Xr ASN1_STRING_set 3 | 274 | .Xr ASN1_STRING_set 3 , |
275 | .Xr ASN1_STRING_TABLE_get 3 | ||
171 | .Sh HISTORY | 276 | .Sh HISTORY |
172 | These functions first appeared in OpenSSL 0.9.5 | 277 | These functions first appeared in OpenSSL 0.9.5 |
173 | and have been available since | 278 | and have been available since |
174 | .Ox 2.7 . | 279 | .Ox 2.7 . |
280 | .Sh BUGS | ||
281 | If integer overflow occurs in | ||
282 | .Fn ASN1_STRING_set_default_mask_asc | ||
283 | while parsing a number following | ||
284 | .Qq MASK:\& , | ||
285 | the function succeeds, essentially behaving in the same way as for | ||
286 | .Qq default . | ||
287 | .Pp | ||
288 | Passing | ||
289 | .Qq default | ||
290 | to | ||
291 | .Fn ASN1_STRING_set_default_mask_asc | ||
292 | does | ||
293 | .Em not | ||
294 | restore the default mask. | ||
295 | Instead, passing | ||
296 | .Qq utf8only | ||
297 | does that. | ||