1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

lib:replace: Add macros to burn data from memory

This will explicitly zero data from memory. This is guaranteed to be not
optimized away.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andreas Schneider 2022-07-19 13:36:57 +02:00 committed by Andreas Schneider
parent 61aeb77407
commit 8b22b448e8

View File

@ -846,6 +846,24 @@ typedef unsigned long long ptrdiff_t ;
*/ */
#define ZERO_ARRAY_LEN(x, l) memset_s((char *)(x), (l), 0, (l)) #define ZERO_ARRAY_LEN(x, l) memset_s((char *)(x), (l), 0, (l))
/**
* Explicitly zero data from memory. This is guaranteed to be not optimized
* away.
*/
#define BURN_DATA(x) memset_s((char *)&(x), sizeof(x), 0, sizeof(x))
/**
* Explicitly zero data from memory. This is guaranteed to be not optimized
* away.
*/
#define BURN_DATA_SIZE(x, s) memset_s((char *)&(x), (s), 0, (s))
/**
* Explicitly zero data from memory. This is guaranteed to be not optimized
* away.
*/
#define BURN_PTR_SIZE(x, s) memset_s((x), (s), 0, (s))
/** /**
* Work out how many elements there are in a static array. * Work out how many elements there are in a static array.
*/ */