commit | b8ef35c84fb3ec7a3c56ee59a34c2639ed73e2d5 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Fri Oct 06 01:15:54 2023 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Fri Oct 06 01:15:54 2023 +0000 |
tree | 24a423aebfde2bc9e465dc44127aaa0c55a3c610 | |
parent | b71187d92ab069c9ebdedb25d359c9791fcb69d6 [diff] | |
parent | f12e7848a778227395327ed682b2b8773e25a80e [diff] |
Snap for 10909147 from f12e7848a778227395327ed682b2b8773e25a80e to 24D1-release Change-Id: I9e9fa533c26c1a86d464183deac839db49c4bf23
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.
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_std]
i.e. embedded-friendly!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.
Licensed under either of:
at your option.
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.