x: Remove Zeroize impl for secret types (#782)

This commit is contained in:
Michael Rosenberg 2025-07-08 15:06:07 -04:00 committed by GitHub
parent 55e3e00d97
commit e3c2455f63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 28 deletions

View file

@ -2,6 +2,10 @@
Entries are listed in reverse chronological order.
## Unreleased
* Remove `Zeroize` impl for `x25519::{EphemeralSecret, ReusableSecret, SharedSecret, StaticSecret}` to prevent misuse. These are now only zeroized on drop.
# 2.x Series
* Note: All `x255919-dalek` 2.x releases are in sync with the underlying `curve25519-dalek` 4.x releases.

View file

@ -111,13 +111,6 @@ impl<'a> From<&'a EphemeralSecret> for PublicKey {
impl Drop for EphemeralSecret {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
self.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl Zeroize for EphemeralSecret {
fn zeroize(&mut self) {
self.0.zeroize();
}
}
@ -182,13 +175,6 @@ impl<'a> From<&'a ReusableSecret> for PublicKey {
impl Drop for ReusableSecret {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
self.zeroize();
}
}
#[cfg(all(feature = "reusable_secrets", feature = "zeroize"))]
impl Zeroize for ReusableSecret {
fn zeroize(&mut self) {
self.0.zeroize();
}
}
@ -279,13 +265,6 @@ impl AsRef<[u8]> for StaticSecret {
impl Drop for StaticSecret {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
self.zeroize();
}
}
#[cfg(all(feature = "static_secrets", feature = "zeroize"))]
impl Zeroize for StaticSecret {
fn zeroize(&mut self) {
self.0.zeroize();
}
}
@ -362,13 +341,6 @@ impl AsRef<[u8]> for SharedSecret {
impl Drop for SharedSecret {
fn drop(&mut self) {
#[cfg(feature = "zeroize")]
self.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl Zeroize for SharedSecret {
fn zeroize(&mut self) {
self.0.zeroize();
}
}