From 7ba8af5936af4d23ca41581f933b9c46de15af5e Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Mon, 21 Jan 2013 19:18:15 -0800 Subject: [PATCH] Check for SecureZeroMemory at compile time. --- configure.ac | 4 ++++ src/libsodium/randombytes/randombytes_salsa20_random.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e5b5e1d2..0a289f6d 100644 --- a/configure.ac +++ b/configure.ac @@ -148,6 +148,10 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN +dnl Checks for functions and headers + +AC_CHECK_FUNCS([SecureZeroMemory]) + dnl Switches. AC_ARG_ENABLE(pie, diff --git a/src/libsodium/randombytes/randombytes_salsa20_random.c b/src/libsodium/randombytes/randombytes_salsa20_random.c index 367c7717..b3d1931a 100644 --- a/src/libsodium/randombytes/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/randombytes_salsa20_random.c @@ -51,7 +51,7 @@ static Salsa20Random stream = { static void sodium_memzero(void * const pnt, const size_t size) { -#ifdef _WIN32 +#ifdef HAVE_SECUREZEROMEMORY SecureZeroMemory(pnt, size); #else volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;