diff --git a/src/common.rs b/src/common.rs index d3a1be82..ccaf9309 100644 --- a/src/common.rs +++ b/src/common.rs @@ -58,6 +58,13 @@ pub struct Nonce { pub e: Scalar, } +impl Drop for Nonce { + fn drop(&mut self) { + self.d.set_zero(); + self.e.set_zero(); + } +} + impl fmt::Debug for Nonce { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Nonce").finish_non_exhaustive()