summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/BIO_meth_new.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/BIO_meth_new.3')
-rw-r--r--src/lib/libcrypto/man/BIO_meth_new.3269
1 files changed, 269 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/BIO_meth_new.3 b/src/lib/libcrypto/man/BIO_meth_new.3
new file mode 100644
index 0000000000..d50b7ffc76
--- /dev/null
+++ b/src/lib/libcrypto/man/BIO_meth_new.3
@@ -0,0 +1,269 @@
1.\" $OpenBSD: BIO_meth_new.3,v 1.1 2018/02/17 23:24:38 schwarze Exp $
2.\" selective merge up to: OpenSSL 61f805c1 Jan 16 01:01:46 2018 +0800
3.\"
4.\" This file is a derived work.
5.\" The changes are covered by the following Copyright and license:
6.\"
7.\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org>
8.\"
9.\" Permission to use, copy, modify, and distribute this software for any
10.\" purpose with or without fee is hereby granted, provided that the above
11.\" copyright notice and this permission notice appear in all copies.
12.\"
13.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20.\"
21.\" The original file was written by Matt Caswell <matt@openssl.org>
22.\" Copyright (c) 2016 The OpenSSL Project. All rights reserved.
23.\"
24.\" Redistribution and use in source and binary forms, with or without
25.\" modification, are permitted provided that the following conditions
26.\" are met:
27.\"
28.\" 1. Redistributions of source code must retain the above copyright
29.\" notice, this list of conditions and the following disclaimer.
30.\"
31.\" 2. Redistributions in binary form must reproduce the above copyright
32.\" notice, this list of conditions and the following disclaimer in
33.\" the documentation and/or other materials provided with the
34.\" distribution.
35.\"
36.\" 3. All advertising materials mentioning features or use of this
37.\" software must display the following acknowledgment:
38.\" "This product includes software developed by the OpenSSL Project
39.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
40.\"
41.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
42.\" endorse or promote products derived from this software without
43.\" prior written permission. For written permission, please contact
44.\" openssl-core@openssl.org.
45.\"
46.\" 5. Products derived from this software may not be called "OpenSSL"
47.\" nor may "OpenSSL" appear in their names without prior written
48.\" permission of the OpenSSL Project.
49.\"
50.\" 6. Redistributions of any form whatsoever must retain the following
51.\" acknowledgment:
52.\" "This product includes software developed by the OpenSSL Project
53.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
54.\"
55.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
56.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
58.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
59.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
60.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
61.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
62.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
63.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
64.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
65.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
66.\" OF THE POSSIBILITY OF SUCH DAMAGE.
67.\"
68.Dd $Mdocdate: February 17 2018 $
69.Dt BIO_METH_NEW 3
70.Os
71.Sh NAME
72.Nm BIO_meth_new ,
73.Nm BIO_meth_free ,
74.Nm BIO_meth_set_write ,
75.Nm BIO_meth_set_read ,
76.Nm BIO_meth_set_puts ,
77.Nm BIO_meth_set_ctrl ,
78.Nm BIO_meth_set_create ,
79.Nm BIO_meth_set_destroy
80.Nd manipulate BIO_METHOD structures
81.Sh SYNOPSIS
82.In openssl/bio.h
83.Ft BIO_METHOD *
84.Fo BIO_meth_new
85.Fa "int type"
86.Fa "const char *name"
87.Fc
88.Ft void
89.Fo BIO_meth_free
90.Fa "BIO_METHOD *biom"
91.Fc
92.Ft int
93.Fo BIO_meth_set_write
94.Fa "BIO_METHOD *biom"
95.Fa "int (*write)(BIO *, const char *, int)"
96.Fc
97.Ft int
98.Fo BIO_meth_set_read
99.Fa "BIO_METHOD *biom"
100.Fa "int (*read)(BIO *, char *, int)"
101.Fc
102.Ft int
103.Fo BIO_meth_set_puts
104.Fa "BIO_METHOD *biom"
105.Fa "int (*puts)(BIO *, const char *)"
106.Fc
107.Ft int
108.Fo BIO_meth_set_ctrl
109.Fa "BIO_METHOD *biom"
110.Fa "long (*ctrl)(BIO *, int, long, void *)"
111.Fc
112.Ft int
113.Fo BIO_meth_set_create
114.Fa "BIO_METHOD *biom"
115.Fa "int (*create)(BIO *)"
116.Fc
117.Ft int
118.Fo BIO_meth_set_destroy
119.Fa "BIO_METHOD *biom"
120.Fa "int (*destroy)(BIO *)"
121.Fc
122.Sh DESCRIPTION
123The
124.Vt BIO_METHOD
125structure stores function pointers implementing a
126.Vt BIO
127type.
128See
129.Xr BIO_new 3
130for more information about
131.Vt BIO
132objects.
133.Pp
134.Fn BIO_meth_new
135creates a new
136.Vt BIO_METHOD
137structure.
138It requires a unique integer
139.Fa type .
140The
141.Fa name
142pointer is stored in the structure and will not be freed by
143.Fn BIO_meth_free .
144.Pp
145The standard BIO types are listed in
146.In openssl/bio.h .
147Some examples include
148.Dv BIO_TYPE_BUFFER
149and
150.Dv BIO_TYPE_CIPHER .
151The
152.Fa type
153of filter BIOs should have the
154.Dv BIO_TYPE_FILTER
155bit set.
156Source/sink BIOs should have the
157.Dv BIO_TYPE_SOURCE_SINK
158bit set.
159File descriptor based BIOs (e.g. socket, fd, connect, accept etc.\&)
160should additionally have the
161.Dv BIO_TYPE_DESCRIPTOR
162bit set.
163See
164.Xr BIO_find_type 3
165for more information.
166.Pp
167.Fn BIO_meth_free
168is an alias for
169.Xr free 3 .
170.Pp
171.Fn BIO_meth_set_write
172and
173.Fn BIO_meth_set_read
174set the functions
175.Fa write
176and
177.Fa read
178used for writing and reading arbitrary length data to and from the
179.Vt BIO .
180These functions are called from
181.Xr BIO_write 3
182and
183.Xr BIO_read 3 ,
184respectively.
185The parameters and return values of
186.Fa write
187and
188.Fa read
189have the same meaning as for
190.Xr BIO_write 3
191and
192.Xr BIO_read 3 .
193.Pp
194.Fn BIO_meth_set_puts
195sets the function
196.Fa puts
197used for writing a NUL-terminated string to the
198.Vt BIO .
199This function is called from
200.Xr BIO_puts 3 .
201The parameters and the return value of
202.Fa puts
203have the same meaning as for
204.Xr BIO_puts 3 .
205.Pp
206.Fn BIO_meth_set_ctrl
207sets the function
208.Fa ctrl
209used for processing control messages in the
210.Vt BIO .
211This function is called from
212.Xr BIO_ctrl 3 .
213The parameters and return value of
214.Fa ctrl
215have the same meaning as for
216.Xr BIO_ctrl 3 .
217.Pp
218.Fn BIO_meth_set_create
219sets a function
220.Fa create
221used while initializing a new instance of the
222.Vt BIO .
223This function is called from
224.Xr BIO_new 3 .
225The
226.Xr BIO_new 3
227function allocates the memory for the new
228.Vt BIO ,
229and a pointer to this newly allocated structure is passed
230as the parameter to
231.Fa create .
232.Pp
233.Fn BIO_meth_set_destroy
234sets a function
235.Fa destroy
236used while destroying an instance of a
237.Vt BIO .
238This function is called from
239.Xr BIO_free 3 .
240A pointer to the
241.Vt BIO
242to be destroyed is passed as the parameter.
243The
244.Fa destroy
245function is intended to perform clean-up specific to the
246.Vt BIO
247.Fa type .
248The memory for the
249.Vt BIO
250itself must not be freed by this function.
251.Sh RETURN VALUES
252.Fn BIO_meth_new
253returns the new
254.Vt BIO_METHOD
255structure or
256.Dv NULL
257if an error occurs.
258.Pp
259The
260.Fn BIO_meth_set_*
261functions return 1 on success or 0 on error.
262Currently, they cannot fail.
263.Sh SEE ALSO
264.Xr BIO_ctrl 3 ,
265.Xr BIO_find_type 3 ,
266.Xr BIO_new 3 ,
267.Xr BIO_read 3
268.Sh HISTORY
269These functions first appeared in OpenSSL 1.1.0.