]>
Commit | Line | Data |
---|---|---|
74235cc9 UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
58e3457a EK |
5 | BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow - simple |
6 | character array structure | |
7 | ||
58e3457a | 8 | standard 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 | ||
26 | The buffer library handles simple character arrays. Buffers are used for | |
27 | various purposes in the library, most notably memory BIOs. | |
74235cc9 UM |
28 | |
29 | BUF_MEM_new() allocates a new buffer of zero size. | |
30 | ||
74924dcb RS |
31 | BUF_MEM_new_ex() allocates a buffer with the specified flags. |
32 | The flag B<BUF_MEM_FLAG_SECURE> specifies that the B<data> pointer | |
33 | should be allocated on the secure heap; see L<CRYPTO_secure_malloc(3)>. | |
34 | ||
74235cc9 UM |
35 | BUF_MEM_free() frees up an already existing buffer. The data is zeroed |
36 | before freeing up in case the buffer contains sensitive data. | |
37 | ||
38 | BUF_MEM_grow() changes the size of an already existing buffer to | |
39 | B<len>. Any data already in the buffer is preserved if it increases in | |
40 | size. | |
41 | ||
74235cc9 UM |
42 | =head1 RETURN VALUES |
43 | ||
44 | BUF_MEM_new() returns the buffer or NULL on error. | |
45 | ||
46 | BUF_MEM_free() has no return value. | |
47 | ||
48 | BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>). | |
49 | ||
50 | =head1 SEE ALSO | |
51 | ||
9b86974e | 52 | L<bio(3)>, |
74924dcb | 53 | L<CRYPTO_secure_malloc(3)>. |
74235cc9 UM |
54 | |
55 | =head1 HISTORY | |
56 | ||
a528d4f0 | 57 | BUF_MEM_new_ex() was added in OpenSSL 1.1.0. |
74924dcb | 58 | |
74235cc9 | 59 | =cut |