Skip to content

Commit

Permalink
crypto/noise: Generate keypair only for Curve25519
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <[email protected]>
  • Loading branch information
lexnv committed Aug 21, 2024
1 parent 677e151 commit dd0659d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/crypto/noise/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn snow::types::Dh>> {
Some(Box::new(Keypair::<x25519_spec::X25519Spec>::default()))
fn resolve_dh(&self, choice: &snow::params::DHChoice) -> Option<Box<dyn snow::types::Dh>> {
if let snow::params::DHChoice::Curve25519 = choice {
Some(Box::new(Keypair::<x25519_spec::X25519Spec>::default()))
} else {
None
}
}

fn resolve_hash(
Expand Down

0 comments on commit dd0659d

Please sign in to comment.