Corrected security relevant bug

This commit is contained in:
Hannes 2021-06-18 14:14:30 +02:00
commit c10a68bd43
3 changed files with 11 additions and 12 deletions

View file

@ -17,14 +17,15 @@ pub struct DhKeyPair {
impl Drop for DhKeyPair {
fn drop(&mut self) {
core::mem::drop(&mut self.private_key);
core::mem::drop(&mut self.public_key);
self.private_key = SecretKey::random(&mut OsRng);
self.public_key = self.private_key.public_key();
}
}
impl Zeroize for DhKeyPair {
fn zeroize(&mut self) {
core::mem::drop(self);
self.private_key = SecretKey::random(&mut OsRng);
self.public_key = self.private_key.public_key();
}
}