Skip to content

Commit

Permalink
security: remove unnecessary noise code
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamacro committed Mar 17, 2024
1 parent 164adb4 commit 1ab257b
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions p2p/security/noise/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ package noise
import (
"context"
"crypto/rand"
"crypto/sha256"
"encoding/binary"
"fmt"
"hash"
"os"
"runtime/debug"
"time"
Expand All @@ -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.
Expand Down

0 comments on commit 1ab257b

Please sign in to comment.