zeroize 0.1.2

(Alpha quality preview) Securely zero memory while avoiding compiler optimizations: unified 'secure_zero_memory()' wrapper for secure intrinsic functions for zeroing memory, using FFI to invoke OS intrinsics on stable (with support for Linux, Windows, OS X/iOS, FreeBSD, OpenBSD, NetBSD, DragonflyBSD), or the unstable 'volatile_set_memory()` intrinsic on nightly. No insecure fallbacks, no dependencies, no std, no functionality besides securely zeroing memory.
Documentation
1
2
3
4
5
6
7
8
9
10
11
/**
 * `explicit_bzero()` shim for invoking `SecureZeroMemory` on Windows, which
 * is provided as a macro.
 */

#include <windows.h>
#include <wincrypt.h>

void explicit_bzero(void *dest, size_t n) {
    SecureZeroMemory(dest, n);
}