Clone this repo:
  1. 8977c1a Migrate to cargo_embargo. am: ce949f372b am: a8d2f89b8e am: f91f4450d2 by Andrew Walbran · 5 months ago main master
  2. 881deed Migrate to cargo_embargo. am: ce949f372b am: 00cc82d607 am: 4fa0093d8f by Andrew Walbran · 5 months ago
  3. f91f445 Migrate to cargo_embargo. am: ce949f372b am: a8d2f89b8e by Andrew Walbran · 5 months ago
  4. 4fa0093 Migrate to cargo_embargo. am: ce949f372b am: 00cc82d607 by Andrew Walbran · 5 months ago
  5. a8d2f89 Migrate to cargo_embargo. am: ce949f372b by Andrew Walbran · 5 months ago

RustCrypto: zeroize

Crate Docs Apache 2.0/MIT Licensed MSRV Build Status

Securely zero memory (a.k.a. zeroize) while avoiding compiler optimizations.

This crate implements a portable approach to securely zeroing memory using techniques which guarantee they won't be "optimized away" by the compiler.

The Zeroize trait is the crate's primary 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.

  • No insecure fallbacks!
  • No dependencies!
  • No FFI or inline assembly! WASM friendly (and tested)!
  • #![no_std] i.e. embedded-friendly!
  • No functionality besides securely zeroing memory!
  • (Optional) Custom derive support for zeroing complex structures

Minimum Supported Rust Version

Rust 1.56 or newer.

In the future, we reserve the right to change MSRV (i.e. MSRV is out-of-scope for this crate's SemVer guarantees), however when we do it will be accompanied by a minor version bump.

License

Licensed under either of:

at your option.

Contribution

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