Skip to content

Commit

Permalink
switch from x25519-dalek-ng to x25519-dalek
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric committed Nov 27, 2023
1 parent aae8d0a commit 9e86bdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions rust_crypto_provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
getrandom = { version = "0.2", features = ["js"] }
rand_chacha = { version = "0.3", default-features = false }

Expand Down
6 changes: 4 additions & 2 deletions rust_crypto_provider/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -109,7 +109,9 @@ impl HpkeCrypto for HpkeRustCrypto {
fn kem_key_gen(alg: KemAlgorithm, prng: &mut Self::HpkePrng) -> Result<Vec<u8>, 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())
}
Expand Down

0 comments on commit 9e86bdd

Please sign in to comment.