diff --git a/Cargo.lock b/Cargo.lock index 981fc718..62074006 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -320,6 +320,7 @@ dependencies = [ "digest 0.10.7", "hex-literal", "sha1 0.10.6", + "zeroize", ] [[package]] diff --git a/sha1-checked/Cargo.toml b/sha1-checked/Cargo.toml index d8dd97f2..afd9bae9 100644 --- a/sha1-checked/Cargo.toml +++ b/sha1-checked/Cargo.toml @@ -20,6 +20,7 @@ exclude = [ [dependencies] digest = "0.10.7" sha1 = { version = "0.10.6", default-features = false, features = ["compress"] } +zeroize = { version = "1.7", default-features = false, optional = true } [dev-dependencies] digest = { version = "0.10.7", features = ["dev"] } @@ -29,7 +30,7 @@ hex-literal = "0.4" default = ["oid", "std"] std = ["digest/std", "sha1/std"] oid = ["digest/oid", "sha1/oid"] # Enable OID support -zeroize = [] +zeroize = ["dep:zeroize"] [package.metadata.docs.rs] diff --git a/sha1-checked/src/lib.rs b/sha1-checked/src/lib.rs index 39e11965..1dcf28da 100644 --- a/sha1-checked/src/lib.rs +++ b/sha1-checked/src/lib.rs @@ -26,14 +26,14 @@ use core::slice::from_ref; #[cfg(feature = "std")] extern crate std; -#[cfg(feature = "zeroize")] -use digest::zeroize::{Zeroize, ZeroizeOnDrop}; use digest::{ block_buffer::{BlockBuffer, Eager}, core_api::BlockSizeUser, typenum::{Unsigned, U20, U64}, FixedOutput, FixedOutputReset, HashMarker, Output, OutputSizeUser, Reset, Update, }; +#[cfg(feature = "zeroize")] +use zeroize::{Zeroize, ZeroizeOnDrop}; const BLOCK_SIZE: usize = ::BlockSize::USIZE; const STATE_LEN: usize = 5; @@ -212,16 +212,6 @@ impl FixedOutputReset for Sha1 { } } -impl Drop for Sha1 { - #[inline] - fn drop(&mut self) { - #[cfg(feature = "zeroize")] - { - self.buffer.zeroize(); - } - } -} - #[cfg(feature = "zeroize")] impl ZeroizeOnDrop for Sha1 {}