summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2016-11-20 19:08:51 +0000
committerschwarze <>2016-11-20 19:08:51 +0000
commit856db5bc9b526336f448f89beecb4a4bf337bdf0 (patch)
tree808dc66a020d7828a9e1a700c158db38c4074e76
parent00cac3b96abdb90490e48628abaad694d1ed0786 (diff)
downloadopenbsd-856db5bc9b526336f448f89beecb4a4bf337bdf0.tar.gz
openbsd-856db5bc9b526336f448f89beecb4a4bf337bdf0.tar.bz2
openbsd-856db5bc9b526336f448f89beecb4a4bf337bdf0.zip
Add Copyright and license.
Merge documentatin of BUF_MEM_grow_clean(3) and BUF_reverse(3) from OpenSSL. Mention that BUF_MEM_free(3) accepts NULL.
-rw-r--r--src/lib/libcrypto/man/BUF_MEM_new.390
1 files changed, 88 insertions, 2 deletions
diff --git a/src/lib/libcrypto/man/BUF_MEM_new.3 b/src/lib/libcrypto/man/BUF_MEM_new.3
index f658048a93..70e7189545 100644
--- a/src/lib/libcrypto/man/BUF_MEM_new.3
+++ b/src/lib/libcrypto/man/BUF_MEM_new.3
@@ -1,12 +1,62 @@
1.\" $OpenBSD: BUF_MEM_new.3,v 1.5 2016/11/10 14:34:18 jmc Exp $ 1.\" $OpenBSD: BUF_MEM_new.3,v 1.6 2016/11/20 19:08:51 schwarze Exp $
2.\" OpenSSL 18edda0f Sep 20 03:28:54 2000 +0000
2.\" 3.\"
3.Dd $Mdocdate: November 10 2016 $ 4.\" This file was written by Ralf S. Engelschall <rse@openssl.org>.
5.\" Copyright (c) 1999, 2000, 2016 The OpenSSL Project. All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\"
11.\" 1. Redistributions of source code must retain the above copyright
12.\" notice, this list of conditions and the following disclaimer.
13.\"
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in
16.\" the documentation and/or other materials provided with the
17.\" distribution.
18.\"
19.\" 3. All advertising materials mentioning features or use of this
20.\" software must display the following acknowledgment:
21.\" "This product includes software developed by the OpenSSL Project
22.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
23.\"
24.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
25.\" endorse or promote products derived from this software without
26.\" prior written permission. For written permission, please contact
27.\" openssl-core@openssl.org.
28.\"
29.\" 5. Products derived from this software may not be called "OpenSSL"
30.\" nor may "OpenSSL" appear in their names without prior written
31.\" permission of the OpenSSL Project.
32.\"
33.\" 6. Redistributions of any form whatsoever must retain the following
34.\" acknowledgment:
35.\" "This product includes software developed by the OpenSSL Project
36.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
37.\"
38.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
39.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
41.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
42.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
43.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
44.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49.\" OF THE POSSIBILITY OF SUCH DAMAGE.
50.\"
51.Dd $Mdocdate: November 20 2016 $
4.Dt BUF_MEM_NEW 3 52.Dt BUF_MEM_NEW 3
5.Os 53.Os
6.Sh NAME 54.Sh NAME
7.Nm BUF_MEM_new , 55.Nm BUF_MEM_new ,
8.Nm BUF_MEM_free , 56.Nm BUF_MEM_free ,
9.Nm BUF_MEM_grow , 57.Nm BUF_MEM_grow ,
58.Nm BUF_MEM_grow_clean ,
59.Nm BUF_reverse ,
10.Nm BUF_strdup 60.Nm BUF_strdup
11.Nd simple character arrays structure 61.Nd simple character arrays structure
12.Sh SYNOPSIS 62.Sh SYNOPSIS
@@ -24,6 +74,17 @@
24.Fa "BUF_MEM *str" 74.Fa "BUF_MEM *str"
25.Fa "size_t len" 75.Fa "size_t len"
26.Fc 76.Fc
77.Ft size_t
78.Fo BUF_MEM_grow_clean
79.Fa "BUF_MEM *str"
80.Fa "size_t len"
81.Fc
82.Ft void
83.Fo BUF_reverse
84.Fa "unsigned char *out"
85.Fa "const unsigned char *in"
86.Fa "size_t len"
87.Fc
27.Ft char * 88.Ft char *
28.Fo BUF_strdup 89.Fo BUF_strdup
29.Fa "const char *str" 90.Fa "const char *str"
@@ -58,12 +119,35 @@ allocates a new buffer of zero size.
58frees up an already existing buffer. 119frees up an already existing buffer.
59The data is zeroed before freeing up in case the buffer contains 120The data is zeroed before freeing up in case the buffer contains
60sensitive data. 121sensitive data.
122If
123.Fa a
124is a
125.Dv NULL
126pointer, no action occurs.
61.Pp 127.Pp
62.Fn BUF_MEM_grow 128.Fn BUF_MEM_grow
63changes the size of an already existing buffer to 129changes the size of an already existing buffer to
64.Fa len . 130.Fa len .
65Any data already in the buffer is preserved if it increases in size. 131Any data already in the buffer is preserved if it increases in size.
66.Pp 132.Pp
133.Fn BUF_MEM_grow_clean
134is similar to
135.Fn BUF_MEM_grow ,
136but it sets any freed or additionally allocated memory to zero.
137.Pp
138.Fn BUF_reverse
139reverses
140.Fa len
141bytes at
142.Fa in
143into
144.Fa out .
145If
146.Fa out
147is
148.Dv NULL ,
149the array is reversed in place.
150.Pp
67.Fn BUF_strdup 151.Fn BUF_strdup
68copies a NUL terminated string into a block of allocated memory and 152copies a NUL terminated string into a block of allocated memory and
69returns a pointer to the allocated block. 153returns a pointer to the allocated block.
@@ -90,6 +174,8 @@ returns the buffer or
90on error. 174on error.
91.Pp 175.Pp
92.Fn BUF_MEM_grow 176.Fn BUF_MEM_grow
177and
178.Fn BUF_MEM_grow_clean
93returns zero on error or the new size (i.e.\& 179returns zero on error or the new size (i.e.\&
94.Fa len ) . 180.Fa len ) .
95.Sh SEE ALSO 181.Sh SEE ALSO