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 #include "config.h" 7 #include <string.h> 8 9 #ifdef HAVE_ATTR_WEAK 10 __attribute__((weak)) void 11 #else 12 void 13 #endif __explicit_bzero_hook(void * ATTR_UNUSED (buf),size_t ATTR_UNUSED (len))14__explicit_bzero_hook(void *ATTR_UNUSED(buf), size_t ATTR_UNUSED(len)) 15 { 16 } 17 18 void explicit_bzero(void * buf,size_t len)19explicit_bzero(void *buf, size_t len) 20 { 21 #ifdef UB_ON_WINDOWS 22 SecureZeroMemory(buf, len); 23 #endif 24 memset(buf, 0, len); 25 __explicit_bzero_hook(buf, len); 26 } 27