Skip to content

Commit 442c32c

Browse files
committed
poly1305: impl Zeroize for autodetect::State
1 parent b5abdc1 commit 442c32c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

poly1305/src/autodetect.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ impl Clone for State {
8888
impl Drop for State {
8989
fn drop(&mut self) {
9090
use zeroize::Zeroize;
91-
if self.token.get() {
92-
// TODO(tarcieri): SIMD zeroize support
93-
} else {
94-
unsafe { self.inner.soft.zeroize() }
95-
}
91+
const SIZE: usize = core::mem::size_of::<State>();
92+
93+
let inner_array = unsafe { &mut *(self as *mut State as *mut [u8; SIZE]) };
94+
95+
inner_slice.zeroize();
9696
}
9797
}

0 commit comments

Comments
 (0)