aboutsummaryrefslogtreecommitdiff
path: root/device/keypair.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2020-12-15 15:02:13 -0800
committerJosh Bleecher Snyder <josh@tailscale.com>2020-12-16 16:16:26 -0800
commit4bced36d327754ad9567eba450413c07ff80da72 (patch)
treec235b16ab7aae0907f4276feef66239eb820a29b /device/keypair.go
parent7d88fbd2177caccef40ab60c927f9539e723903e (diff)
downloadwireguard-go-4bced36d327754ad9567eba450413c07ff80da72.tar.gz
wireguard-go-4bced36d327754ad9567eba450413c07ff80da72.zip
device: fix races from changing private_key
Access keypair.sendNonce atomically. Eliminate one unnecessary initialization to zero. Mutate handshake.lastSentHandshake with the mutex held. Co-authored-by: David Anderson <danderson@tailscale.com> Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/keypair.go')
-rw-r--r--device/keypair.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/device/keypair.go b/device/keypair.go
index 254e696..27db779 100644
--- a/device/keypair.go
+++ b/device/keypair.go
@@ -23,7 +23,7 @@ import (
*/
type Keypair struct {
- sendNonce uint64
+ sendNonce uint64 // accessed atomically
send cipher.AEAD
receive cipher.AEAD
replayFilter replay.Filter