// explicit_bzero() is supported both on GNU and BSD // memset_s() is supported on Windows and BSD, lacked in glibc void Zero(void *dst, size_t len) { // Based on GnuTLS gnutls_memset if (len == 0) { return; } volatile unsigned volatile_zero = 0; volatile unsigned char *vdata = (volatile unsigned char *)dst; do { memset(dst, '\x00', len); } while (vdata[volatile_zero] != '\x00'); }