]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/crypto/buffer.pod
Rename some BUF_xxx to OPENSSL_xxx
[thirdparty/openssl.git] / doc / crypto / buffer.pod
CommitLineData
74235cc9
UM
1=pod
2
3=head1 NAME
4
58e3457a
EK
5BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow - simple
6character array structure
7
58e3457a 8standard C library equivalents
74235cc9
UM
9
10=head1 SYNOPSIS
11
12 #include <openssl/buffer.h>
13
14 BUF_MEM *BUF_MEM_new(void);
15
74924dcb
RS
16 #define BUF_MEM_FLAG_SECURE
17
58e3457a 18 BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
74924dcb 19
74235cc9
UM
20 void BUF_MEM_free(BUF_MEM *a);
21
22 int BUF_MEM_grow(BUF_MEM *str, int len);
23
58e3457a
EK
24=head1 DESCRIPTION
25
26The buffer library handles simple character arrays. Buffers are used for
27various purposes in the library, most notably memory BIOs.
74235cc9
UM
28
29BUF_MEM_new() allocates a new buffer of zero size.
30
74924dcb
RS
31BUF_MEM_new_ex() allocates a buffer with the specified flags.
32The flag B<BUF_MEM_FLAG_SECURE> specifies that the B<data> pointer
33should be allocated on the secure heap; see L<CRYPTO_secure_malloc(3)>.
34
74235cc9
UM
35BUF_MEM_free() frees up an already existing buffer. The data is zeroed
36before freeing up in case the buffer contains sensitive data.
37
38BUF_MEM_grow() changes the size of an already existing buffer to
39B<len>. Any data already in the buffer is preserved if it increases in
40size.
41
74235cc9
UM
42=head1 RETURN VALUES
43
44BUF_MEM_new() returns the buffer or NULL on error.
45
46BUF_MEM_free() has no return value.
47
48BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>).
49
50=head1 SEE ALSO
51
9b86974e 52L<bio(3)>,
74924dcb 53L<CRYPTO_secure_malloc(3)>.
74235cc9
UM
54
55=head1 HISTORY
56
a528d4f0 57BUF_MEM_new_ex() was added in OpenSSL 1.1.0.
74924dcb 58
74235cc9 59=cut