diff options
author | Jack Lloyd <[email protected]> | 2016-11-03 11:33:27 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-11-03 11:33:27 -0400 |
commit | e36ab67b80a0fb162df768d5895c413d26e2e5ca (patch) | |
tree | e496e7d51d16d8b56e9efe6ee340a26b5ee5f069 /src/lib/utils/zero_mem.cpp | |
parent | 341fd32b46363cad4c2caee3fca166695100ba07 (diff) |
Rename zero_mem to secure_scrub_memory
Diffstat (limited to 'src/lib/utils/zero_mem.cpp')
-rw-r--r-- | src/lib/utils/zero_mem.cpp | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/lib/utils/zero_mem.cpp b/src/lib/utils/zero_mem.cpp deleted file mode 100644 index df195048a..000000000 --- a/src/lib/utils/zero_mem.cpp +++ /dev/null @@ -1,38 +0,0 @@ - /* -* Zero Memory -* (C) 2012,2015 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include <botan/mem_ops.h> - -#if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY) - #include <windows.h> -#endif - -namespace Botan { - -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 - volatile byte* p = reinterpret_cast<volatile byte*>(ptr); - - for(size_t i = 0; i != n; ++i) - p[i] = 0; -#endif - } - -} |