From a12a20c4102813ad455873b7d7b9a4606c0dd126 Mon Sep 17 00:00:00 2001 From: Avril Date: Tue, 23 Mar 2021 14:26:39 +0000 Subject: [PATCH] prevent inlining of prune when explicit_clear is enabled on nightly builds to prevent clflush asm being inlined --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/stream.rs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 786a7b2..d6355ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,7 +34,7 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "1.1.0" +version = "1.1.1" dependencies = [ "base64", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index 1cb501f..c864615 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "chacha20" description = "chacha20_poly1305 encryption tool" -version = "1.1.0" +version = "1.1.1" authors = ["Avril "] edition = "2018" license = "gpl-3.0-or-later" diff --git a/src/stream.rs b/src/stream.rs index 153d4e2..66e01b9 100644 --- a/src/stream.rs +++ b/src/stream.rs @@ -97,6 +97,7 @@ where W: Write /// Clear the internal buffer while keeping it allocated for further use. /// /// This does not affect operations at all, all it does is 0 out the left-over temporary buffer from the last operation(s). + #[cfg_attr(all(nightly, feature="explicit_clear"), inline(never))] // We don't want this asm! being inlined and preventing other optimisations on caller functions. pub fn prune(&mut self) { #[cfg(feature="explicit_clear")]