diff options
Diffstat (limited to 'spake2/src')
-rw-r--r-- | spake2/src/lib.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spake2/src/lib.rs b/spake2/src/lib.rs index 5980b95..79517a7 100644 --- a/spake2/src/lib.rs +++ b/spake2/src/lib.rs @@ -222,7 +222,7 @@ use curve25519_dalek::edwards::CompressedEdwardsY; use curve25519_dalek::edwards::EdwardsPoint as c2_Element; use curve25519_dalek::scalar::Scalar as c2_Scalar; use hkdf::Hkdf; -use rand::{rngs::OsRng, CryptoRng, Rng}; +use rand_core::{CryptoRng, OsRng, RngCore}; use sha2::{Digest, Sha256}; use std::fmt; use std::ops::Deref; @@ -286,7 +286,7 @@ pub trait Group { fn hash_to_scalar(s: &[u8]) -> Self::Scalar; fn random_scalar<T>(cspring: &mut T) -> Self::Scalar where - T: Rng + CryptoRng; + T: RngCore + CryptoRng; fn scalar_neg(s: &Self::Scalar) -> Self::Scalar; fn element_to_bytes(e: &Self::Element) -> Vec<u8>; fn bytes_to_element(b: &[u8]) -> Option<Self::Element>; @@ -352,7 +352,7 @@ impl Group for Ed25519Group { } fn random_scalar<T>(cspring: &mut T) -> c2_Scalar where - T: Rng + CryptoRng, + T: RngCore + CryptoRng, { c2_Scalar::random(cspring) } @@ -632,19 +632,19 @@ impl<G: Group> SPAKE2<G> { } pub fn start_a(password: &Password, id_a: &Identity, id_b: &Identity) -> (SPAKE2<G>, Vec<u8>) { - let mut cspring: OsRng = OsRng::new().unwrap(); + let mut cspring = OsRng; let xy_scalar: G::Scalar = G::random_scalar(&mut cspring); Self::start_a_internal(password, id_a, id_b, xy_scalar) } pub fn start_b(password: &Password, id_a: &Identity, id_b: &Identity) -> (SPAKE2<G>, Vec<u8>) { - let mut cspring: OsRng = OsRng::new().unwrap(); + let mut cspring = OsRng; let xy_scalar: G::Scalar = G::random_scalar(&mut cspring); Self::start_b_internal(password, id_a, id_b, xy_scalar) } pub fn start_symmetric(password: &Password, id_s: &Identity) -> (SPAKE2<G>, Vec<u8>) { - let mut cspring: OsRng = OsRng::new().unwrap(); + let mut cspring = OsRng; let xy_scalar: G::Scalar = G::random_scalar(&mut cspring); Self::start_symmetric_internal(password, id_s, xy_scalar) } |