summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorschwarze <>2021-10-20 15:54:21 +0000
committerschwarze <>2021-10-20 15:54:21 +0000
commitaa8cd1b0cda51b27f8f2323a2831c582b9c0a41a (patch)
tree920da2155fa77dbbb283454dd9675c12734cd64c /src/lib/libcrypto/man
parent0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2 (diff)
downloadopenbsd-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.35
-rw-r--r--src/lib/libcrypto/man/ASN1_mbstring_copy.3129
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
89if nothing is found. 89if 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
46interprets 68interprets
@@ -137,6 +159,72 @@ inclusive.
137If 159If
138.Fa maxchars 160.Fa maxchars
139is 0, no upper limit is enforced on the number of characters. 161is 0, no upper limit is enforced on the number of characters.
162.Pp
163.Fn ASN1_STRING_set_by_NID
164is similar with the following differences:
165.Bl -bullet -width 1n
166.It
167If
168.Fa out
169is
170.Dv NULL ,
171a new output object is allocated and returned
172instead of skipping the copying.
173.It
174If
175.Fa nid
176has a global string table entry that can be retrieved with
177.Xr ASN1_STRING_TABLE_get 3 ,
178.Fa mask ,
179.Fa minchars ,
180and
181.Fa maxchars
182are taken from that string table entry.
183For some values of
184.Fa nid ,
185an additional global mask is AND'ed into the mask before using it.
186The default value of the global mask is
187.Dv B_ASN1_UTF8STRING .
188.It
189If
190.Fa nid
191has no global string table entry,
192.Dv B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING |
193.Dv B_ASN1_BMPSTRING | B_ASN1_UTF8STRING
194is used instead of the mask taken from the table,
195and the global mask is also AND'ed into it.
196.It
197Even though success and failure happen in the same situations,
198the return value is different.
199.Xr ASN1_STRING_type 3
200can be used to determine the type of the return value.
201.El
202.Pp
203.Fn ASN1_STRING_set_default_mask
204sets the global mask used by
205.Fn ASN1_STRING_set_by_NID
206to the
207.Fa mask
208argument.
209.Pp
210.Fn ASN1_STRING_set_default_mask_asc
211sets 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
220If the
221.Fa maskname
222argument starts with the substring
223.Qq MASK:\& ,
224the rest of it is interpreted as an
225.Vt unsigned long
226value using
227.Xr strtoul 3 .
140.Sh RETURN VALUES 228.Sh RETURN VALUES
141.Fn ASN1_mbstring_copy 229.Fn ASN1_mbstring_copy
142and 230and
@@ -165,10 +253,45 @@ contains fewer than
165or more than 253or more than
166.Fa maxchars 254.Fa maxchars
167characters. 255characters.
256.Pp
257.Fn ASN1_STRING_set_by_NID
258returns the new or changed ASN.1 string object or
259.Dv NULL
260on failure.
261.Pp
262.Fn ASN1_STRING_set_default_mask_asc
263returns 1 if successful or 0 if
264.Qq MASK:\&
265is not followed by a number, if the number is followed by a non-numeric
266character, or if the
267.Fa maskname
268is invalid.
269.Pp
270.Fn ASN1_STRING_get_default_mask
271returns 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
172These functions first appeared in OpenSSL 0.9.5 277These functions first appeared in OpenSSL 0.9.5
173and have been available since 278and have been available since
174.Ox 2.7 . 279.Ox 2.7 .
280.Sh BUGS
281If integer overflow occurs in
282.Fn ASN1_STRING_set_default_mask_asc
283while parsing a number following
284.Qq MASK:\& ,
285the function succeeds, essentially behaving in the same way as for
286.Qq default .
287.Pp
288Passing
289.Qq default
290to
291.Fn ASN1_STRING_set_default_mask_asc
292does
293.Em not
294restore the default mask.
295Instead, passing
296.Qq utf8only
297does that.