diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index 0ebee68463..26ab201194 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -3431,6 +3431,14 @@ int tpm2_unseal(const char *device, if (r < 0) return r; + /* Older code did not save the pcr_bank, and unsealing needed to detect the best pcr bank to use, + * so we need to handle that legacy situation. */ + if (pcr_bank == UINT16_MAX) { + r = tpm2_get_best_pcr_bank(c, hash_pcr_mask|pubkey_pcr_mask, &pcr_bank); + if (r < 0) + return r; + } + _cleanup_(tpm2_handle_freep) Tpm2Handle *primary_handle = NULL; if (srk_buf) { r = tpm2_handle_new(c, &primary_handle);