From 2fc88353e69a4bf6448562f7dc56f7034e0e47a8 Mon Sep 17 00:00:00 2001 From: Claudia Richoux Date: Thu, 26 Jan 2023 02:24:37 -0500 Subject: [PATCH 1/2] adding zeroize for blockbuffers --- Cargo.lock | 24 +++++++++++++++++++++++- block-buffer/Cargo.toml | 4 ++++ block-buffer/src/lib.rs | 3 +++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index c5efa063..83ceda29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -16,6 +16,7 @@ dependencies = [ "crypto-common", "generic-array", "hex-literal 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 1.5.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -240,12 +241,33 @@ name = "zeroize" version = "1.5.7" dependencies = [ "serde", - "zeroize_derive", + "zeroize_derive 1.3.3", +] + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" +dependencies = [ + "zeroize_derive 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zeroize_derive" +version = "1.3.3" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", ] [[package]] name = "zeroize_derive" version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", diff --git a/block-buffer/Cargo.toml b/block-buffer/Cargo.toml index 7b121f95..71391073 100644 --- a/block-buffer/Cargo.toml +++ b/block-buffer/Cargo.toml @@ -14,6 +14,10 @@ readme = "README.md" [dependencies] crypto-common = "0.2.0-pre" generic-array = "0.14" +zeroize = { version = "1.4", optional = true, features = ["zeroize_derive"] } [dev-dependencies] hex-literal = "0.3.3" + +[features] +zeroize = ["dep:zeroize"] diff --git a/block-buffer/src/lib.rs b/block-buffer/src/lib.rs index 61438e71..d06c18f1 100644 --- a/block-buffer/src/lib.rs +++ b/block-buffer/src/lib.rs @@ -15,6 +15,8 @@ use generic_array::{ typenum::{Add1, B1}, ArrayLength, GenericArray, }; +#[cfg(feature = "zeroize")] +use zeroize::Zeroize; mod read; mod sealed; @@ -58,6 +60,7 @@ impl fmt::Display for Error { /// Buffer for block processing of data. #[derive(Debug)] +#[cfg_attr(feature = "zeroize", derive(Zeroize))] pub struct BlockBuffer { buffer: Block, pos: K::Pos, From 0881ddc777c57a8d9c698376caf47d7aeb462d6b Mon Sep 17 00:00:00 2001 From: Claudia Richoux Date: Thu, 20 Apr 2023 14:02:42 +0200 Subject: [PATCH 2/2] requested changes --- block-buffer/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/block-buffer/Cargo.toml b/block-buffer/Cargo.toml index 71391073..5dc65461 100644 --- a/block-buffer/Cargo.toml +++ b/block-buffer/Cargo.toml @@ -18,6 +18,3 @@ zeroize = { version = "1.4", optional = true, features = ["zeroize_derive"] } [dev-dependencies] hex-literal = "0.3.3" - -[features] -zeroize = ["dep:zeroize"]