[zeroize].rs 🄌 iqlusion

Crate Docs Apache 2.0/MIT Licensed Rust 1.31+ Build Status

Securely zero memory while avoiding compiler optimizations.

This crate provides a safe†, portable access to cross-platform intrinsics for securely zeroing memory which are specifically documented as guaranteeing they won't be "optimized away".

The [Zeroize trait] is the crate's primary (and only) API.

[Documentation]

About

[Zeroing memory securely is hard] - compilers optimize for performance, and in doing so they love to "optimize away" unnecessary zeroing calls. There are many documented "tricks" to attempt to avoid these optimizations and ensure that a zeroing routine is performed reliably.

This crate isn't about tricks: it uses [core::ptr::write_volatile] and [core::sync::atomic] memory fences to provide easy-to-use, portable zeroing behavior which works on all of Rust's core number types and slices thereof, implemented in pure Rust with no usage of FFI or assembly.

Requirements

License

zeroize is distributed under the terms of either the MIT license or the Apache License (Version 2.0), at your option.

See [LICENSE] (Apache License, Version 2.0) file in the iqlusioninc/crates toplevel directory of this repository or [LICENSE-MIT] for details.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.