mirror of
https://github.com/saymrwulf/curve25519-dalek-source.git
synced 2026-09-04 20:24:10 +00:00
Merge pull request #41 from untoldwind/master
Ensure that all data of StaticSecret is cleared on drop
This commit is contained in:
commit
1cc37a1eda
1 changed files with 5 additions and 7 deletions
|
|
@ -164,14 +164,12 @@ impl SharedSecret {
|
|||
/// # Returns
|
||||
///
|
||||
/// A `Scalar`.
|
||||
fn clamp_scalar(scalar: [u8; 32]) -> Scalar {
|
||||
let mut s: [u8; 32] = scalar.clone();
|
||||
fn clamp_scalar(mut scalar: [u8; 32]) -> Scalar {
|
||||
scalar[0] &= 248;
|
||||
scalar[31] &= 127;
|
||||
scalar[31] |= 64;
|
||||
|
||||
s[0] &= 248;
|
||||
s[31] &= 127;
|
||||
s[31] |= 64;
|
||||
|
||||
Scalar::from_bits(s)
|
||||
Scalar::from_bits(scalar)
|
||||
}
|
||||
|
||||
/// The bare, byte-oriented x25519 function, exactly as specified in RFC7748.
|
||||
|
|
|
|||
Loading…
Reference in a new issue