aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
authorDavid Carlier <[email protected]>2018-12-09 06:29:17 +0000
committerDavid Carlier <[email protected]>2018-12-09 06:29:17 +0000
commitf585eb9043bece953f304e2b0cd2ca328144c9df (patch)
treea749f13f747949effc225b1450449f0728ff827a /src/lib/utils
parentc7a44f7b76fda9d633e6007238f5c23292226c34 (diff)
Few features added for BSD.
explicit_bzero/explicit_memset since quite a time. getentropy exists for FreeBSD, but only from 12.x.
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/os_utils.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/utils/os_utils.cpp b/src/lib/utils/os_utils.cpp
index 6bebbab58..77be98dc6 100644
--- a/src/lib/utils/os_utils.cpp
+++ b/src/lib/utils/os_utils.cpp
@@ -54,13 +54,16 @@ void secure_scrub_memory(void* ptr, size_t n)
#elif defined(BOTAN_TARGET_OS_HAS_EXPLICIT_BZERO)
::explicit_bzero(ptr, n);
+#elif defined(BOTAN_TARGET_OS_HAS_EXPLICIT_MEMSET)
+ (void)::explicit_memset(ptr, 0, 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.
+ data segment and unconditionally loads and jumps to that address.
*/
static void* (*const volatile memset_ptr)(void*, int, size_t) = std::memset;
(memset_ptr)(ptr, 0, n);