From 34f29827544c2f4faf9deab850634ee306edf282 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 19 Mar 2013 00:16:09 -0700 Subject: [PATCH] Use sodium_memzero() for secure_zero_memory() in Blake2 --- src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h b/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h index 83d2dcbb..6ea28c70 100644 --- a/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h +++ b/src/libsodium/crypto_generichash/blake2/ref/blake2-impl.h @@ -16,6 +16,8 @@ #include +#include "utils.h" + static inline uint32_t load32( const void *src ) { #if defined(NATIVE_LITTLE_ENDIAN) @@ -124,10 +126,7 @@ 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 ) { - volatile uint8_t *p = ( volatile uint8_t * )v; - - while( n-- ) *p++ = 0; + sodium_memzero(v, n); } #endif -