Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jan 11, 2024
1 parent 56812c7 commit e387cb4
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sha2/src/core_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ use digest::{
HashMarker, InvalidOutputSize, Output,
};

#[cfg(feature = "zeroize")]
use zeroize::{Zeroize, ZeroizeOnDrop};

/// Core block-level SHA-256 hasher with variable output size.
///
/// Supports initialization only for 28 and 32 byte output sizes,
Expand Down Expand Up @@ -91,14 +88,15 @@ impl Drop for Sha256VarCore {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
{
use zeroize::Zeroize;
self.state.zeroize();
self.block_len.zeroize();
}
}
}

#[cfg(feature = "zeroize")]
impl ZeroizeOnDrop for Sha256VarCore {}
impl zeroize::ZeroizeOnDrop for Sha256VarCore {}

/// Core block-level SHA-512 hasher with variable output size.
///
Expand Down Expand Up @@ -179,10 +177,11 @@ impl Drop for Sha512VarCore {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
{
use zeroize::Zeroize;
self.state.zeroize();
self.block_len.zeroize();
}
}
}
#[cfg(feature = "zeroize")]
impl ZeroizeOnDrop for Sha1Core {}
impl zeroize::ZeroizeOnDrop for Sha512VarCore {}

0 comments on commit e387cb4

Please sign in to comment.