xref: /optee_os/lib/libutils/isoc/include/malloc_flags.h (revision 45fecab081173ef58b1cb14b6ddf6892b0b9d3f6)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2025, Linaro Limited.
4  */
5 #ifndef __MALLOC_FLAGS_H
6 #define __MALLOC_FLAGS_H
7 
8 /*
9  * This file doesn't have any dependencies to minimize impact when
10  * including this file.
11  *
12  * Pulling in for instance <util.h> for the BIT() macro would also define
13  * the MIN() macro which would cause a error in
14  * core/lib/libtomcrypt/src/pk/dsa/dsa_decrypt_key.c
15  */
16 
17 /*
18  * Memory allocation flags to control how buffers are allocated. Flags may
19  * be ignored depending on configuration or if they don't apply. These
20  * flags are primarily used by malloc() and friends in malloc.h, but can be
21  * extended with flags that only mean something for other functions to
22  * avoid needless translation of one class of flags to another class of
23  * flags.
24  */
25 #define MAF_NULL	0x0	/* Passed if no flags are needed */
26 #define MAF_ZERO_INIT	0x1	/* Zero initialize the allocated buffer */
27 #define MAF_NEX		0x2	/* Allocate from nexus heap */
28 #define MAF_FREE_WIPE	0x4	/* Free wipes allocated buffer */
29 
30 #endif /*__MALLOC_FLAGS_H*/
31