Mbed TLS v2.28.8
Loading...
Searching...
No Matches
memory_buffer_alloc.h
Go to the documentation of this file.
1
6/*
7 * Copyright The Mbed TLS Contributors
8 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
9 */
10#ifndef MBEDTLS_MEMORY_BUFFER_ALLOC_H
11#define MBEDTLS_MEMORY_BUFFER_ALLOC_H
12
13#if !defined(MBEDTLS_CONFIG_FILE)
14#include "mbedtls/config.h"
15#else
16#include MBEDTLS_CONFIG_FILE
17#endif
18
19#include <stddef.h>
20
29#if !defined(MBEDTLS_MEMORY_ALIGN_MULTIPLE)
30#define MBEDTLS_MEMORY_ALIGN_MULTIPLE 4
31#endif
32
35#define MBEDTLS_MEMORY_VERIFY_NONE 0
36#define MBEDTLS_MEMORY_VERIFY_ALLOC (1 << 0)
37#define MBEDTLS_MEMORY_VERIFY_FREE (1 << 1)
38#define MBEDTLS_MEMORY_VERIFY_ALWAYS (MBEDTLS_MEMORY_VERIFY_ALLOC | \
39 MBEDTLS_MEMORY_VERIFY_FREE)
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
60void mbedtls_memory_buffer_alloc_init(unsigned char *buf, size_t len);
61
66
76
77#if defined(MBEDTLS_MEMORY_DEBUG)
84void mbedtls_memory_buffer_alloc_status(void);
85
94void mbedtls_memory_buffer_alloc_max_get(size_t *max_used, size_t *max_blocks);
95
99void mbedtls_memory_buffer_alloc_max_reset(void);
100
109void mbedtls_memory_buffer_alloc_cur_get(size_t *cur_used, size_t *cur_blocks);
110#endif /* MBEDTLS_MEMORY_DEBUG */
111
124
125#if defined(MBEDTLS_SELF_TEST)
132#endif
133
134#ifdef __cplusplus
135}
136#endif
137
138#endif /* memory_buffer_alloc.h */
Configuration options (set of defines)
int mbedtls_memory_buffer_alloc_verify(void)
Verifies that all headers in the memory buffer are correct and contain sane values....
void mbedtls_memory_buffer_set_verify(int verify)
Determine when the allocator should automatically verify the state of the entire chain of headers / m...
int mbedtls_memory_buffer_alloc_self_test(int verbose)
Checkup routine.
void mbedtls_memory_buffer_alloc_init(unsigned char *buf, size_t len)
Initialize use of stack-based memory allocator. The stack-based allocator does memory management insi...
void mbedtls_memory_buffer_alloc_free(void)
Free the mutex for thread-safety and clear remaining memory.