From cfc536848ab8aca62961c7ee446006d53814132f Mon Sep 17 00:00:00 2001 From: Samuel Neves Date: Sat, 12 Dec 2015 20:45:01 +0000 Subject: replace secure_zero_memory --- ref/blake2-impl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ref') diff --git a/ref/blake2-impl.h b/ref/blake2-impl.h index 5ac7a43..ae582a5 100644 --- a/ref/blake2-impl.h +++ b/ref/blake2-impl.h @@ -15,6 +15,7 @@ #define __BLAKE2_IMPL_H__ #include +#include static inline uint32_t load32( const void *src ) { @@ -126,10 +127,10 @@ static inline uint64_t rotr64( const uint64_t w, const unsigned c ) } /* prevents compiler optimizing out memset() */ -static inline void secure_zero_memory( void *v, size_t n ) +static inline void secure_zero_memory(void *v, size_t n) { - volatile uint8_t *p = ( volatile uint8_t * )v; - while( n-- ) *p++ = 0; + static void *(*const volatile memset_v)(void *, int, size_t) = &memset; + memset_v(v, 0, n); } #endif -- cgit v1.2.3