summaryrefslogtreecommitdiffstats
path: root/lib/libc/string/explicit_bzero.c
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-01-22 21:06:45 +0000
committertedu <tedu@openbsd.org>2014-01-22 21:06:45 +0000
commit2fa321beb47f73cfed1daedbabd3f5ea94c00670 (patch)
treeb87d0f493b7b171de2fad7bced75d1905ef78106 /lib/libc/string/explicit_bzero.c
parentImplement the \: (optional line break) escape sequence, (diff)
downloadwireguard-openbsd-2fa321beb47f73cfed1daedbabd3f5ea94c00670.tar.xz
wireguard-openbsd-2fa321beb47f73cfed1daedbabd3f5ea94c00670.zip
add explicit_bzero to libc. implementation subject to change, but start
the ball rolling. ok deraadt.
Diffstat (limited to 'lib/libc/string/explicit_bzero.c')
-rw-r--r--lib/libc/string/explicit_bzero.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/libc/string/explicit_bzero.c b/lib/libc/string/explicit_bzero.c
new file mode 100644
index 00000000000..fd2948ca44e
--- /dev/null
+++ b/lib/libc/string/explicit_bzero.c
@@ -0,0 +1,20 @@
+/* $OpenBSD: explicit_bzero.c,v 1.1 2014/01/22 21:06:45 tedu Exp $ */
+/*
+ * Public domain.
+ * Written by Ted Unangst
+ */
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#include <string.h>
+#else
+#include <lib/libkern/libkern.h>
+#endif
+
+/*
+ * explicit_bzero - don't let the compiler optimize away bzero
+ */
+void
+explicit_bzero(void *p, size_t n)
+{
+ bzero(p, n);
+}