commit | eb3a6d6ddfb0baef9dd52081b0831cc9103b37af | [log] [tgz] |
---|---|---|
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Nov 10 01:05:10 2022 +0000 |
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | Thu Nov 10 01:05:10 2022 +0000 |
tree | e56364b12f92a6e882122fb5f805a04ec4416ca2 | |
parent | 9ce5bd327b2929209f6092b892aab55a4b4b36b9 [diff] | |
parent | 29ce245ad79504f889228b408e7a14d6d17d6901 [diff] |
Snap for 9275205 from 29ce245ad79504f889228b408e7a14d6d17d6901 to mainline-conscrypt-release Change-Id: Idb005f74ed6b1b6174b0bfc57e041437a1ce6a63
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.51 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.