From c9fe6c5533b4a476c0d0e3846ebc2277ffe36f23 Mon Sep 17 00:00:00 2001 From: gedigi <19227040+gedigi@users.noreply.github.com> Date: Thu, 19 Mar 2020 14:16:06 -0700 Subject: [PATCH] implemented Zeroize for CompressedRistretto and RistrettoPoint --- src/ristretto.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ristretto.rs b/src/ristretto.rs index c4b6170..0e8f742 100644 --- a/src/ristretto.rs +++ b/src/ristretto.rs @@ -200,6 +200,8 @@ use backend::serial::scalar_mul; ))] use backend::vector::scalar_mul; +use zeroize::Zeroize; + // ------------------------------------------------------------------------ // Compressed points // ------------------------------------------------------------------------ @@ -1078,6 +1080,25 @@ impl Debug for RistrettoPoint { } } +// ------------------------------------------------------------------------ +// Zeroize traits +// ------------------------------------------------------------------------ + +impl Zeroize for CompressedRistretto { + fn zeroize(&mut self) { + self.0.zeroize(); + } +} + +impl Zeroize for RistrettoPoint { + fn zeroize(&mut self) { + self.0.X.zeroize(); + self.0.Y.zeroize(); + self.0.Z.zeroize(); + self.0.T.zeroize(); + } +} + // ------------------------------------------------------------------------ // Tests // ------------------------------------------------------------------------