diff --git a/configure.ac b/configure.ac index 8b4f6c56..3f5401b6 100644 --- a/configure.ac +++ b/configure.ac @@ -355,7 +355,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[ AC_CHECK_FUNCS([memset_s]) ]) AC_CHECK_FUNCS([mlock VirtualLock]) -AC_CHECK_FUNCS([SecureZeroMemory posix_memalign]) +AC_CHECK_FUNCS([SecureZeroMemory explicit_bzero posix_memalign]) AC_SUBST([LIBTOOL_EXTRA_FLAGS]) diff --git a/src/libsodium/sodium/utils.c b/src/libsodium/sodium/utils.c index 3bfafc5d..6aeee712 100644 --- a/src/libsodium/sodium/utils.c +++ b/src/libsodium/sodium/utils.c @@ -28,6 +28,8 @@ sodium_memzero(void * const pnt, const size_t len) if (memset_s(pnt, (rsize_t) len, 0, (rsize_t) len) != 0) { abort(); } +#elif defined(HAVE_EXPLICIT_BZERO) + explicit_bzero(pnt, len); #else volatile unsigned char *pnt_ = (volatile unsigned char *) pnt; size_t i = (size_t) 0U;