network/wireguard: refuse default key if all zero

Follow-up for fa724cd52c

We attempt to retrieve default key if eqzero(Wireguard.private_key),
but a all zero default key should be refused too.
This commit is contained in:
Mike Yuan
2024-09-12 09:25:50 +02:00
committed by Lennart Poettering
parent 2b735c7d71
commit 53c75243af
+1 -1
View File
@@ -1175,7 +1175,7 @@ static int wireguard_read_default_key_cred(NetDev *netdev, const char *filename)
"%s: No private key specified and default key cannot be parsed, "
"ignoring network device: %m",
filename);
if (len != WG_KEY_LEN)
if (len != WG_KEY_LEN || memeqzero(key, len))
return log_netdev_error_errno(netdev, SYNTHETIC_ERRNO(EINVAL),
"%s: No private key specified and default key is invalid. "
"Ignoring network device.",