Skip to content

Commit

Permalink
Merge pull request #57 from japaric/x25519-dalek-og
Browse files Browse the repository at this point in the history
switch from x25519-dalek-ng to x25519-dalek
  • Loading branch information
franziskuskiefer authored Nov 29, 2023
2 parents 1d9baa4 + 72569f8 commit 2af956e
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"] }
rand_chacha = { version = "0.3", default-features = false }

[dev-dependencies]
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 2af956e

Please sign in to comment.