aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/os.rst3
-rw-r--r--src/build-data/os/freebsd.txt1
-rw-r--r--src/build-data/os/netbsd.txt1
-rw-r--r--src/lib/utils/os_utils.cpp5
4 files changed, 8 insertions, 2 deletions
diff --git a/doc/os.rst b/doc/os.rst
index ad7b5a894..d34011d5f 100644
--- a/doc/os.rst
+++ b/doc/os.rst
@@ -37,7 +37,8 @@ A summary of OS features as defined in ``src/build-data/os``.
"clock_gettime", "X", "X", " ", " ", "X", "X", "X", "X", "X", " ", " ", "X", " ", " ", " ", "X", "X", "X", "X", " ", " "
"crypto_ng", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " "
"dev_random", "X", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", " ", " ", " ", "X", "X", "X", "X", " ", " "
- "explicit_bzero", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " "
+ "explicit_bzero", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " "
+ "explicit_memset", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " "
"filesystem", "X", "X", "X", "X", "X", "X", "X", "X", "X", " ", "X", "X", "X", "X", " ", "X", "X", "X", "X", "X", "X"
"getauxval", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " ", " ", " ", " ", " ", " "
"getentropy", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "X", " ", " ", " ", " "
diff --git a/src/build-data/os/freebsd.txt b/src/build-data/os/freebsd.txt
index 57a3b7546..166981c0b 100644
--- a/src/build-data/os/freebsd.txt
+++ b/src/build-data/os/freebsd.txt
@@ -9,6 +9,7 @@ posix_mlock
clock_gettime
dev_random
arc4random
+explicit_bzero
sockets
threads
diff --git a/src/build-data/os/netbsd.txt b/src/build-data/os/netbsd.txt
index 2ff60844a..6ff7529ff 100644
--- a/src/build-data/os/netbsd.txt
+++ b/src/build-data/os/netbsd.txt
@@ -7,6 +7,7 @@ posix_mlock
clock_gettime
dev_random
arc4random
+explicit_memset
sockets
threads
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);