From 1ab257b2bc8ff8128cc6bf3245241a446a39374c Mon Sep 17 00:00:00 2001 From: Dreamacro <8615343+Dreamacro@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:15:35 +0800 Subject: [PATCH] security: remove unnecessary noise code --- 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.