From f5cec246889c6d13024614c4ef39ed274006c1ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Wed, 31 Jul 2024 19:09:28 +0300 Subject: [PATCH] Fix zeroize impl --- aes/src/armv8.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/aes/src/armv8.rs b/aes/src/armv8.rs index a6bd438c..3c51a5a0 100644 --- a/aes/src/armv8.rs +++ b/aes/src/armv8.rs @@ -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 {} @@ -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); } } } @@ -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); } } }