From dd0659dfbbd7658895155d937a24f39179d665fa Mon Sep 17 00:00:00 2001 From: Alexandru Vasile Date: Wed, 21 Aug 2024 18:48:56 +0300 Subject: [PATCH] crypto/noise: Generate keypair only for Curve25519 Signed-off-by: Alexandru Vasile --- src/crypto/noise/protocol.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/crypto/noise/protocol.rs b/src/crypto/noise/protocol.rs index ce745f35..59e95ecc 100644 --- a/src/crypto/noise/protocol.rs +++ b/src/crypto/noise/protocol.rs @@ -75,8 +75,12 @@ impl snow::resolvers::CryptoResolver for Resolver { Some(Box::new(Rng(rand::rngs::StdRng::from_entropy()))) } - fn resolve_dh(&self, _: &snow::params::DHChoice) -> Option> { - Some(Box::new(Keypair::::default())) + fn resolve_dh(&self, choice: &snow::params::DHChoice) -> Option> { + if let snow::params::DHChoice::Curve25519 = choice { + Some(Box::new(Keypair::::default())) + } else { + None + } } fn resolve_hash(