Removed 'lazy_static' dependency.
This commit is contained in:
parent
0ed0806f50
commit
295e42954a
|
@ -23,7 +23,6 @@ byteorder = "1.2.7"
|
|||
errno = "0.2.4"
|
||||
failure = "0.1.5"
|
||||
hex_fmt = "0.3.0"
|
||||
lazy_static = "1.1.0"
|
||||
log = "0.4.6"
|
||||
memsec = "0.5.4"
|
||||
pairing = { version = "0.14.2", features = ["u128-support"] }
|
||||
|
|
|
@ -327,9 +327,10 @@ impl fmt::Debug for SecretKey {
|
|||
|
||||
impl ContainsSecret for SecretKey {
|
||||
fn secret_memory(&self) -> MemRange {
|
||||
let ptr = &*self.0 as *const Fr as *mut u8;
|
||||
let n_bytes = *FR_SIZE;
|
||||
MemRange { ptr, n_bytes }
|
||||
MemRange {
|
||||
ptr: &*self.0 as *const Fr as *mut u8,
|
||||
n_bytes: FR_SIZE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,19 +4,15 @@
|
|||
use std::mem::{size_of, size_of_val};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use memsec::memzero;
|
||||
|
||||
use crate::Fr;
|
||||
|
||||
lazy_static! {
|
||||
/// The size in bytes of a single field element.
|
||||
pub(crate) static ref FR_SIZE: usize = size_of::<Fr>();
|
||||
}
|
||||
pub(crate) const FR_SIZE: usize = size_of::<Fr>();
|
||||
|
||||
/// Overwrites a single field element with zeros.
|
||||
pub(crate) fn clear_fr(fr_ptr: *const Fr) {
|
||||
unsafe { memzero(fr_ptr as *mut u8, *FR_SIZE) };
|
||||
unsafe { memzero(fr_ptr as *mut u8, FR_SIZE) };
|
||||
}
|
||||
|
||||
pub(crate) struct MemRange {
|
||||
|
|
Loading…
Reference in New Issue