try_tpm2 = CRED_KEY_REQUIRES_TPM2(with_key);
if (try_tpm2) {
- if (CRED_KEY_WANTS_TPM2_PK(with_key) || CRED_KEY_REQUIRES_TPM2_PK(with_key)) {
+ /* If the firmware does not support TPMs, then UKI measurements are not going to work, hence
+ * PCR 11 public key stuff cannot work. Because of that, if PK is only wanted (but not
+ * required) we won't try it. */
+ if ((CRED_KEY_WANTS_TPM2_PK(with_key) && tpm2_is_fully_supported()) || CRED_KEY_REQUIRES_TPM2_PK(with_key)) {
/* Load public key for PCR policies, if one is specified, or explicitly requested */
if (r < 0)
return log_error_errno(r, "Could not find best pcr bank: %m");
+ log_debug("Selected literal PCR mask: 0x%x, PK PCR mask: 0x%x", tpm2_hash_pcr_mask, tpm2_pubkey_pcr_mask);
+
TPML_PCR_SELECTION tpm2_hash_pcr_selection;
tpm2_tpml_pcr_selection_from_mask(tpm2_hash_pcr_mask, tpm2_pcr_bank, &tpm2_hash_pcr_selection);