Skip to content

Commit e7f58b0

Browse files
committed
fix: much easier solution suggested by reviewer
1 parent 7e5401e commit e7f58b0

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

src/scalar.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use core::{
99
iter::{Product, Sum},
1010
ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign},
1111
};
12-
use std::{ptr, sync::atomic};
1312

1413
use blst::*;
1514
use byte_slice_cast::AsByteSlice;
@@ -677,16 +676,8 @@ impl Scalar {
677676
}
678677

679678
impl Zeroize for Scalar {
680-
/// Implementation based on the zeroize crate, which guarantees the value
681-
/// becomes 0 when the function is called by ensuring the compiler does not
682-
/// optimize the function away
683-
/// See <https://docs.rs/zeroize/latest/zeroize/#what-guarantees-does-this-crate-provide>
684-
/// for more details
685679
fn zeroize(&mut self) {
686-
unsafe {
687-
ptr::write_volatile(&mut self.0, blst_fr { l: [0u64; 4] });
688-
}
689-
atomic::compiler_fence(atomic::Ordering::SeqCst);
680+
self.0.l.zeroize();
690681
}
691682
}
692683

0 commit comments

Comments
 (0)