Skip to content

Commit b40a003

Browse files
authored
des: zeroize key (#467)
1 parent e83fa48 commit b40a003

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ opt-level = 2
2828

2929
[patch.crates-io]
3030
# https://github.com/RustCrypto/traits/pull/1742
31+
# https://github.com/RustCrypto/traits/pull/1747
32+
cipher = { git = "https://github.com/RustCrypto/traits.git" }
3133
crypto-common = { git = "https://github.com/RustCrypto/traits.git" }

des/src/tdes.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ use cipher::{
1212
use core::fmt;
1313

1414
#[cfg(feature = "zeroize")]
15-
use cipher::zeroize::ZeroizeOnDrop;
15+
use cipher::zeroize::{ZeroizeOnDrop, Zeroizing};
1616

1717
#[inline]
1818
fn weak_key_test<const SIZE: usize, U: KeyInit>(key: &Key<U>) -> Result<(), WeakKeyError> {
19+
#[cfg(feature = "zeroize")]
20+
let mut tmp = Zeroizing::new(Key::<U>::default());
21+
#[cfg(not(feature = "zeroize"))]
1922
let mut tmp = Key::<U>::default();
2023

2124
for i in 0..<U as KeySizeUser>::KeySize::USIZE {

0 commit comments

Comments
 (0)