mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Merge pull request #348 from isislovecruft/develop
Merge #346 and restructure Zeroize implementations slightly
This commit is contained in:
commit
2a45241382
2 changed files with 27 additions and 6 deletions
|
|
@ -105,6 +105,8 @@ use subtle::ConditionallyNegatable;
|
|||
use subtle::ConditionallySelectable;
|
||||
use subtle::ConstantTimeEq;
|
||||
|
||||
use zeroize::Zeroize;
|
||||
|
||||
use constants;
|
||||
|
||||
use field::FieldElement;
|
||||
|
|
@ -367,6 +369,28 @@ impl Default for EdwardsPoint {
|
|||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Zeroize implementations for wiping points from memory
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
impl Zeroize for CompressedEdwardsY {
|
||||
/// Reset this `CompressedEdwardsY` to the compressed form of the identity element.
|
||||
fn zeroize(&mut self) {
|
||||
self.0.zeroize();
|
||||
self.0[0] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
impl Zeroize for EdwardsPoint {
|
||||
/// Reset this `CompressedEdwardsPoint` to the identity element.
|
||||
fn zeroize(&mut self) {
|
||||
self.X.zeroize();
|
||||
self.Y = FieldElement::one();
|
||||
self.Z = FieldElement::one();
|
||||
self.T.zeroize();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Validity checks (for debugging, not CT)
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -177,6 +177,8 @@ use subtle::ConditionallySelectable;
|
|||
use subtle::ConditionallyNegatable;
|
||||
use subtle::ConstantTimeEq;
|
||||
|
||||
use zeroize::Zeroize;
|
||||
|
||||
use edwards::EdwardsBasepointTable;
|
||||
use edwards::EdwardsPoint;
|
||||
|
||||
|
|
@ -200,8 +202,6 @@ use backend::serial::scalar_mul;
|
|||
))]
|
||||
use backend::vector::scalar_mul;
|
||||
|
||||
use zeroize::Zeroize;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Compressed points
|
||||
// ------------------------------------------------------------------------
|
||||
|
|
@ -1092,10 +1092,7 @@ impl Zeroize for CompressedRistretto {
|
|||
|
||||
impl Zeroize for RistrettoPoint {
|
||||
fn zeroize(&mut self) {
|
||||
self.0.X.zeroize();
|
||||
self.0.Y.zeroize();
|
||||
self.0.Z.zeroize();
|
||||
self.0.T.zeroize();
|
||||
self.0.zeroize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue