Skip to content

Commit fdd468a

Browse files
authored
Merge pull request #66 from gilcu3/master
feat: add support for zeroize in scalar type
2 parents e04cb90 + e7f58b0 commit fdd468a

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ff = "0.13"
2121
group = { version = "0.13", features = ["tests"] }
2222
pairing_lib = { version = "0.23", package = "pairing" }
2323
subtle = "2.2.1"
24+
zeroize = "1.8.2"
2425

2526
serde = { version = "1.0", features = ["derive"], optional = true }
2627
ec-gpu = { version = "0.2.0", optional = true }

src/scalar.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use byte_slice_cast::AsByteSlice;
1515
use ff::{Field, FieldBits, PrimeField, PrimeFieldBits};
1616
use rand_core::RngCore;
1717
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
18+
use zeroize::Zeroize;
1819

1920
/// Represents an element of the scalar field $\mathbb{F}_q$ of the BLS12-381 elliptic
2021
/// curve construction.
@@ -674,6 +675,12 @@ impl Scalar {
674675
}
675676
}
676677

678+
impl Zeroize for Scalar {
679+
fn zeroize(&mut self) {
680+
self.0.l.zeroize();
681+
}
682+
}
683+
677684
#[cfg(feature = "gpu")]
678685
impl ec_gpu::GpuName for Scalar {
679686
fn name() -> String {

0 commit comments

Comments
 (0)