diff options
Diffstat (limited to 'spake2')
-rw-r--r-- | spake2/Cargo.toml | 14 | ||||
-rw-r--r-- | spake2/src/lib.rs | 12 |
2 files changed, 10 insertions, 16 deletions
diff --git a/spake2/Cargo.toml b/spake2/Cargo.toml index 5df4705..ce27c5b 100644 --- a/spake2/Cargo.toml +++ b/spake2/Cargo.toml @@ -5,24 +5,18 @@ authors = ["Brian Warner <warner@lothar.com>"] description = "The SPAKE2 password-authenticated key-exchange algorithm." documentation = "https://docs.rs/spake2" homepage = "https://github.com/RustCrypto/PAKEs" -repository = "https://github.com/RustCrypto/PAKEs" +repository = "https://github.com/RustCrypto/PAKEs/tree/master/spake2" license = "MIT OR Apache-2.0" keywords = ["crypto", "pake", "authentication"] categories = ["cryptography", "authentication"] exclude = [".gitignore"] readme = "README.md" -edition = "2018" +edition = "2021" rust-version = "1.56" -[package.metadata.release] -tag-prefix = "spake2-v" -tag-message = "(cargo-release) spake2-v{{version}}" -pre-release-commit-message = "(cargo-release) spake2-v{{version}}" -pro-release-commit-message = "(cargo-release) start next development iteration spake2-v{{version}}" - [dependencies] -curve25519-dalek = "1.2" -rand = "0.6" +curve25519-dalek = "3" +rand_core = { version = "0.5", default-features = false, features = ["getrandom"] } sha2 = "0.9" hkdf = "0.11" hex = "0.4" 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) } |