Skip to content

Commit

Permalink
Fix zeroize impl
Browse files Browse the repository at this point in the history
  • Loading branch information
newpavlov committed Jul 31, 2024
1 parent 42728f6 commit f5cec24
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions aes/src/armv8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,16 @@ macro_rules! define_aes_impl {
}
}

impl Drop for $name {
#[inline]
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
unsafe {
zeroize::zeroize_flat_type(self);
}
}
}

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

Expand Down Expand Up @@ -216,7 +226,7 @@ macro_rules! define_aes_impl {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
unsafe {
zeroize::zeroize_flat_type(&mut self.backend);
zeroize::zeroize_flat_type(self);
}
}
}
Expand Down Expand Up @@ -294,7 +304,7 @@ macro_rules! define_aes_impl {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
unsafe {
zeroize::zeroize_flat_type(&mut self.backend);
zeroize::zeroize_flat_type(self);
}
}
}
Expand Down

0 comments on commit f5cec24

Please sign in to comment.