From: Jason A. Donenfeld Date: Thu, 11 Mar 2021 22:35:15 +0000 (-0700) Subject: ipc: uniformly ignore preshared keys that are zero X-Git-Tag: v1.0.20210315~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e4867dc95126f27bbb487a5d72c58916ca53e93;p=thirdparty%2Fwireguard-tools.git ipc: uniformly ignore preshared keys that are zero Signed-off-by: Jason A. Donenfeld --- diff --git a/src/ipc-freebsd.h b/src/ipc-freebsd.h index e8037af..2c10c10 100644 --- a/src/ipc-freebsd.h +++ b/src/ipc-freebsd.h @@ -136,7 +136,8 @@ static int kernel_get_device(struct wgdevice **device, const char *ifname) binary = nvlist_get_binary(nvl_peers[i], "preshared-key", &size); if (binary && size == sizeof(peer->preshared_key)) { memcpy(peer->preshared_key, binary, sizeof(peer->preshared_key)); - peer->flags |= WGPEER_HAS_PRESHARED_KEY; + if (!key_is_zero(peer->preshared_key)) + peer->flags |= WGPEER_HAS_PRESHARED_KEY; } } if (nvlist_exists_number(nvl_peers[i], "persistent-keepalive-interval")) { diff --git a/src/ipc-openbsd.h b/src/ipc-openbsd.h index 30554b1..c529d9a 100644 --- a/src/ipc-openbsd.h +++ b/src/ipc-openbsd.h @@ -129,7 +129,8 @@ static int kernel_get_device(struct wgdevice **device, const char *iface) if (wg_peer->p_flags & WG_PEER_HAS_PSK) { memcpy(peer->preshared_key, wg_peer->p_psk, sizeof(peer->preshared_key)); - peer->flags |= WGPEER_HAS_PRESHARED_KEY; + if (!key_is_zero(peer->preshared_key)) + peer->flags |= WGPEER_HAS_PRESHARED_KEY; } if (wg_peer->p_flags & WG_PEER_HAS_PKA) {