1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-12 08:58:20 +03:00

cryptsetup: check the existence of salt by salt_size > 0

Follow-up for 504d0acf61c8472bc93c2a927e858074873b2eaf.

The function may be called with non-NULL salt and salt_size == 0.
This commit is contained in:
Yu Watanabe 2023-02-17 08:24:54 +09:00 committed by Lennart Poettering
parent 79c8e46d23
commit 8c2264abb9

View File

@ -56,7 +56,7 @@ int acquire_luks2_key(
return -ENOANO;
/* If we're using a PIN, and the luks header has a salt, it better have a pin too */
if ((flags & TPM2_FLAGS_USE_PIN) && salt && !pin)
if ((flags & TPM2_FLAGS_USE_PIN) && salt_size > 0 && !pin)
return -ENOANO;
if (pin && salt_size > 0) {