linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maurizio Drocco <maurizio.drocco@ibm.com>
To: linux-integrity@vger.kernel.org
Cc: zohar@linux.ibm.com, Maurizio <maurizio.drocco@ibm.com>
Subject: [PATCH] ima_evm_utils: extended calc_bootaggr to PCRs 8 - 9
Date: Tue, 16 Jun 2020 08:02:28 -0400	[thread overview]
Message-ID: <20200616120228.16068-1-maurizio.drocco@ibm.com> (raw)

From: Maurizio <maurizio.drocco@ibm.com>

If PCRs 8 - 9 are set (i.e. not all-zeros), cal_bootaggr should include
them into the digest.

Signed-off-by: Maurizio Drocco <maurizio.drocco@ibm.com>
---
 src/evmctl.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/evmctl.c b/src/evmctl.c
index 1d065ce..701d643 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1930,6 +1930,16 @@ static void calc_bootaggr(struct tpm_bank_info *bank)
 		}
 	}
 
+	for (i = 8; i < 10; i++) {
+		if (memcmp(bank->pcr[i], zero, bank->digest_size) != 0) {
+			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);
 	if (!err) {
 		log_err("EVP_DigestFinal() failed\n");
@@ -1973,7 +1983,8 @@ static int append_bootaggr(char *bootaggr, struct tpm_bank_info *tpm_banks)
  * The IMA measurement list boot_aggregate is the link between the preboot
  * event log and the IMA measurement list.  Read and calculate all the
  * possible per TPM bank boot_aggregate digests based on the existing
- * PCRs 0 - 7 to validate against the IMA boot_aggregate record.
+ * PCRs 0 - 9 to validate against the IMA boot_aggregate record. If PCRs
+ * 8 - 9 are not set (i.e. all-zeros), only PCRs 0 - 7 are considered.
  */
 static int cmd_ima_bootaggr(struct command *cmd)
 {
-- 
2.17.1


             reply	other threads:[~2020-06-16 15:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 12:02 Maurizio Drocco [this message]
2020-06-16 17:19 ` [PATCH] ima_evm_utils: extended calc_bootaggr to PCRs 8 - 9 Mimi Zohar
2020-06-16 14:28   ` [PATCH] ima_evm_utils: tests: boot_aggregate.test spans PCRs 0-9 Maurizio Drocco
2020-06-18 12:38 [PATCH] extend IMA boot_aggregate with kernel measurements Roberto Sassu
2020-06-18 20:11 ` Maurizio Drocco
2020-06-18 20:11   ` [PATCH] ima_evm_utils: extended calc_bootaggr to PCRs 8 - 9 Maurizio Drocco
2020-06-22 20:14     ` Mimi Zohar
2020-06-24 21:17 [PATCH v2] " Stefan Berger
2020-06-24 21:33 ` [PATCH] " Maurizio Drocco

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200616120228.16068-1-maurizio.drocco@ibm.com \
    --to=maurizio.drocco@ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).