diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/utils/zero_mem.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/lib/utils/zero_mem.cpp b/src/lib/utils/zero_mem.cpp index d8c438435..1dbf6e213 100644 --- a/src/lib/utils/zero_mem.cpp +++ b/src/lib/utils/zero_mem.cpp @@ -1,6 +1,6 @@ -/* + /* * Zero Memory -* (C) 2012 Jack Lloyd +* (C) 2012,2015 Jack Lloyd * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -9,9 +9,6 @@ #if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY) #include <windows.h> -#elif defined(BOTAN_TARGET_OS_HAS_MEMSET_S) - #define __STDC_WANT_LIB_EXT1__ 1 - #include <string.h> #endif namespace Botan { @@ -20,8 +17,9 @@ void zero_mem(void* ptr, size_t n) { #if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY) ::RtlSecureZeroMemory(ptr, n); -#elif defined(BOTAN_TARGET_OS_HAS_MEMSET_S) - ::memset_s(ptr, n, 0, n); +#elif defined(BOTAN_USE_VOLATILE_MEMSET) && (BOTAN_USE_VOLATILE_MEMSET == 1) + static void* (*const volatile memset_ptr)(void*, int, size_t) = memset; + (memset_ptr)(p, 0, n); #else volatile byte* p = reinterpret_cast<volatile byte*>(ptr); |