Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from x25519-dalek-ng to x25519-dalek #57

Merged
merged 1 commit into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading