[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/6] Use SecureZeroMemory on windows for explicit_bzero
From: |
roucaries . bastien |
Subject: |
[PATCH 2/6] Use SecureZeroMemory on windows for explicit_bzero |
Date: |
Sun, 12 Apr 2020 02:48:23 +0200 |
From: Bastien Roucariès <address@hidden>
Signed-off-by: Bastien Roucariès <address@hidden>
---
lib/explicit_bzero.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index 2168a5285..489732791 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -32,6 +32,11 @@
#include <string.h>
+#if defined _WIN32 && !defined __CYGWIN__
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+#endif
+
#if _LIBC
/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
redirects to that. */
@@ -43,7 +48,9 @@
void
explicit_bzero (void *s, size_t len)
{
-#ifdef HAVE_EXPLICIT_MEMSET
+#if defined _WIN32 && !defined __CYGWIN__
+ (void) SecureZeroMemory (s, len);
+#elif HAVE_EXPLICIT_MEMSET
explicit_memset (s, 0, len);
#elif HAVE_MEMSET_S
(void) memset_s (s, len, '\0', len);
--
2.25.1
- [V2][PATH 0/6] Explicit_bzero improvement, roucaries . bastien, 2020/04/11
- [PATCH 1/6] Use memset_s if possible for explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 2/6] Use SecureZeroMemory on windows for explicit_bzero,
roucaries . bastien <=
- [PATCH 3/6] Support clang for explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 4/6] Implement fallback for explicit_bzero using jump to volatile pointer, roucaries . bastien, 2020/04/11
- [PATCH 5/6] Improve styling in explicit_bzero, roucaries . bastien, 2020/04/11
- [PATCH 6/6] Add test for explicit_bzero, roucaries . bastien, 2020/04/11
- Re: [V2][PATH 0/6] Explicit_bzero improvement, Bruno Haible, 2020/04/12