5 BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow - simple
6 character array structure
8 standard C library equivalents
12 #include <openssl/buffer.h>
14 BUF_MEM *BUF_MEM_new(void);
16 #define BUF_MEM_FLAG_SECURE
18 BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
20 void BUF_MEM_free(BUF_MEM *a);
22 int BUF_MEM_grow(BUF_MEM *str, int len);
26 The buffer library handles simple character arrays. Buffers are used for
27 various purposes in the library, most notably memory BIOs.
29 BUF_MEM_new() allocates a new buffer of zero size.
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)>.
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.
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
44 BUF_MEM_new() returns the buffer or NULL on error.
46 BUF_MEM_free() has no return value.
48 BUF_MEM_grow() returns zero on error or the new size (i.e. B<len>).
53 L<CRYPTO_secure_malloc(3)>.
57 BUF_MEM_new_ex() was added in OpenSSL 1.1.0.