Merge pull request #761 from devnexen/explicit_memset_support_in_utils

Provides explicit_memset supports/NetBSD.
This commit is contained in:
Frank Denis 2018-09-29 13:48:50 -05:00 committed by GitHub
commit ff15272cf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -791,7 +791,7 @@ dnl Checks for functions and headers
AC_FUNC_ALLOCA
AS_IF([test "x$EMSCRIPTEN" = "x"],[
AC_CHECK_FUNCS([arc4random arc4random_buf])
AC_CHECK_FUNCS([mmap mlock madvise mprotect memset_s explicit_bzero nanosleep])
AC_CHECK_FUNCS([mmap mlock madvise mprotect memset_s explicit_bzero explicit_memset nanosleep])
])
AC_CHECK_FUNCS([posix_memalign getpid])

View File

@ -110,6 +110,8 @@ sodium_memzero(void *const pnt, const size_t len)
}
#elif defined(HAVE_EXPLICIT_BZERO)
explicit_bzero(pnt, len);
#elif defined(HAVE_EXPLICIT_MEMSET)
explicit_memset(pnt, 0, len);
#elif HAVE_WEAK_SYMBOLS
memset(pnt, 0, len);
_sodium_dummy_symbol_to_prevent_memzero_lto(pnt, len);