1
0
mirror of https://git.code.sf.net/p/linux-ima/ima-evm-utils synced 2025-08-16 02:54:37 +02:00

ima_evm_utils: extended calc_bootaggr to PCRs 8 - 9

cal_bootaggr() should include PCRs 8-9 in non-SHA1 digests.

Signed-off-by: Maurizio Drocco <maurizio.drocco@ibm.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
Maurizio
2020-06-24 17:35:58 -04:00
committed by Mimi Zohar
parent 39f1dbeaa4
commit 319fb19caa

View File

@@ -1930,6 +1930,16 @@ static void calc_bootaggr(struct tpm_bank_info *bank)
} }
} }
if (strcmp(bank->algo_name, "sha1") != 0) {
for (i = 8; i < 10; i++) {
err = EVP_DigestUpdate(pctx, bank->pcr[i], bank->digest_size);
if (!err) {
log_err("EVP_DigestUpdate() failed\n");
return;
}
}
}
err = EVP_DigestFinal(pctx, bank->digest, &mdlen); err = EVP_DigestFinal(pctx, bank->digest, &mdlen);
if (!err) { if (!err) {
log_err("EVP_DigestFinal() failed\n"); log_err("EVP_DigestFinal() failed\n");
@@ -1972,8 +1982,9 @@ static int append_bootaggr(char *bootaggr, struct tpm_bank_info *tpm_banks)
/* /*
* The IMA measurement list boot_aggregate is the link between the preboot * The IMA measurement list boot_aggregate is the link between the preboot
* event log and the IMA measurement list. Read and calculate all the * event log and the IMA measurement list. Read and calculate all the
* possible per TPM bank boot_aggregate digests based on the existing * possible per TPM bank boot_aggregate digests based on the existing PCRs
* PCRs 0 - 7 to validate against the IMA boot_aggregate record. * 0 - 9 to validate against the IMA boot_aggregate record. If the digest
* algorithm is SHA1, only PCRs 0 - 7 are considered to avoid ambiguity.
*/ */
static int cmd_ima_bootaggr(struct command *cmd) static int cmd_ima_bootaggr(struct command *cmd)
{ {