mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 20:29:23 +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:
@@ -185,7 +185,9 @@ impl Scalar {
|
|||||||
pub fn from_hash<D: Digest<OutputSize = U64>>(hash: D) -> Scalar {
|
pub fn from_hash<D: Digest<OutputSize = U64>>(hash: D) -> Scalar {
|
||||||
let mut output = [0u8; 64];
|
let mut output = [0u8; 64];
|
||||||
output.copy_from_slice(&hash.finalize());
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user