commit | 413736a225d002067be2b9972171a414d45248a3 | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <[email protected]> | Wed Jul 24 17:55:07 2024 +0000 |
committer | Android Build Coastguard Worker <[email protected]> | Wed Jul 24 17:55:07 2024 +0000 |
tree | 4700eaec6e2fae77fbb66026c9d1c583a48ca98a | |
parent | 59336b6532cd4e227b566972c1f0225e734e49fc [diff] | |
parent | 1e3775f11b7363c1b36916e2744a2e44611f9fb4 [diff] |
Snap for 12134224 from 1e3775f11b7363c1b36916e2744a2e44611f9fb4 to simpleperf-release Change-Id: Ib1022c717d6d70f1ee823edea0497b416771c2c8
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.