Skip to content

Commit

Permalink
des: zeroize key (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
baloo authored Feb 11, 2025
1 parent e83fa48 commit b40a003
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ opt-level = 2

[patch.crates-io]
# https://github.com/RustCrypto/traits/pull/1742
# https://github.com/RustCrypto/traits/pull/1747
cipher = { git = "https://github.com/RustCrypto/traits.git" }
crypto-common = { git = "https://github.com/RustCrypto/traits.git" }
5 changes: 4 additions & 1 deletion des/src/tdes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ use cipher::{
use core::fmt;

#[cfg(feature = "zeroize")]
use cipher::zeroize::ZeroizeOnDrop;
use cipher::zeroize::{ZeroizeOnDrop, Zeroizing};

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

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

0 comments on commit b40a003

Please sign in to comment.