diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-04-21 04:19:09 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-04-21 04:31:26 +0200 |
commit | 47559171643131799d76511cf7abdf81a2029e39 (patch) | |
tree | be36f2a7b0be1f64e4c0ce15da5ff5812024cf4e /src | |
parent | a6c869b49eed2a83a63c9f1247a61455a6ec1358 (diff) |
config: don't allow no-privatekey to mask preshared
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c index f307ff6..2736377 100644 --- a/src/config.c +++ b/src/config.c @@ -327,8 +327,9 @@ int config_get_device(struct wireguard_device *wg, void __user *user_device) if (wg->static_identity.has_identity) { memcpy(out_device.private_key, wg->static_identity.static_private, WG_KEY_LEN); memcpy(out_device.public_key, wg->static_identity.static_public, WG_KEY_LEN); - memcpy(out_device.preshared_key, wg->static_identity.preshared_key, WG_KEY_LEN); } + if (wg->static_identity.has_psk) + memcpy(out_device.preshared_key, wg->static_identity.preshared_key, WG_KEY_LEN); up_read(&wg->static_identity.lock); peer_data.out_len = in_device.peers_size; |