From 5b3b3b4a891016188b22765a42fd88895ed21429 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 4 Aug 2018 20:09:07 +0200 Subject: [PATCH] (mbedtls) Add arc4_alt.h --- deps/mbedtls/aes.c | 5 +---- deps/mbedtls/arc4.c | 5 +---- deps/mbedtls/arc4_alt.h | 9 +++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 deps/mbedtls/arc4_alt.h diff --git a/deps/mbedtls/aes.c b/deps/mbedtls/aes.c index 58603849cc..d36b231fb4 100644 --- a/deps/mbedtls/aes.c +++ b/deps/mbedtls/aes.c @@ -54,10 +54,7 @@ #if !defined(MBEDTLS_AES_ALT) -/* Implementation that should never be optimized out by the compiler */ -static void mbedtls_zeroize( void *v, size_t n ) { - volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0; -} +#include "arc4_alt.h" /* * 32-bit integer manipulation macros (little endian) diff --git a/deps/mbedtls/arc4.c b/deps/mbedtls/arc4.c index 05b33d3fdb..26954c6f35 100644 --- a/deps/mbedtls/arc4.c +++ b/deps/mbedtls/arc4.c @@ -47,10 +47,7 @@ #if !defined(MBEDTLS_ARC4_ALT) -/* Implementation that should never be optimized out by the compiler */ -static void mbedtls_zeroize( void *v, size_t n ) { - volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0; -} +#include "arc4_alt.h" void mbedtls_arc4_init( mbedtls_arc4_context *ctx ) { diff --git a/deps/mbedtls/arc4_alt.h b/deps/mbedtls/arc4_alt.h new file mode 100644 index 0000000000..9c6a49b206 --- /dev/null +++ b/deps/mbedtls/arc4_alt.h @@ -0,0 +1,9 @@ +#ifndef _ARC4_ALT_H +#define _ARC4_ALT_H + +/* Implementation that should never be optimized out by the compiler */ +static void mbedtls_zeroize( void *v, size_t n ) { + volatile unsigned char *p = (unsigned char*)v; while( n-- ) *p++ = 0; +} + +#endif