crypto light refactoring.

using volatile f/p guaranting assembly will generate call* instruction on memset for secure buffer zeroing. usage in sha1 api as well.
This commit is contained in:
David Carlier 2021-04-18 19:33:38 +01:00 committed by Ivan
parent c646476ca8
commit 1f93fc902b
5 changed files with 13 additions and 19 deletions

View file

@ -27,19 +27,12 @@
*/
#include "md5.h"
#include "utils.h"
#include <string.h>
#if !defined(MBEDTLS_MD5_ALT)
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize(void* v, size_t n)
{
auto p = const_cast<volatile char*>(static_cast<char*>(v));
while (n--)
*p++ = 0;
}
/*
* 32-bit integer manipulation macros (little endian)
*/