From: Bastien Roucariès <ro...@debian.org> Signed-off-by: Bastien Roucariès <ro...@debian.org> --- lib/explicit_bzero.c | 7 +++++++ m4/explicit_bzero.m4 | 5 +++++ 2 files changed, 12 insertions(+)
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c index 862855421..b355f9bdf 100644 --- a/lib/explicit_bzero.c +++ b/lib/explicit_bzero.c @@ -32,6 +32,11 @@ #include <string.h> +#if defined WIN32 && defined HAVE_SECUREZEROMEMORY +#define WIN32_LEAN_AND_MEAN +#include <windows.h> +#endif + #if _LIBC /* glibc-internal users use __explicit_bzero_chk, and explicit_bzero redirects to that. */ @@ -47,6 +52,8 @@ explicit_bzero (void *s, size_t len) explicit_memset (s, 0, len); #elif HAVE_MEMSET_S (void) memset_s(s,len,'\0',len); +#elif HAVE_SECUREZEROMEMORY + (void) SecureZeroMemory(s,len); #else memset (s, '\0', len); # if defined __GNUC__ && !defined __clang__ diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4 index 3ca5dc771..8f3144342 100644 --- a/m4/explicit_bzero.m4 +++ b/m4/explicit_bzero.m4 @@ -19,6 +19,11 @@ AC_DEFUN([gl_FUNC_EXPLICIT_BZERO], if test $ac_cv_func_memset_s = no; then HAVE_MEMSET_S=0 fi + + AC_CHECK_FUNCS_ONCE([SecureZeroMemory]) + if test $ac_cv_func_SecureZeroMemory = no; then + HAVE_SECUREZEROMEMORY=0 + fi ]) AC_DEFUN([gl_PREREQ_EXPLICIT_BZERO], -- 2.25.1