zeroizing-alloc 0.1.0

Minimal allocator wrapper to zero-on-free data for security
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use zeroizing_alloc::ZeroAlloc;

#[global_allocator]
static ALLOC: ZeroAlloc<std::alloc::System> = ZeroAlloc(std::alloc::System);

#[test]
fn can_alloc() {
    let allocation = core::hint::black_box(std::vec![1, 1, 1, 2, 2, 2]);
    drop(allocation); // Cannot check if zeroed post-drop without UB

    let mut allocation_2 = core::hint::black_box(Vec::<u8>::with_capacity(2));
    allocation_2.resize(2048, 0xFF);
    drop(allocation_2); // Cannot check if zeroed post-drop without UB
}