aboutsummaryrefslogtreecommitdiffstats
path: root/device/keypair.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2020-12-15 15:02:13 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2021-01-07 14:49:44 +0100
commit70861686d3005de91b45d38e5b16fd3132a4a872 (patch)
treec235b16ab7aae0907f4276feef66239eb820a29b /device/keypair.go
parentdevice: always name *Queue*Element variables elem (diff)
downloadwireguard-go-70861686d3005de91b45d38e5b16fd3132a4a872.tar.xz
wireguard-go-70861686d3005de91b45d38e5b16fd3132a4a872.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