Skip to main content

Module zeroize

Module zeroize 

Source
Expand description

Memory zeroization utilities for clearing sensitive cryptographic material.

This module implements zeroization in pure safe Rust. It uses core::hint::black_box and a core::sync::atomic::compiler_fence (SeqCst) to keep the compiler from removing the stores as dead. Safe Rust has no volatile write, so this is a best-effort barrier rather than a language-level guarantee.

xtask asm-audit checks that the release codegen of each zeroize_* routine stores zeros to memory. What that check covers and what it does not (inlined call sites) is tracked in SECURITY.md.

Traits§

Zeroize
Trait for types whose sensitive contents can be overwritten with zeros.

Functions§

zeroize_bytes
Zeroes a mutable byte slice while inhibiting dead-store elimination.
zeroize_i16s
Zeroes a mutable i16 slice (such as signed lattice polynomial coefficients).
zeroize_i32s
Zeroes a mutable i32 slice (such as signed ML-DSA polynomial coefficients).
zeroize_u16s
Zeroes a mutable u16 slice (such as ML-KEM secret polynomial coefficients).
zeroize_u32s
Zeroes a mutable u32 slice (such as ML-DSA secret polynomial coefficients).
zeroize_u64s
Zeroes a mutable u64 slice (such as Keccak-f[1600] sponge state).