diff options
author | Jack Lloyd <[email protected]> | 2017-09-30 17:24:16 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-09-30 17:24:35 -0400 |
commit | a1129cfb4a9c97f6a5d31442e9d6aebbd5e39fe7 (patch) | |
tree | 5252f50c46fd7282d9381443f46d57b68e36bd8e /src/lib/utils | |
parent | 12da804481aa4bdb93be819ff96cb3e71783ca38 (diff) |
Use explicit_bzero on OpenBSD
[ci skip]
Diffstat (limited to 'src/lib/utils')
-rw-r--r-- | src/lib/utils/os_utils.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp index afea8bc7d..3f7d3cfde 100644 --- a/src/lib/utils/os_utils.cpp +++ b/src/lib/utils/os_utils.cpp @@ -22,6 +22,10 @@ #include <boost/asio.hpp> #endif +#if defined(BOTAN_TARGET_OS_HAS_EXPLICIT_BZERO) + #include <string.h> +#endif + #if defined(BOTAN_TARGET_OS_TYPE_IS_UNIX) #include <sys/types.h> #include <sys/resource.h> @@ -294,11 +298,12 @@ OS::open_socket(const std::string& hostname, // Not defined in OS namespace for historical reasons void secure_scrub_memory(void* ptr, size_t n) { - // TODO support explicit_bzero - #if defined(BOTAN_TARGET_OS_HAS_RTLSECUREZEROMEMORY) ::RtlSecureZeroMemory(ptr, n); +#elif defined(BOTAN_TARGET_OS_HAS_EXPLICIT_BZERO) + ::explicit_bzero(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 |