From 2603399dd1fea92c6c875c893fb9379b07bb0861 Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:14:41 +0800 Subject: [PATCH] security: remove unnecessary noise code Signed-off-by: Dreamacro <8615343+Dreamacro@users.noreply.github.com> --- p2p/security/noise/handshake.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/p2p/security/noise/handshake.go b/p2p/security/noise/handshake.go index c89f709a47..4760768432 100644 --- a/p2p/security/noise/handshake.go +++ b/p2p/security/noise/handshake.go @@ -3,10 +3,8 @@ package noise import ( "context" "crypto/rand" - "crypto/sha256" "encoding/binary" "fmt" - "hash" "os" "runtime/debug" "time" @@ -27,15 +25,8 @@ import ( // our libp2p identity key. const payloadSigPrefix = "noise-libp2p-static-key:" -type minioSHAFn struct{} - -func (h minioSHAFn) Hash() hash.Hash { return sha256.New() } -func (h minioSHAFn) HashName() string { return "SHA256" } - -var shaHashFn noise.HashFunc = minioSHAFn{} - // All noise session share a fixed cipher suite -var cipherSuite = noise.NewCipherSuite(noise.DH25519, noise.CipherChaChaPoly, shaHashFn) +var cipherSuite = noise.NewCipherSuite(noise.DH25519, noise.CipherChaChaPoly, noise.HashSHA256) // runHandshake exchanges handshake messages with the remote peer to establish // a noise-libp2p session. It blocks until the handshake completes or fails.