mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-22 02:34:55 +00:00
Zeroize buffer used in Scalar::from_hash
from_hash is frequently used for private key/nonce generation, making this buffer a copy of private keys/nonces.
This commit is contained in:
parent
797be71eb3
commit
42a3d38b48
1 changed files with 3 additions and 1 deletions
|
@ -185,7 +185,9 @@ impl Scalar {
|
|||
pub fn from_hash<D: Digest<OutputSize = U64>>(hash: D) -> Scalar {
|
||||
let mut output = [0u8; 64];
|
||||
output.copy_from_slice(&hash.finalize());
|
||||
Scalar(DScalar::from_bytes_mod_order_wide(&output))
|
||||
let res = Scalar(DScalar::from_bytes_mod_order_wide(&output));
|
||||
output.zeroize();
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue