summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorschwarze <>2015-05-24 15:44:52 +0000
committerschwarze <>2015-05-24 15:44:52 +0000
commit4ecb35c8702ae9bf7de323d549724d7f1d436a06 (patch)
treef40277888d65df9cdaf3fcbb7af8a4259f7f36f1 /src
parent1642fcb0a2cd3851e9b862e7e1d8403ee01bbb38 (diff)
downloadopenbsd-4ecb35c8702ae9bf7de323d549724d7f1d436a06.tar.gz
openbsd-4ecb35c8702ae9bf7de323d549724d7f1d436a06.tar.bz2
openbsd-4ecb35c8702ae9bf7de323d549724d7f1d436a06.zip
Maximilian dot Fillinger at uni-duesseldorf dot de
starts helping with the pod2mdoc(1)-based conversion of LibreSSL crypto manuals from perlpod(1) to mdoc(7). Here comes the first file, slightly tweaked by me.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/BUF_MEM_new.3107
-rw-r--r--src/lib/libcrypto/man/Makefile4
-rw-r--r--src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod72
3 files changed, 109 insertions, 74 deletions
diff --git a/src/lib/libcrypto/man/BUF_MEM_new.3 b/src/lib/libcrypto/man/BUF_MEM_new.3
new file mode 100644
index 0000000000..a423d4e0bc
--- /dev/null
+++ b/src/lib/libcrypto/man/BUF_MEM_new.3
@@ -0,0 +1,107 @@
1.Dd $Mdocdate: May 24 2015 $
2.Dt BUF_MEM_NEW 3
3.Os
4.Sh NAME
5.Nm BUF_MEM_new ,
6.Nm BUF_MEM_free ,
7.Nm BUF_MEM_grow ,
8.Nm BUF_strdup
9.Nd simple character arrays structure
10.Sh SYNOPSIS
11.In openssl/buffer.h
12.Ft BUF_MEM *
13.Fo BUF_MEM_new
14.Fa void
15.Fc
16.Ft void
17.Fo BUF_MEM_free
18.Fa "BUF_MEM *a"
19.Fc
20.Ft int
21.Fo BUF_MEM_grow
22.Fa "BUF_MEM *str"
23.Fa "size_t len"
24.Fc
25.Ft char *
26.Fo BUF_strdup
27.Fa "const char *str"
28.Fc
29.Sh DESCRIPTION
30The buffer library handles simple character arrays.
31Buffers are used for various purposes in the library, most notably
32memory BIOs.
33.Pp
34The library uses the
35.Vt BUF_MEM
36structure defined in buffer.h:
37.Bd -literal
38typedef struct buf_mem_st
39{
40 size_t length; /* current number of bytes */
41 char *data;
42 size_t max; /* size of buffer */
43} BUF_MEM;
44.Ed
45.Pp
46.Fa length
47is the current size of the buffer in bytes,
48.Fa max
49is the amount of memory allocated to the buffer.
50There are three functions which handle these and one
51.Dq miscellaneous
52function.
53.Pp
54.Fn BUF_MEM_new
55allocates a new buffer of zero size.
56.Pp
57.Fn BUF_MEM_free
58frees up an already existing buffer.
59The data is zeroed before freeing up in case the buffer contains
60sensitive data.
61.Pp
62.Fn BUF_MEM_grow
63changes the size of an already existing buffer to
64.Fa len .
65Any data already in the buffer is preserved if it increases in size.
66.Pp
67.Fn BUF_strdup
68copies a NUL terminated string into a block of allocated memory and
69returns a pointer to the allocated block.
70Unlike the system
71.Xr strdup 3
72function,
73.Fn BUF_strdup
74will accept a
75.Dv NULL
76argument and will return
77.Dv NULL
78in that case.
79Its use in new programes is discouraged.
80.Pp
81The memory allocated from
82.Fn BUF_strdup
83should be freed up using the
84.Xr free 3
85function.
86.Sh RETURN VALUES
87.Fn BUF_MEM_new
88returns the buffer or
89.Dv NULL
90on error.
91.Pp
92.Fn BUF_MEM_free
93returns no value.
94.Pp
95.Fn BUF_MEM_grow
96returns zero on error or the new size (i.e.
97.Fa len Ns ).
98.Sh SEE ALSO
99.Xr bio 3
100.Sh HISTORY
101.Fn BUF_MEM_new ,
102.Fn BUF_MEM_free
103and
104.Fn BUF_MEM_grow
105are available in all versions of SSLeay and OpenSSL.
106.Fn BUF_strdup
107was added in SSLeay 0.8.
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index bce02f647f..872391db3e 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.19 2015/02/23 17:43:24 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.20 2015/05/24 15:44:52 schwarze Exp $
2 2
3.include <bsd.own.mk> # for NOMAN 3.include <bsd.own.mk> # for NOMAN
4 4
@@ -51,9 +51,9 @@ MAN= \
51 BN_set_bit.3 \ 51 BN_set_bit.3 \
52 BN_swap.3 \ 52 BN_swap.3 \
53 BN_zero.3 \ 53 BN_zero.3 \
54 BUF_MEM_new.3 \
54 55
55GENMAN= \ 56GENMAN= \
56 BUF_MEM_new.3 \
57 CONF_modules_free.3 \ 57 CONF_modules_free.3 \
58 CONF_modules_load_file.3 \ 58 CONF_modules_load_file.3 \
59 CRYPTO_set_ex_data.3 \ 59 CRYPTO_set_ex_data.3 \
diff --git a/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod b/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod
deleted file mode 100644
index 2805755869..0000000000
--- a/src/lib/libssl/src/doc/crypto/BUF_MEM_new.pod
+++ /dev/null
@@ -1,72 +0,0 @@
1=pod
2
3=head1 NAME
4
5BUF_MEM_new, BUF_MEM_free, BUF_MEM_grow, BUF_strdup - simple
6character arrays structure
7
8=head1 SYNOPSIS
9
10 #include <openssl/buffer.h>
11
12 BUF_MEM *BUF_MEM_new(void);
13
14 void BUF_MEM_free(BUF_MEM *a);
15
16 int BUF_MEM_grow(BUF_MEM *str, size_t len);
17
18 char * BUF_strdup(const char *str);
19
20=head1 DESCRIPTION
21
22The buffer library handles simple character arrays. Buffers are used for
23various purposes in the library, most notably memory BIOs.
24
25The library uses the BUF_MEM structure defined in buffer.h:
26
27 typedef struct buf_mem_st
28 {
29 size_t length; /* current number of bytes */
30 char *data;
31 size_t max; /* size of buffer */
32 } BUF_MEM;
33
34B<length> is the current size of the buffer in bytes, B<max> is the amount of
35memory allocated to the buffer. There are three functions which handle these
36and one "miscellaneous" function.
37
38BUF_MEM_new() allocates a new buffer of zero size.
39
40BUF_MEM_free() frees up an already existing buffer. The data is zeroed
41before freeing up in case the buffer contains sensitive data.
42
43BUF_MEM_grow() changes the size of an already existing buffer to
44B<len>. Any data already in the buffer is preserved if it increases in
45size.
46
47BUF_strdup() copies a null terminated string into a block of allocated memory
48and returns a pointer to the allocated block. Unlike the system strdup()
49function, BUF_strdup() will accept a NULL argument and will return NULL in
50that case. Its use in new programes is discouraged.
51
52The memory allocated from BUF_strdup() should be freed up using the
53free() function.
54
55=head1 RETURN VALUES
56
57BUF_MEM_new() returns the buffer or NULL on error.
58
59BUF_MEM_free() has no return value.
60
61BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>).
62
63=head1 SEE ALSO
64
65L<bio(3)|bio(3)>
66
67=head1 HISTORY
68
69BUF_MEM_new(), BUF_MEM_free() and BUF_MEM_grow() are available in all
70versions of SSLeay and OpenSSL. BUF_strdup() was added in SSLeay 0.8.
71
72=cut