aboutsummaryrefslogtreecommitdiffstats
path: root/device/noise_test.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-05-02 01:30:23 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2020-05-02 01:56:48 -0600
commit28c4d043048e8bb7167e96df6558a6366306fc17 (patch)
treec98e39cd6ed75e23f54e6d1b72b6f5c70fa9ab8a /device/noise_test.go
parentwintun: make remaining HWID comparisons case insensitive (diff)
downloadwireguard-go-28c4d043048e8bb7167e96df6558a6366306fc17.tar.xz
wireguard-go-28c4d043048e8bb7167e96df6558a6366306fc17.zip
device: use atomic access for unlocked keypair.next
Go's GC semantics might not always guarantee the safety of this, and the race detector gets upset too, so instead we wrap this all in atomic accessors. Reported-by: David Anderson <danderson@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'device/noise_test.go')
-rw-r--r--device/noise_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/device/noise_test.go b/device/noise_test.go
index 6ba3f2e..b5d5845 100644
--- a/device/noise_test.go
+++ b/device/noise_test.go
@@ -113,7 +113,7 @@ func TestNoiseHandshake(t *testing.T) {
t.Fatal("failed to derive keypair for peer 2", err)
}
- key1 := peer1.keypairs.next
+ key1 := peer1.keypairs.loadNext()
key2 := peer2.keypairs.current
// encrypting / decryption test