Implement wxSecureZeroMemory() for clearing memory securely

Wrap native function when possible, and fallback to a generic
implementation.

Closes https://github.com/wxWidgets/wxWidgets/pull/2582
This commit is contained in:
Lauri Nurmi
2021-11-05 18:28:07 +02:00
committed by Vadim Zeitlin
parent 4f7e09374a
commit 90c20798b9
4 changed files with 70 additions and 0 deletions

View File

@@ -335,6 +335,23 @@ bool wxGetEnvMap(wxEnvVariableHashMap *map);
/** @addtogroup group_funcmacro_misc */
//@{
/**
Fills the memory block with zeros in a way that is guaranteed
not to be optimized away by the compiler.
@param p Pointer to the memory block to be zeroed, must be non-@NULL.
@param n The number of bytes to zero.
NOTE: If security is vitally important in your use case, please
have a look at the implementations and decide whether you trust
them to behave as promised.
@header{wx/utils.h}
@since 3.1.6
*/
void wxSecureZeroMemory(void *p, size_t n);
/**
Returns battery state as one of @c wxBATTERY_NORMAL_STATE,
@c wxBATTERY_LOW_STATE, @c wxBATTERY_CRITICAL_STATE,