mirror of
https://github.com/serai-dex/serai.git
synced 2025-03-12 09:26:51 +00:00
Use zeroize instead of 0-sets
This commit is contained in:
parent
42a3d38b48
commit
a423c23c1e
4 changed files with 5 additions and 5 deletions
|
@ -232,7 +232,7 @@ where
|
|||
|
||||
// Accumulate this bit
|
||||
these_bits |= bit << (i % bits_per_group);
|
||||
bit = 0;
|
||||
bit.zeroize();
|
||||
|
||||
if (i % bits_per_group) == (bits_per_group - 1) {
|
||||
let last = i == (capacity - 1);
|
||||
|
|
|
@ -40,7 +40,7 @@ pub fn scalar_normalize<F0: PrimeFieldBits + Zeroize, F1: PrimeFieldBits>(
|
|||
|
||||
res1 += F0::from(bit.into());
|
||||
res2 += F1::from(bit.into());
|
||||
bit = 0;
|
||||
bit.zeroize();
|
||||
}
|
||||
|
||||
(res1, res2)
|
||||
|
|
|
@ -78,7 +78,7 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize {
|
|||
|
||||
seed.extend(repr.as_ref());
|
||||
for i in repr.as_mut() {
|
||||
*i = 0;
|
||||
i.zeroize();
|
||||
}
|
||||
|
||||
let res = Self::hash_to_F(b"nonce", &seed);
|
||||
|
@ -112,7 +112,7 @@ pub trait Curve: Clone + Copy + PartialEq + Eq + Debug + Zeroize {
|
|||
let res =
|
||||
Option::<Self::F>::from(Self::F::from_repr(encoding)).ok_or(CurveError::InvalidScalar);
|
||||
for b in encoding.as_mut() {
|
||||
*b = 0;
|
||||
b.zeroize();
|
||||
}
|
||||
res
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ where
|
|||
*raw_bit = false;
|
||||
|
||||
groupings[p][i / w_usize] |= bit << (i % w_usize);
|
||||
bit = 0;
|
||||
bit.zeroize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue