}
}
-static bool libcryptsetup_plugins_support(void) {
+static bool use_token_plugins(void) {
#if HAVE_TPM2
/* Currently, there's no way for us to query the volume key when plugins are used. Hence don't use
size_t decrypted_key_size;
_cleanup_free_ char *friendly = NULL;
int keyslot = arg_key_slot, r;
- bool use_libcryptsetup_plugin = libcryptsetup_plugins_support();
+ bool use_libcryptsetup_plugin = use_token_plugins();
assert(cd);
assert(name);
_cleanup_free_ void *discovered_key = NULL;
int keyslot = arg_key_slot, r;
const char *uri = NULL;
- bool use_libcryptsetup_plugin = libcryptsetup_plugins_support();
+ bool use_libcryptsetup_plugin = use_token_plugins();
assert(cd);
assert(name);
return 0;
}
-static bool use_token_plugins(void) {
- int r;
-
- /* Disable tokens if we shall measure, since we won't get access to the volume key then. */
- if (arg_tpm2_measure_pcr != UINT_MAX)
- return false;
-
- r = getenv_bool("SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE");
- if (r < 0 && r != -ENXIO)
- log_debug_errno(r, "Failed to parse $SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE value, ignoring: %m");
-
- return r != 0;
-}
-
static int attach_luks2_by_tpm2_via_plugin(
struct crypt_device *cd,
const char *name,
.pcrlock_path = arg_tpm2_pcrlock,
};
- if (!libcryptsetup_plugins_support())
+ if (!use_token_plugins())
return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
- "Libcryptsetup has external plugins support disabled.");
+ "libcryptsetup has external plugins support disabled.");
return crypt_activate_by_token_pin_ask_password(
cd,