Skip to content

Commit

Permalink
libtomcrypt: implement zeromem() with memzero_explicit()
Browse files Browse the repository at this point in the history
This change is part of commit 03121b2 ("core: crypto: libtomcrypt:
fix LTC_CLEAN_STACK bug"). LTC_CLEAN_STACK will be disabled in a later
commit because it is not supported anymore upstream ("LTC_CLEAN_STACK
is considered as broken"), so we keep only the zeromem() part of the
commit.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
jforissier authored and jenswi-linaro committed Apr 24, 2024
1 parent 96ac368 commit 7f247ad
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/lib/libtomcrypt/src/misc/zeromem.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#include "tomcrypt_private.h"
#include <string_ext.h>

/**
@file zeromem.c
Expand All @@ -14,9 +15,6 @@
*/
void zeromem(volatile void *out, size_t outlen)
{
volatile char *mem = out;
LTC_ARGCHKVD(out != NULL);
while (outlen-- > 0) {
*mem++ = '\0';
}
memzero_explicit((void *)out, outlen);
}

0 comments on commit 7f247ad

Please sign in to comment.