|
1 | | -//! Securely zero memory with a simple trait ([`Zeroize`]) built on stable Rust |
2 | | -//! primitives which guarantee the operation will not be "optimized away". |
3 | | -//! |
4 | | -//! ## About |
5 | | -//! |
6 | | -//! [Zeroing memory securely is hard] - compilers optimize for performance, and |
7 | | -//! in doing so they love to "optimize away" unnecessary zeroing calls. There are |
8 | | -//! many documented "tricks" to attempt to avoid these optimizations and ensure |
9 | | -//! that a zeroing routine is performed reliably. |
10 | | -//! |
11 | | -//! This crate isn't about tricks: it uses [`core::ptr::write_volatile`] |
12 | | -//! and [`core::sync::atomic`] memory fences to provide easy-to-use, portable |
13 | | -//! zeroing behavior which works on all of Rust's core number types and slices |
14 | | -//! thereof, implemented in pure Rust with no usage of FFI or assembly. |
15 | | -//! |
16 | | -//! - No insecure fallbacks! |
17 | | -//! - No dependencies! |
18 | | -//! - No FFI or inline assembly! **WASM friendly** (and tested)! |
19 | | -//! - `#![no_std]` i.e. **embedded-friendly**! |
20 | | -//! - No functionality besides securely zeroing memory! |
21 | | -//! - (Optional) Custom derive support for zeroing complex structures |
22 | | -//! |
23 | | -//! ## Minimum Supported Rust Version |
24 | | -//! |
25 | | -//! Requires Rust **1.51** or newer. |
26 | | -//! |
27 | | -//! In the future, we reserve the right to change MSRV (i.e. MSRV is out-of-scope |
28 | | -//! for this crate's SemVer guarantees), however when we do it will be accompanied |
29 | | -//! by a minor version bump. |
30 | | -//! |
| 1 | +#![no_std] |
| 2 | +#![cfg_attr(docsrs, feature(doc_cfg))] |
| 3 | +#![doc( |
| 4 | + html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", |
| 5 | + html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", |
| 6 | + html_root_url = "https://docs.rs/zeroize/1.5.0" |
| 7 | +)] |
| 8 | +#![doc = include_str!("../README.md")] |
| 9 | +#![warn(missing_docs, rust_2018_idioms, unused_qualifications)] |
| 10 | + |
31 | 11 | //! ## Usage |
32 | 12 | //! |
33 | 13 | //! ``` |
|
221 | 201 | //! [good cryptographic hygiene]: https://github.com/veorq/cryptocoding#clean-memory-of-secret-data |
222 | 202 | //! [`Ordering::SeqCst`]: core::sync::atomic::Ordering::SeqCst |
223 | 203 |
|
224 | | -#![no_std] |
225 | | -#![cfg_attr(docsrs, feature(doc_cfg))] |
226 | | -#![doc( |
227 | | - html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", |
228 | | - html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/6ee8e381/logo.svg", |
229 | | - html_root_url = "https://docs.rs/zeroize/1.5.0-pre" |
230 | | -)] |
231 | | -#![warn(missing_docs, rust_2018_idioms, unused_qualifications)] |
232 | | - |
233 | 204 | #[cfg(feature = "alloc")] |
234 | 205 | #[cfg_attr(test, macro_use)] |
235 | 206 | extern crate alloc; |
|
0 commit comments