aboutsummaryrefslogtreecommitdiffstats
path: root/device/peer.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-03-17 23:06:56 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-03-17 23:07:14 -0600
commit4739708ca4fa68e2dd1915618d8cba113dac9312 (patch)
tree1a730740b48d573a035cc07db9d02117e3d9276c /device/peer.go
parentglobal: use RTMGRP_* consts from x/sys/unix (diff)
downloadwireguard-go-4739708ca4fa68e2dd1915618d8cba113dac9312.tar.xz
wireguard-go-4739708ca4fa68e2dd1915618d8cba113dac9312.zip
noise: unify zero checking of ecdh
Diffstat (limited to 'device/peer.go')
-rw-r--r--device/peer.go9
1 files changed, 2 insertions, 7 deletions
diff --git a/device/peer.go b/device/peer.go
index 91d975a..8a8224c 100644
--- a/device/peer.go
+++ b/device/peer.go
@@ -108,7 +108,6 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) {
handshake := &peer.handshake
handshake.mutex.Lock()
handshake.precomputedStaticStatic = device.staticIdentity.privateKey.sharedSecret(pk)
- ssIsZero := isZero(handshake.precomputedStaticStatic[:])
handshake.remoteStatic = pk
handshake.mutex.Unlock()
@@ -116,13 +115,9 @@ func (device *Device) NewPeer(pk NoisePublicKey) (*Peer, error) {
peer.endpoint = nil
- // conditionally add
+ // add
- if !ssIsZero {
- device.peers.keyMap[pk] = peer
- } else {
- return nil, nil
- }
+ device.peers.keyMap[pk] = peer
// start peer