Skip to content

Commit 49493dc

Browse files
committed
digest: implement Zeroize for the buffering newtypes
1 parent d5355ef commit 49493dc

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

digest/src/buffer_macros/fixed.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@ macro_rules! buffer_fixed {
3939
const OID: $crate::const_oid::ObjectIdentifier =
4040
$crate::const_oid::ObjectIdentifier::new_unwrap($oid);
4141
}
42+
43+
impl$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? Drop for $name$(< $( $lt ),+ >)? {
44+
#[inline]
45+
fn drop(&mut self) {
46+
#[cfg(feature = "zeroize")]
47+
{
48+
use $crate::zeroize::Zeroize;
49+
self.0.zeroize();
50+
}
51+
}
52+
}
53+
54+
#[cfg(feature = "zeroize")]
55+
impl$(< $( $lt $( : $clt $(+ $dlt )* )? ),+ >)? $crate::zeroize::ZeroizeOnDrop for $name$(< $( $lt ),+ >)? {}
56+
4257
};
4358

4459
// Terminates `impl_inner` sequences.

0 commit comments

Comments
 (0)