]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/BUF_MEM_new.pod
Expand the XTS documentation
[thirdparty/openssl.git] / doc / man3 / BUF_MEM_new.pod
CommitLineData
74235cc9
UM
1=pod
2
3=head1 NAME
4
6061f80b 5BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow,
c952780c
RS
6BUF_MEM_grow_clean, BUF_reverse
7- simple character array structure
58e3457a 8
74235cc9
UM
9=head1 SYNOPSIS
10
11 #include <openssl/buffer.h>
12
13 BUF_MEM *BUF_MEM_new(void);
14
58e3457a 15 BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
74924dcb 16
c952780c 17 void BUF_MEM_free(BUF_MEM *a);
74235cc9 18
c952780c
RS
19 int BUF_MEM_grow(BUF_MEM *str, int len);
20 size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
21
22 void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size);
74235cc9 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
c952780c
RS
42BUF_MEM_grow_clean() is similar to BUF_MEM_grow() but it sets any free'd
43or additionally-allocated memory to zero.
44
498180de 45BUF_reverse() reverses B<size> bytes at B<in> into B<out>. If B<in>
c952780c
RS
46is NULL, the array is reversed in-place.
47
74235cc9
UM
48=head1 RETURN VALUES
49
50BUF_MEM_new() returns the buffer or NULL on error.
51
52BUF_MEM_free() has no return value.
53
c952780c
RS
54BUF_MEM_grow() and BUF_MEM_grow_clean() return
55zero on error or the new size (i.e., B<len>).
74235cc9
UM
56
57=head1 SEE ALSO
58
b97fdb57 59L<bio(7)>,
74924dcb 60L<CRYPTO_secure_malloc(3)>.
74235cc9
UM
61
62=head1 HISTORY
63
fc5ecadd 64The BUF_MEM_new_ex() function was added in OpenSSL 1.1.0.
74924dcb 65
e2f92610
RS
66=head1 COPYRIGHT
67
fd38836b 68Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
e2f92610 69
4746f25a 70Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
71this file except in compliance with the License. You can obtain a copy
72in the file LICENSE in the source distribution or at
73L<https://www.openssl.org/source/license.html>.
74
75=cut