tpm2: add TPM2_PCR_VALID()
This commit is contained in:
@@ -271,7 +271,7 @@ _public_ int cryptsetup_token_validate(
|
||||
}
|
||||
|
||||
u = json_variant_unsigned(e);
|
||||
if (u >= TPM2_PCRS_MAX) {
|
||||
if (!TPM2_PCR_VALID(u)) {
|
||||
crypt_log_debug(cd, "TPM2 PCR number out of range.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ static int parse_one_option(const char *option) {
|
||||
}
|
||||
|
||||
pcr = r ? TPM_PCR_INDEX_VOLUME_KEY : UINT_MAX;
|
||||
} else if (pcr >= TPM2_PCRS_MAX) {
|
||||
} else if (!TPM2_PCR_VALID(pcr)) {
|
||||
log_error("Selected TPM index for measurement %u outside of allowed range 0…%u, ignoring.", pcr, TPM2_PCRS_MAX-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user