summaryrefslogtreecommitdiffstats
path: root/src/cryptsetup
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-06-01 16:34:34 +0200
committerLennart Poettering <lennart@poettering.net>2021-06-01 16:34:34 +0200
commitcad105442d15344e39466c02d8ffe7daaff92901 (patch)
tree8f33f44838468c7f1e4cb211cd11ddcfaf595157 /src/cryptsetup
parentMerge pull request #19768 from poettering/homectl-fido2-lock-with (diff)
downloadsystemd-cad105442d15344e39466c02d8ffe7daaff92901.tar.xz
systemd-cad105442d15344e39466c02d8ffe7daaff92901.zip
cryptsetup: if TPM2 support is not compiled in, fallback to non-TPM2 mode gracefully
Fixes: #19177
Diffstat (limited to 'src/cryptsetup')
-rw-r--r--src/cryptsetup/cryptsetup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 28ac78cd37..ebd59ca68c 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -1070,6 +1070,8 @@ static int attach_luks_or_plain_or_bitlk_by_tpm2(
&decrypted_key, &decrypted_key_size);
if (r >= 0)
break;
+ if (ERRNO_IS_NOT_SUPPORTED(r)) /* TPM2 support not compiled in? */
+ return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), "TPM2 support not available, falling back to traditional unlocking.");
if (r != -EAGAIN) /* EAGAIN means: no tpm2 chip found */
return r;
} else {
@@ -1100,6 +1102,8 @@ static int attach_luks_or_plain_or_bitlk_by_tpm2(
found_some
? "No TPM2 metadata matching the current system state found in LUKS2 header, falling back to traditional unlocking."
: "No TPM2 metadata enrolled in LUKS2 header, falling back to traditional unlocking.");
+ if (ERRNO_IS_NOT_SUPPORTED(r)) /* TPM2 support not compiled in? */
+ return log_debug_errno(SYNTHETIC_ERRNO(EAGAIN), "TPM2 support not available, falling back to traditional unlocking.");
if (r < 0)
return r;