summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2021-11-27 16:18:03 +0000
committerschwarze <>2021-11-27 16:18:03 +0000
commitc3aca6e6e8c5c8ce213f793a81edea6aff154df1 (patch)
tree6f4395326854d5ea9566643d009eeac3190233dd /src
parentcbb1afa6429df7a3087dd6a337b730e5304ed3bb (diff)
downloadopenbsd-c3aca6e6e8c5c8ce213f793a81edea6aff154df1.tar.gz
openbsd-c3aca6e6e8c5c8ce213f793a81edea6aff154df1.tar.bz2
openbsd-c3aca6e6e8c5c8ce213f793a81edea6aff154df1.zip
new manual page BIO_f_asn1(3)
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/BIO_f_asn1.3228
-rw-r--r--src/lib/libcrypto/man/BIO_new.35
-rw-r--r--src/lib/libcrypto/man/Makefile3
3 files changed, 233 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/BIO_f_asn1.3 b/src/lib/libcrypto/man/BIO_f_asn1.3
new file mode 100644
index 0000000000..199ba5e9d0
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_f_asn1.3
@@ -0,0 +1,228 @@
1.\" $OpenBSD: BIO_f_asn1.3,v 1.1 2021/11/27 16:18:03 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 27 2021 $
18.Dt BIO_F_ASN1 3
19.Os
20.Sh NAME
21.Nm BIO_f_asn1 ,
22.Nm asn1_ps_func ,
23.Nm BIO_asn1_set_prefix ,
24.Nm BIO_asn1_get_prefix ,
25.Nm BIO_asn1_set_suffix ,
26.Nm BIO_asn1_get_suffix
27.Nd BER-encoding filter BIO
28.Sh SYNOPSIS
29.In openssl/asn1.h
30.Ft const BIO_METHOD *
31.Fn BIO_f_asn1 void
32.In openssl/bio.h
33.Ft typedef int
34.Fo asn1_ps_func
35.Fa "BIO *bio"
36.Fa "unsigned char **pbuf"
37.Fa "int *plen"
38.Fa "void *parg"
39.Fc
40.Ft int
41.Fo BIO_asn1_set_prefix
42.Fa "BIO *chain"
43.Fa "asn1_ps_func *prefix"
44.Fa "asn1_ps_func *prefix_free"
45.Fc
46.Ft int
47.Fo BIO_asn1_get_prefix
48.Fa "BIO *chain"
49.Fa "asn1_ps_func **pprefix"
50.Fa "asn1_ps_func **pprefix_free"
51.Fc
52.Ft int
53.Fo BIO_asn1_set_suffix
54.Fa "BIO *chain"
55.Fa "asn1_ps_func *suffix"
56.Fa "asn1_ps_func *suffix_free"
57.Fc
58.Ft int
59.Fo BIO_asn1_get_suffix
60.Fa "BIO *chain"
61.Fa "asn1_ps_func **psuffix"
62.Fa "asn1_ps_func **psuffix_free"
63.Fc
64.Sh DESCRIPTION
65.Fn BIO_f_asn1
66returns the
67.Qq asn1
68BIO method.
69BIOs created from it with
70.Xr BIO_new 3
71are filter BIOs intended to BER-encode data written to them
72and pass the encoded data on to the next BIO in the chain.
73Such BIOs operate as follows:
74.Bl -hang -width 1n
75.It Xr BIO_method_type 3
76returns
77.Dv BIO_TYPE_ASN1 .
78.It Xr BIO_method_name 3
79returns a pointer to the static string
80.Qq asn1 .
81.It Xr BIO_write 3
82writes the DER encoding of an ASN.1 OCTET STRING with the
83.Fa len
84content octets in
85.Fa buf
86to the next BIO in the chain.
87.Pp
88If a
89.Fa prefix
90function was installed with
91.Fn BIO_asn1_set_prefix ,
92that function is called before writing the object.
93It may for example produce additional output.
94If it fails, writing fails.
95.Pp
96If a
97.Fa prefix_free
98function was installed as well, that function is called
99after writing any output produced by
100.Fa prefix
101but before writing the object.
102Failure of
103.Fa prefix_free
104is silently ignored.
105.It Xr BIO_puts 3
106operates like
107.Xr BIO_write 3
108but uses the
109.Xr strlen 3
110of
111.Fa buf
112instead of a
113.Fa len
114argument.
115.It Xr BIO_flush 3
116calls the
117.Fa suffix
118callback function, if any.
119If that produces any output, it calls the
120.Fa suffix_free
121callback function, if any, silently ignoring failure.
122Finally, it calls
123.Xr BIO_flush 3
124on the next BIO in the chain.
125It fails if no data was previously written or if the
126.Fa suffix
127callback, writing, or
128.Xr BIO_flush 3
129on the next BIO fail.
130.It Xr BIO_ctrl 3
131with a
132.Fa cmd
133of
134.Dv BIO_C_SET_EX_ARG
135stores the pointer
136.Fa parg
137internally such that it will be passed to the
138.Fn asn1_ps_func
139callback functions.
140With a
141.Fa cmd
142of
143.Dv BIO_C_GET_EX_ARG ,
144it retrieves that pointer, storing it in
145.Pf * Fa parg .
146The commands
147.Dv BIO_C_SET_PREFIX ,
148.Dv BIO_C_GET_PREFIX ,
149.Dv BIO_C_SET_SUFFIX ,
150.Dv BIO_C_GET_SUFFIX ,
151and
152.Dv BIO_CTRL_FLUSH
153are used internally to implement
154.Fn BIO_asn1_set_prefix ,
155.Fn BIO_asn1_get_prefix ,
156.Fn BIO_asn1_set_suffix ,
157.Fn BIO_asn1_get_suffix
158and
159.Xr BIO_flush 3
160and are not intended for use by application programs.
161Other commands are merely forwarded to the next BIO in the chain.
162.It Xo
163.Xr BIO_read 3 ,
164.Xr BIO_gets 3 ,
165and
166.Xr BIO_callback_ctrl 3
167.Xc
168merely call the same function on the next BIO in the chain.
169.El
170.Pp
171If the above description of a function mentions the next BIO in the
172chain, that function fails if the asn1 BIO is the last BIO in the chain.
173.Pp
174.Fn BIO_asn1_set_prefix
175and
176.Fn BIO_asn1_get_prefix
177install and retrieve the
178.Fa prefix
179and
180.Fa prefix_free
181callback functions in and from the first asn1 BIO in the given
182.Fa chain .
183Similarly,
184.Fn BIO_asn1_set_suffix
185and
186.Fn BIO_asn1_get_suffix
187install and retrieve the
188.Fa suffix
189and
190.Fa suffix_free
191callback functions.
192Passing a
193.Dv NULL
194pointer for any of the
195.Fn asn1_ps_func
196arguments disables that particular callback.
197.Sh RETURN VALUES
198.Fn BIO_f_asn1
199always returns a pointer to a static built-in object.
200.Pp
201Functions of the type
202.Fn asn1_ps_func
203are supposed to return 1 on success or 0 on failure.
204.Pp
205.Fn BIO_asn1_set_prefix ,
206.Fn BIO_asn1_get_prefix ,
207.Fn BIO_asn1_set_suffix ,
208and
209.Fn BIO_asn1_get_suffix
210return 1 on success or 0 if
211.Fa chain
212is a
213.Dv NULL
214pointer or does not contain any asn1 BIO.
215They may return \-2 if a BIO is encountered in the
216.Fa chain
217that is not properly initialized.
218.Sh SEE ALSO
219.Xr ASN1_put_object 3 ,
220.Xr BIO_ctrl 3 ,
221.Xr BIO_new 3 ,
222.Xr BIO_next 3 ,
223.Xr BIO_write 3 ,
224.Xr i2d_ASN1_OCTET_STRING 3
225.Sh HISTORY
226These functions first appeared in OpenSSL 1.0.0
227and have been available since
228.Ox 4.9 .
diff --git a/src/lib/libcrypto/man/BIO_new.3 b/src/lib/libcrypto/man/BIO_new.3
index e7c08c99f1..17f5a708e8 100644
--- a/src/lib/libcrypto/man/BIO_new.3
+++ b/src/lib/libcrypto/man/BIO_new.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: BIO_new.3,v 1.21 2021/07/10 15:56:18 schwarze Exp $ 1.\" $OpenBSD: BIO_new.3,v 1.22 2021/11/27 16:18:03 schwarze Exp $
2.\" full merge up to: 2.\" full merge up to:
3.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000 3.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000
4.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100 4.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100
@@ -52,7 +52,7 @@
52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 52.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
53.\" OF THE POSSIBILITY OF SUCH DAMAGE. 53.\" OF THE POSSIBILITY OF SUCH DAMAGE.
54.\" 54.\"
55.Dd $Mdocdate: July 10 2021 $ 55.Dd $Mdocdate: November 27 2021 $
56.Dt BIO_NEW 3 56.Dt BIO_NEW 3
57.Os 57.Os
58.Sh NAME 58.Sh NAME
@@ -230,6 +230,7 @@ Create a memory BIO:
230.Sh SEE ALSO 230.Sh SEE ALSO
231.Xr BIO_ctrl 3 , 231.Xr BIO_ctrl 3 ,
232.Xr BIO_dump 3 , 232.Xr BIO_dump 3 ,
233.Xr BIO_f_asn1 3 ,
233.Xr BIO_f_base64 3 , 234.Xr BIO_f_base64 3 ,
234.Xr BIO_f_buffer 3 , 235.Xr BIO_f_buffer 3 ,
235.Xr BIO_f_cipher 3 , 236.Xr BIO_f_cipher 3 ,
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 6a0d65cb85..6d5f8d982b 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.220 2021/11/22 16:19:54 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.221 2021/11/27 16:18:03 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -35,6 +35,7 @@ MAN= \
35 BF_set_key.3 \ 35 BF_set_key.3 \
36 BIO_ctrl.3 \ 36 BIO_ctrl.3 \
37 BIO_dump.3 \ 37 BIO_dump.3 \
38 BIO_f_asn1.3 \
38 BIO_f_base64.3 \ 39 BIO_f_base64.3 \
39 BIO_f_buffer.3 \ 40 BIO_f_buffer.3 \
40 BIO_f_cipher.3 \ 41 BIO_f_cipher.3 \