diff --git a/core/lib/libtomcrypt/src/misc/burn_stack.c b/core/lib/libtomcrypt/src/misc/burn_stack.c index c5ae8d3a406..1722be0de0a 100644 --- a/core/lib/libtomcrypt/src/misc/burn_stack.c +++ b/core/lib/libtomcrypt/src/misc/burn_stack.c @@ -49,10 +49,8 @@ */ void burn_stack(unsigned long len) { - unsigned char buf[32]; + unsigned char buf[len]; zeromem(buf, sizeof(buf)); - if (len > (unsigned long)sizeof(buf)) - burn_stack(len - sizeof(buf)); } diff --git a/core/lib/libtomcrypt/src/misc/zeromem.c b/core/lib/libtomcrypt/src/misc/zeromem.c index c4cc325e144..65be86cec0c 100644 --- a/core/lib/libtomcrypt/src/misc/zeromem.c +++ b/core/lib/libtomcrypt/src/misc/zeromem.c @@ -37,6 +37,7 @@ * Tom St Denis, tomstdenis@gmail.com, http://libtom.org */ #include "tomcrypt.h" +#include /** @file zeromem.c @@ -50,11 +51,8 @@ */ 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); } /* $Source: /cvs/libtom/libtomcrypt/src/misc/zeromem.c,v $ */