From 68f8e5678ef62697e2a81d4cafa2334652ebdb76 Mon Sep 17 00:00:00 2001 From: salman aljammaz Date: Sat, 29 Jul 2023 18:53:33 +0100 Subject: [PATCH] wgengine/magicsock: remove dead code (#8745) The nonce value is not read by anything, and di.sharedKey.Seal() a few lines below generates its own. #cleanup Signed-off-by: salman --- wgengine/magicsock/magicsock.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wgengine/magicsock/magicsock.go b/wgengine/magicsock/magicsock.go index 06fd5e59b..77f017295 100644 --- a/wgengine/magicsock/magicsock.go +++ b/wgengine/magicsock/magicsock.go @@ -8,7 +8,6 @@ import ( "bufio" "context" - crand "crypto/rand" "errors" "fmt" "io" @@ -1242,10 +1241,6 @@ func (c *Conn) sendDiscoMessage(dst netip.AddrPort, dstKey key.NodePublic, dstDi c.mu.Unlock() return false, errConnClosed } - var nonce [disco.NonceLen]byte - if _, err := crand.Read(nonce[:]); err != nil { - panic(err) // worth dying for - } pkt := make([]byte, 0, 512) // TODO: size it correctly? pool? if it matters. pkt = append(pkt, disco.Magic...) pkt = c.discoPublic.AppendTo(pkt)