diff --git a/Cargo.toml b/Cargo.toml index 75dd6d2..825adc1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] } diff --git a/src/lib.rs b/src/lib.rs index b4651cb..f0fa164 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, + } } } diff --git a/src/secret.rs b/src/secret.rs index 1745946..af9df2e 100644 --- a/src/secret.rs +++ b/src/secret.rs @@ -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::(); -} +pub(crate) const FR_SIZE: usize = size_of::(); /// 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 {