summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bind/lib/isc/safe.c
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2019-12-17 01:46:30 +0000
committersthen <sthen@openbsd.org>2019-12-17 01:46:30 +0000
commit3ef32adf69b1fed9e0363dd1f2116627f09e6af3 (patch)
tree4d9d566691647dad37619d7bd9d1c7114f554bbe /usr.sbin/bind/lib/isc/safe.c
parentAdd support for NCT6775F, NCT5104D, NCT6779D, NCT679[1235]D sensors. (diff)
downloadwireguard-openbsd-3ef32adf69b1fed9e0363dd1f2116627f09e6af3.tar.xz
wireguard-openbsd-3ef32adf69b1fed9e0363dd1f2116627f09e6af3.zip
update to 9.10.8-P1, last isc-licensed release
Diffstat (limited to 'usr.sbin/bind/lib/isc/safe.c')
-rw-r--r--usr.sbin/bind/lib/isc/safe.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/bind/lib/isc/safe.c b/usr.sbin/bind/lib/isc/safe.c
index 8ac4a5b9193..92f41c29862 100644
--- a/usr.sbin/bind/lib/isc/safe.c
+++ b/usr.sbin/bind/lib/isc/safe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013, 2015 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -19,8 +19,13 @@
#include <config.h>
#include <isc/safe.h>
+#include <isc/string.h>
#include <isc/util.h>
+#ifdef WIN32
+#include <windows.h>
+#endif
+
#ifdef _MSC_VER
#pragma optimize("", off)
#endif
@@ -65,3 +70,17 @@ isc_safe_memcompare(const void *b1, const void *b2, size_t len) {
return (res);
}
+
+void
+isc_safe_memwipe(void *ptr, size_t len) {
+ if (ISC_UNLIKELY(ptr == NULL || len == 0))
+ return;
+
+#ifdef WIN32
+ SecureZeroMemory(ptr, len);
+#elif HAVE_EXPLICIT_BZERO
+ explicit_bzero(ptr, len);
+#else
+ memset(ptr, 0, len);
+#endif
+}