Skip to content

Commit

Permalink
Remove incorrect ZeroizeOnDrop impls
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation committed Aug 17, 2024
1 parent 5199e66 commit 741fa55
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
11 changes: 1 addition & 10 deletions ml-kem/src/algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::param::{ArraySize, CbdSamplingSize};
use crate::util::{Truncate, B32};

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

pub type Integer = u16;

Expand All @@ -24,9 +24,6 @@ impl Zeroize for FieldElement {
}
}

#[cfg(feature = "zeroize")]
impl ZeroizeOnDrop for FieldElement {}

impl FieldElement {
pub const Q: Integer = 3329;
pub const Q32: u32 = Self::Q as u32;
Expand Down Expand Up @@ -196,9 +193,6 @@ impl Zeroize for NttPolynomial {
}
}

#[cfg(feature = "zeroize")]
impl ZeroizeOnDrop for NttPolynomial {}

impl Add<&NttPolynomial> for &NttPolynomial {
type Output = NttPolynomial;

Expand Down Expand Up @@ -447,9 +441,6 @@ where
}
}

#[cfg(feature = "zeroize")]
impl<K> ZeroizeOnDrop for NttVector<K> where K: ArraySize {}

impl<K: ArraySize> Add<&NttVector<K>> for &NttVector<K> {
type Output = NttVector<K>;

Expand Down
5 changes: 1 addition & 4 deletions ml-kem/src/pke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::param::{EncodedCiphertext, EncodedDecryptionKey, EncodedEncryptionKey
use crate::util::B32;

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

/// A `DecryptionKey` provides the ability to generate a new key pair, and decrypt an
/// encrypted value.
Expand All @@ -30,9 +30,6 @@ where
}
}

#[cfg(feature = "zeroize")]
impl<P> ZeroizeOnDrop for DecryptionKey<P> where P: PkeParams {}

impl<P> DecryptionKey<P>
where
P: PkeParams,
Expand Down

0 comments on commit 741fa55

Please sign in to comment.