1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Provide and use internal function mbedtls_zeroize_and_free()

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove
2023-07-17 15:17:40 +01:00
parent b366fe955d
commit ca8c61b815
23 changed files with 83 additions and 127 deletions

View File

@ -114,6 +114,18 @@ extern void (*mbedtls_test_hook_test_fail)(const char *test, int line, const cha
*/
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
/**
* \brief Securely zeroize a buffer then free it.
*
* Exactly the same as consecutive calls to
* \c mbedtls_platform_zeroize() and \c mbedtls_free(), but has a
* code size savings, and potential for optimisation in the future.
*
* \param buf Buffer to be zeroized then freed. May be \c NULL.
* \param len Length of the buffer in bytes
*/
void mbedtls_zeroize_and_free(void *buf, size_t len);
/** Return an offset into a buffer.
*
* This is just the addition of an offset to a pointer, except that this