Skip to content

Commit b51624c

Browse files
committed
fix compilation error
1 parent d718b5d commit b51624c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ whirlpool = { path = "whirlpool" }
3838
blobby = { git = "https://github.com/RustCrypto/utils" }
3939
# https://github.com/RustCrypto/traits/pull/1916
4040
digest = { git = "https://github.com/RustCrypto/traits" }
41+
block-buffer = { git = "https://github.com/RustCrypto/utils" }

ascon-hash/src/lib.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ struct HashCore<P: HashParameters> {
7373
phantom: PhantomData<P>,
7474
}
7575

76+
#[cfg(feature = "zeroize")]
77+
impl<P: HashParameters> digest::zeroize::ZeroizeOnDrop for HashCore<P> {}
78+
79+
#[allow(dead_code)]
80+
const _: () = {
81+
// State is the only field in AsconCore
82+
fn check_core(v: &State) {
83+
let _ = v as &dyn digest::zeroize::ZeroizeOnDrop;
84+
}
85+
};
86+
7687
impl<P: HashParameters> HashCore<P> {
7788
fn absorb_block(&mut self, block: &[u8; 8]) {
7889
self.state[0] ^= u64::from_le_bytes(*block);
@@ -195,6 +206,17 @@ impl SerializableState for AsconCore {
195206
}
196207
}
197208

209+
#[cfg(feature = "zeroize")]
210+
impl digest::zeroize::ZeroizeOnDrop for AsconCore {}
211+
212+
#[allow(dead_code)]
213+
const _: () = {
214+
// HashCore is the only field in AsconCore
215+
fn check_core(v: &HashCore<Parameters>) {
216+
let _ = v as &dyn digest::zeroize::ZeroizeOnDrop;
217+
}
218+
};
219+
198220
/// Ascon XOF
199221
#[derive(Clone, Debug, Default)]
200222
pub struct AsconXofCore {

0 commit comments

Comments
 (0)