const char *alg = NULL;
int r;
- if (tpm2_support() != TPM2_SUPPORT_FULL)
+ if (!tpm2_is_fully_supported())
log_notice("System lacks full TPM2 support, not showing PCR state.");
else {
r = get_pcr_alg(&alg);
bool found = false;
int r;
- if (tpm2_support() != TPM2_SUPPORT_FULL)
+ if (!tpm2_is_fully_supported())
return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), "Sorry, system lacks full TPM2 support.");
r = efi_stub_get_features(&features);
event = TPM2_EVENT_PHASE;
}
- if (arg_graceful && tpm2_support() != TPM2_SUPPORT_FULL) {
+ if (arg_graceful && !tpm2_is_fully_supported()) {
log_notice("No complete TPM2 support detected, exiting gracefully.");
return EXIT_SUCCESS;
}
* container tpm2_support will detect this, and will return a different flag combination of
* TPM2_SUPPORT_FULL, effectively skipping the use of TPM2 when inside one. */
- try_tpm2 = tpm2_support() == TPM2_SUPPORT_FULL;
+ try_tpm2 = tpm2_is_fully_supported();
if (!try_tpm2)
log_debug("System lacks TPM2 support or running in a container, not attempting to use TPM2.");
} else
} Tpm2Support;
Tpm2Support tpm2_support(void);
+static inline bool tpm2_is_fully_supported(void) {
+ return tpm2_support() == TPM2_SUPPORT_FULL;
+}
int verb_has_tpm2_generic(bool quiet);
if (r <= 0)
return r;
- if (arg_graceful && tpm2_support() != TPM2_SUPPORT_FULL) {
+ if (arg_graceful && !tpm2_is_fully_supported()) {
log_notice("No complete TPM2 support detected, exiting gracefully.");
return EXIT_SUCCESS;
}