summaryrefslogtreecommitdiffstats
path: root/sys/net/wg_noise.c
diff options
context:
space:
mode:
authorMatt Dunwoodie <ncon@noconroy.net>2021-03-15 17:56:50 +1100
committerMatt Dunwoodie <ncon@noconroy.net>2021-04-04 16:21:39 +1000
commit0cbc67a981e373b786c2fd5b099e541b5a06517f (patch)
tree40348016e40f183f684a6d5c6702ebbd5708deff /sys/net/wg_noise.c
parentAdd noise_local_deinit to zero private keys (diff)
downloadwireguard-openbsd-0cbc67a981e373b786c2fd5b099e541b5a06517f.tar.xz
wireguard-openbsd-0cbc67a981e373b786c2fd5b099e541b5a06517f.zip
Ensure a peer has a consistent PSK (if set when creating)
Diffstat (limited to 'sys/net/wg_noise.c')
-rw-r--r--sys/net/wg_noise.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/net/wg_noise.c b/sys/net/wg_noise.c
index 06e12a302ce..b87a46b18a1 100644
--- a/sys/net/wg_noise.c
+++ b/sys/net/wg_noise.c
@@ -161,18 +161,13 @@ noise_remote_init(struct noise_remote *r, uint8_t public[NOISE_PUBLIC_KEY_LEN],
rw_exit_write(&l->l_identity_lock);
}
-int
+void
noise_remote_set_psk(struct noise_remote *r,
uint8_t psk[NOISE_SYMMETRIC_KEY_LEN])
{
- int same;
rw_enter_write(&r->r_handshake_lock);
- same = !timingsafe_bcmp(r->r_psk, psk, NOISE_SYMMETRIC_KEY_LEN);
- if (!same) {
- memcpy(r->r_psk, psk, NOISE_SYMMETRIC_KEY_LEN);
- }
+ memcpy(r->r_psk, psk, NOISE_SYMMETRIC_KEY_LEN);
rw_exit_write(&r->r_handshake_lock);
- return same ? EEXIST : 0;
}
int