xref: /freebsd/sys/libkern/explicit_bzero.c (revision 1d386b48a555f61cb7325543adbbb5c3f3407a66)
1 /*	$OpenBSD: explicit_bzero.c,v 1.3 2014/06/21 02:34:26 matthew Exp $ */
2 /*
3  * Public domain.
4  * Written by Matthew Dempsky.
5  */
6 
7 #include <sys/cdefs.h>
8 #ifdef _KERNEL
9 #include <sys/libkern.h>
10 #else
11 #include <string.h>
12 #endif /* _KERNEL */
13 
14 __attribute__((weak)) void __explicit_bzero_hook(void *, size_t);
15 
16 __attribute__((weak)) void
17 __explicit_bzero_hook(void *buf, size_t len)
18 {
19 }
20 
21 void
22 explicit_bzero(void *buf, size_t len)
23 {
24 	memset(buf, 0, len);
25 	__explicit_bzero_hook(buf, len);
26 }
27