Files
go-sqlcipher/burn_stack.c
T
Alex Jbanca d4fa1002f9 performance(sqlcipher): Fix burn_stack performance issue
Fixing status-im/status-desktop#10572

Implements a cross-platform version of OP-TEE/optee_os#3102

Remove recursion
Use memset instead of while loop
A description to understand introduced changes without reading the code.

zeromem weights about 50% of the total CPU time on M1 Macs and seems to be major performance offender.
It is used to clear the stack when using variables with sensitive information.
2023-05-09 16:21:44 +03:00

33 lines
639 B
C

/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, tomstdenis@gmail.com, http://libtom.org
*/
#include "tomcrypt.h"
/**
@file burn_stack.c
Burn stack, Tom St Denis
*/
/**
Burn some stack memory
@param len amount of stack to burn in bytes
*/
void burn_stack(unsigned long len)
{
unsigned char buf[len];
zeromem(buf, sizeof(buf));
}
/* $Source$ */
/* $Revision$ */
/* $Date$ */