diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-15 15:02:13 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josh@tailscale.com> | 2020-12-16 16:16:26 -0800 |
commit | 4bced36d327754ad9567eba450413c07ff80da72 (patch) | |
tree | c235b16ab7aae0907f4276feef66239eb820a29b /device/keypair.go | |
parent | 7d88fbd2177caccef40ab60c927f9539e723903e (diff) | |
download | wireguard-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.go | 2 |
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 |