Removed 'lazy_static' dependency.

This commit is contained in:
Peter van Nostrand 2019-04-10 11:55:21 -04:00 committed by Andreas Fackler
parent 0ed0806f50
commit 295e42954a
3 changed files with 6 additions and 10 deletions

View File

@ -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"] }

View File

@ -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,
}
}
}

View File

@ -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 {