Skip to content

Commit

Permalink
Protect public key zeroization against updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronFeickert committed Sep 20, 2024
1 parent 2a1715a commit abc294f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/ristretto/ristretto_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,13 @@ impl RistrettoPublicKey {
impl Zeroize for RistrettoPublicKey {
/// Zeroizes both the point and (if it exists) the compressed point
fn zeroize(&mut self) {
self.point.zeroize();
// This destructuring is to trigger a compiler error on future updates!
let Self { point, compressed } = self;

point.zeroize();

// Need to empty the cell
if let Some(mut compressed) = self.compressed.take() {
if let Some(mut compressed) = compressed.take() {
compressed.zeroize();
}
}
Expand Down

0 comments on commit abc294f

Please sign in to comment.