30 lines
1.1 KiB
Diff
30 lines
1.1 KiB
Diff
From 661e3758451dc504eeb176194293c87f238d55dd Mon Sep 17 00:00:00 2001
|
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
Date: Fri, 17 Feb 2023 08:24:54 +0900
|
|
Subject: [PATCH] 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.
|
|
|
|
(cherry picked from commit 8c2264abb9c16bc2933f95be299f15ee66c21181)
|
|
|
|
Related: RHEL-38864
|
|
---
|
|
src/cryptsetup/cryptsetup-tokens/luks2-tpm2.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/src/cryptsetup/cryptsetup-tokens/luks2-tpm2.c b/src/cryptsetup/cryptsetup-tokens/luks2-tpm2.c
|
|
index e353e947aa..5230a84025 100644
|
|
--- a/src/cryptsetup/cryptsetup-tokens/luks2-tpm2.c
|
|
+++ b/src/cryptsetup/cryptsetup-tokens/luks2-tpm2.c
|
|
@@ -58,7 +58,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) {
|