From 749ff00a794fa4ae085bb2e119ce6823c29b0335 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 29 Sep 2022 13:16:22 +0100 Subject: [PATCH] transports/noise: Have NoiseAuthenticated::xx use X25519Spec (#2954) We support two versions of the Noise XX handshake with X25519, but only one of them is compliant with the specification and thus compliant with other implementations. We should always default to the spec compliant handshake. Fixes bug introduced in https://github.com/libp2p/rust-libp2p/pull/2887/ --- transports/noise/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transports/noise/src/lib.rs b/transports/noise/src/lib.rs index d793e1983bb..c1b55d2076b 100644 --- a/transports/noise/src/lib.rs +++ b/transports/noise/src/lib.rs @@ -390,12 +390,12 @@ pub struct NoiseAuthenticated { config: NoiseConfig, } -impl NoiseAuthenticated { +impl NoiseAuthenticated { /// Create a new [`NoiseAuthenticated`] for the `XX` handshake pattern using X25519 DH keys. /// /// For now, this is the only combination that is guaranteed to be compatible with other libp2p implementations. pub fn xx(id_keys: &identity::Keypair) -> Result { - let dh_keys = Keypair::::new(); + let dh_keys = Keypair::::new(); let noise_keys = dh_keys.into_authentic(id_keys)?; let config = NoiseConfig::xx(noise_keys);