1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-27 22:11:10 -07:00

Support memset_explicit() if available

NetBSD has explicit_memset(), but C23 decided to implement the
same thing but call it memset_explicit() instead. Go figure.
This commit is contained in:
Frank Denis 2022-11-21 15:26:18 +01:00
parent 415bce5d97
commit 6e8468d875
2 changed files with 3 additions and 1 deletions
configure.ac
src/libsodium/sodium

View File

@ -908,7 +908,7 @@ AS_IF([test "x$WASI" = "x"],[
AC_CHECK_FUNCS([posix_memalign nanosleep])
AS_IF([test "x$WASI" = "x"],[
AC_CHECK_FUNCS([memset_s explicit_bzero explicit_memset])
AC_CHECK_FUNCS([memset_s explicit_bzero memset_explicit explicit_memset])
])
AC_SUBST([LIBTOOL_EXTRA_FLAGS])

View File

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