summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorschwarze <>2021-10-20 13:14:00 +0000
committerschwarze <>2021-10-20 13:14:00 +0000
commit0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2 (patch)
tree03bb590c1723862a99764672187c023c48b0c5e3 /src/lib/libcrypto/man
parent6c0565eab2c20f5f10f838d8a8543534f08eb93e (diff)
downloadopenbsd-0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2.tar.gz
openbsd-0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2.tar.bz2
openbsd-0143b33fa20c3da5cbf1bb6d1cf27021639e7ea2.zip
new manual page ASN1_mbstring_copy(3)
also documenting ASN1_mbstring_ncopy(3)
Diffstat (limited to 'src/lib/libcrypto/man')
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_length.35
-rw-r--r--src/lib/libcrypto/man/ASN1_STRING_new.35
-rw-r--r--src/lib/libcrypto/man/ASN1_mbstring_copy.3174
-rw-r--r--src/lib/libcrypto/man/Makefile3
4 files changed, 182 insertions, 5 deletions
diff --git a/src/lib/libcrypto/man/ASN1_STRING_length.3 b/src/lib/libcrypto/man/ASN1_STRING_length.3
index b87cf9987c..76679e27e9 100644
--- a/src/lib/libcrypto/man/ASN1_STRING_length.3
+++ b/src/lib/libcrypto/man/ASN1_STRING_length.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ASN1_STRING_length.3,v 1.20 2019/08/26 07:59:02 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_length.3,v 1.21 2021/10/20 13:14:00 schwarze Exp $
2.\" full merge up to: OpenSSL 4a56d2a3 Feb 25 16:49:27 2018 +0300 2.\" full merge up to: OpenSSL 4a56d2a3 Feb 25 16:49:27 2018 +0300
3.\" 3.\"
4.\" This file is a derived work. 4.\" This file is a derived work.
@@ -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: August 26 2019 $ 69.Dd $Mdocdate: October 20 2021 $
70.Dt ASN1_STRING_LENGTH 3 70.Dt ASN1_STRING_LENGTH 3
71.Os 71.Os
72.Sh NAME 72.Sh NAME
@@ -326,6 +326,7 @@ and
326the reason can be determined with 326the reason can be determined with
327.Xr ERR_get_error 3 . 327.Xr ERR_get_error 3 .
328.Sh SEE ALSO 328.Sh SEE ALSO
329.Xr ASN1_mbstring_copy 3 ,
329.Xr ASN1_STRING_new 3 330.Xr ASN1_STRING_new 3
330.Sh HISTORY 331.Sh HISTORY
331.Fn ASN1_STRING_cmp , 332.Fn ASN1_STRING_cmp ,
diff --git a/src/lib/libcrypto/man/ASN1_STRING_new.3 b/src/lib/libcrypto/man/ASN1_STRING_new.3
index 46325f3968..ce2e9fdc68 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.17 2019/06/14 13:59:32 schwarze Exp $ 1.\" $OpenBSD: ASN1_STRING_new.3,v 1.18 2021/10/20 13:14:00 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: June 14 2019 $ 18.Dd $Mdocdate: October 20 2021 $
19.Dt ASN1_STRING_NEW 3 19.Dt ASN1_STRING_NEW 3
20.Os 20.Os
21.Sh NAME 21.Sh NAME
@@ -204,6 +204,7 @@ is returned and an error code can be retrieved with
204.Xr ERR_get_error 3 . 204.Xr ERR_get_error 3 .
205.Sh SEE ALSO 205.Sh SEE ALSO
206.Xr ASN1_INTEGER_get 3 , 206.Xr ASN1_INTEGER_get 3 ,
207.Xr ASN1_mbstring_copy 3 ,
207.Xr ASN1_STRING_length 3 , 208.Xr ASN1_STRING_length 3 ,
208.Xr ASN1_STRING_print_ex 3 , 209.Xr ASN1_STRING_print_ex 3 ,
209.Xr ASN1_time_parse 3 , 210.Xr ASN1_time_parse 3 ,
diff --git a/src/lib/libcrypto/man/ASN1_mbstring_copy.3 b/src/lib/libcrypto/man/ASN1_mbstring_copy.3
new file mode 100644
index 0000000000..0ce110d6ed
--- /dev/null
+++ b/src/lib/libcrypto/man/ASN1_mbstring_copy.3
@@ -0,0 +1,174 @@
1.\" $OpenBSD: ASN1_mbstring_copy.3,v 1.1 2021/10/20 13:14:00 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: October 20 2021 $
18.Dt ASN1_MBSTRING_COPY 3
19.Os
20.Sh NAME
21.Nm ASN1_mbstring_copy ,
22.Nm ASN1_mbstring_ncopy
23.Nd copy a mutibyte string into an ASN.1 string object
24.Sh SYNOPSIS
25.In openssl/asn1.h
26.Ft int
27.Fo ASN1_mbstring_copy
28.Fa "ASN1_STRING **out"
29.Fa "const unsigned char *in"
30.Fa "int inbytes"
31.Fa "int inform"
32.Fa "unsigned long mask"
33.Fc
34.Ft int
35.Fo ASN1_mbstring_ncopy
36.Fa "ASN1_STRING **out"
37.Fa "const unsigned char *in"
38.Fa "int inbytes"
39.Fa "int inform"
40.Fa "unsigned long mask"
41.Fa "long minchars"
42.Fa "long maxchars"
43.Fc
44.Sh DESCRIPTION
45.Fn ASN1_mbstring_copy
46interprets
47.Fa inbytes
48bytes starting at
49.Fa in
50as a multibyte string and copies it to
51.Pf * Fa out ,
52optionally changing the encoding.
53If the
54.Fa inbytes
55argument is negative, the
56.Xr strlen 3
57of
58.Fa in
59is used instead.
60.Pp
61The
62.Fa inform
63argument specifies the character encoding of
64.Fa in :
65.Bl -column MBSTRING_UNIV encoding
66.It Ar inform Ta encoding
67.It Dv MBSTRING_ASC Ta ISO-Latin-1
68.It Dv MBSTRING_BMP Ta UTF-16
69.It Dv MBSTRING_UNIV Ta UTF-32
70.It Dv MBSTRING_UTF8 Ta UTF-8
71.El
72.Pp
73The bit
74.Fa mask
75specifies a set of ASN.1 string types
76that the user is willing to accept:
77.Bl -column B_ASN1_UNIVERSALSTRING ASN1_UNIVERSALSTRING default
78.It bit in Fa mask Ta acceptable output type Ta default
79.It Dv B_ASN1_PRINTABLESTRING Ta Vt ASN1_PRINTABLESTRING Ta yes
80.It Dv B_ASN1_IA5STRING Ta Vt ASN1_IA5STRING Ta no
81.It Dv B_ASN1_T61STRING Ta Vt ASN1_T61STRING Ta yes
82.It Dv B_ASN1_BMPSTRING Ta Vt ASN1_BMPSTRING Ta yes
83.It Dv B_ASN1_UNIVERSALSTRING Ta Vt ASN1_UNIVERSALSTRING Ta no
84.It any other bit Ta Vt ASN1_UTF8STRING Ta yes
85.El
86.Pp
87The first type from the above table that is included in the
88.Fa mask
89argument and that can represent
90.Fa in
91is used as the output type.
92The
93.Dq default
94column indicates whether the type is considered acceptable if the
95.Fa mask
96argument has the special value 0.
97.Pp
98If
99.Fa out
100is
101.Dv NULL ,
102.Fa inform ,
103.Fa inbytes ,
104and
105.Fa in
106are validated and the output type is determined and returned,
107but nothing is copied.
108.Pp
109Otherwise, if
110.Pf * Fa out
111is
112.Dv NULL ,
113a new output object of the output type is allocated
114and a pointer to it is stored in
115.Pf * Fa out .
116.Pp
117Otherwise,
118.Pf ** Fa out
119is used as the output object.
120Any data already stored in it is freed
121and its type is changed to the output type.
122.Pp
123Finally,
124.Fa in
125is copied to the output object, changing the character encoding if
126.Fa inform
127does not match the encoding used by the output type.
128.Pp
129.Fn ASN1_mbstring_ncopy
130is similar except that the number of characters in
131.Fa in
132is restricted to the range from
133.Fa minchars
134to
135.Fa maxchars ,
136inclusive.
137If
138.Fa maxchars
139is 0, no upper limit is enforced on the number of characters.
140.Sh RETURN VALUES
141.Fn ASN1_mbstring_copy
142and
143.Fn ASN1_mbstring_ncopy
144return the
145.Dv V_ASN1_*
146constant representing the output type or \-1 if
147.Fa inform
148is invalid, if
149.Fa inbytes
150or
151.Fa in
152is invalid for the
153.Fa inform
154encoding, if
155.Fa in
156contains an UTF-16 surrogate,
157which is unsupported even for input using the UTF-16 encoding,
158or if memory allocation fails.
159.Pp
160.Fn ASN1_mbstring_ncopy
161also returns \-1 if
162.Fa in
163contains fewer than
164.Fa minchars
165or more than
166.Fa maxchars
167characters.
168.Sh SEE ALSO
169.Xr ASN1_STRING_new 3 ,
170.Xr ASN1_STRING_set 3
171.Sh HISTORY
172These functions first appeared in OpenSSL 0.9.5
173and have been available since
174.Ox 2.7 .
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 97c6b3e9a4..0f6b84a1b6 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.194 2021/10/20 05:06:36 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.195 2021/10/20 13:14:00 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_mbstring_copy.3 \
20 ASN1_parse_dump.3 \ 21 ASN1_parse_dump.3 \
21 ASN1_put_object.3 \ 22 ASN1_put_object.3 \
22 ASN1_time_parse.3 \ 23 ASN1_time_parse.3 \