diff options
Diffstat (limited to 'ref')
-rw-r--r-- | ref/blake2-impl.h | 7 |
1 files changed, 4 insertions, 3 deletions
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 <stdint.h> +#include <string.h> 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 |