diff --git a/rust_crypto_provider/Cargo.toml b/rust_crypto_provider/Cargo.toml index fd2fdc8..769121a 100644 --- a/rust_crypto_provider/Cargo.toml +++ b/rust_crypto_provider/Cargo.toml @@ -16,11 +16,11 @@ hkdf = { version = "0.12" } sha2 = { version = "0.10", default-features = false } p256 = { version = "0.13", features = ["arithmetic", "ecdh"], default-features = false } p384 = { version = "0.13", default-features = false } -x25519-dalek-ng = { version = "1.1", default-features = false, features = ["u64_backend"] } +x25519-dalek = { version = "2", features = ["static_secrets"] } chacha20poly1305 = { version = "0.10", default-features = false, features = ["alloc"] } aes-gcm = { version = "0.10", default-features = false, features = ["aes"] } # Randomness -rand_core = { version = "0.6" } +rand_core = { version = "0.6", features = ["getrandom"] } rand_chacha = { version = "0.3", default-features = false } [dev-dependencies] diff --git a/rust_crypto_provider/src/lib.rs b/rust_crypto_provider/src/lib.rs index 90391ab..a280c2d 100644 --- a/rust_crypto_provider/src/lib.rs +++ b/rust_crypto_provider/src/lib.rs @@ -12,7 +12,7 @@ use p256::{ PublicKey, SecretKey, }; use rand_core::SeedableRng; -use x25519_dalek_ng::{PublicKey as X25519PublicKey, StaticSecret as X25519StaticSecret}; +use x25519_dalek::{PublicKey as X25519PublicKey, StaticSecret as X25519StaticSecret}; mod aead; mod hkdf; @@ -109,7 +109,9 @@ impl HpkeCrypto for HpkeRustCrypto { fn kem_key_gen(alg: KemAlgorithm, prng: &mut Self::HpkePrng) -> Result, Error> { let rng = &mut prng.rng; match alg { - KemAlgorithm::DhKem25519 => Ok(X25519StaticSecret::new(&mut *rng).to_bytes().to_vec()), + KemAlgorithm::DhKem25519 => Ok(X25519StaticSecret::random_from_rng(&mut *rng) + .to_bytes() + .to_vec()), KemAlgorithm::DhKemP256 => { Ok(SecretKey::random(&mut *rng).to_bytes().as_slice().into()) }