aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/zero_mem.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-07-03 14:36:55 -0400
committerJack Lloyd <[email protected]>2016-07-17 10:43:41 -0400
commitcae7a66072905bc264ecf0805a8738a674ff2986 (patch)
treef10d8a79a6ce4be3992da74c6bd1e66a10709d0f /src/lib/utils/zero_mem.cpp
parentee1b5c7e8513b3b97efa87720154d8ca24774eba (diff)
Revamp entropy polling
Remove Entropy_Accumulator, instead have entropy sources directly add entropy to the RNG.
Diffstat (limited to 'src/lib/utils/zero_mem.cpp')
-rw-r--r--src/lib/utils/zero_mem.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lib/utils/zero_mem.cpp b/src/lib/utils/zero_mem.cpp
index 371c434ca..df195048a 100644
--- a/src/lib/utils/zero_mem.cpp
+++ b/src/lib/utils/zero_mem.cpp
@@ -18,6 +18,13 @@ void zero_mem(void* ptr, size_t n)
#if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY)
::RtlSecureZeroMemory(ptr, n);
#elif defined(BOTAN_USE_VOLATILE_MEMSET_FOR_ZERO) && (BOTAN_USE_VOLATILE_MEMSET_FOR_ZERO == 1)
+ /*
+ Call memset through a static volatile pointer, which the compiler
+ should not elide. This construct should be safe in conforming
+ compilers, but who knows. I did confirm that on x86-64 GCC 6.1 and
+ Clang 3.8 both create code that saves the memset address in the
+ data segment and uncondtionally loads and jumps to that address.
+ */
static void* (*const volatile memset_ptr)(void*, int, size_t) = std::memset;
(memset_ptr)(ptr, 0, n);
#else