1BUF_MEM_NEW(3) OpenSSL BUF_MEM_NEW(3)
2
3
4
6 BUF_MEM_new, BUF_MEM_new_ex, BUF_MEM_free, BUF_MEM_grow,
7 BUF_MEM_grow_clean, BUF_reverse - simple character array structure
8
10 #include <openssl/buffer.h>
11
12 BUF_MEM *BUF_MEM_new(void);
13
14 BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
15
16 void BUF_MEM_free(BUF_MEM *a);
17
18 int BUF_MEM_grow(BUF_MEM *str, int len);
19 size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
20
21 void BUF_reverse(unsigned char *out, const unsigned char *in, size_t size);
22
24 The buffer library handles simple character arrays. Buffers are used
25 for various purposes in the library, most notably memory BIOs.
26
27 BUF_MEM_new() allocates a new buffer of zero size.
28
29 BUF_MEM_new_ex() allocates a buffer with the specified flags. The flag
30 BUF_MEM_FLAG_SECURE specifies that the data pointer should be allocated
31 on the secure heap; see CRYPTO_secure_malloc(3).
32
33 BUF_MEM_free() frees up an already existing buffer. The data is zeroed
34 before freeing up in case the buffer contains sensitive data.
35
36 BUF_MEM_grow() changes the size of an already existing buffer to len.
37 Any data already in the buffer is preserved if it increases in size.
38
39 BUF_MEM_grow_clean() is similar to BUF_MEM_grow() but it sets any
40 free'd or additionally-allocated memory to zero.
41
42 BUF_reverse() reverses size bytes at in into out. If in is NULL, the
43 array is reversed in-place.
44
46 BUF_MEM_new() returns the buffer or NULL on error.
47
48 BUF_MEM_free() has no return value.
49
50 BUF_MEM_grow() and BUF_MEM_grow_clean() return zero on error or the new
51 size (i.e., len).
52
54 bio(7), CRYPTO_secure_malloc(3).
55
57 The BUF_MEM_new_ex() function was added in OpenSSL 1.1.0.
58
60 Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
61
62 Licensed under the OpenSSL license (the "License"). You may not use
63 this file except in compliance with the License. You can obtain a copy
64 in the file LICENSE in the source distribution or at
65 <https://www.openssl.org/source/license.html>.
66
67
68
691.1.1i 2021-07-22 BUF_MEM_NEW(3)