From: Mimi Zohar <zohar@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>, Petr Vorel <pvorel@suse.cz>,
Bruno Meneguele <bmeneg@redhat.com>
Subject: [PATCH 3/3] ima-evm-utils: mixed "ima" and other template formats not supported
Date: Mon, 6 Jul 2020 22:27:17 -0400 [thread overview]
Message-ID: <1594088837-27526-4-git-send-email-zohar@linux.ibm.com> (raw)
In-Reply-To: <1594088837-27526-1-git-send-email-zohar@linux.ibm.com>
An IMA measurement list may not contain "ima" and other template
formats. Fail verifying the ima_measurement test.
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
src/evmctl.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/evmctl.c b/src/evmctl.c
index 9ee440f6a50a..21809b3229e9 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1830,8 +1830,9 @@ static int ima_measurement(const char *file)
{
struct tpm_bank_info *pseudo_banks;
struct tpm_bank_info *tpm_banks;
- int is_ima_template;
+ int is_ima_template, cur_template_fmt;
int num_banks = 0;
+ int first_record = 1;
struct template_entry entry = { .template = 0 };
FILE *fp;
@@ -1869,7 +1870,21 @@ static int ima_measurement(const char *file)
goto out;
}
- is_ima_template = strcmp(entry.name, "ima") == 0 ? 1 : 0;
+ /*
+ * The "ima" template format can not be mixed with other
+ * template formats records.
+ */
+ if (!first_record) {
+ cur_template_fmt = strcmp(entry.name, "ima") == 0 ? 1 : 0;
+ if ((is_ima_template && !cur_template_fmt) ||
+ (!is_ima_template && cur_template_fmt)) {
+ log_err("Mixed measurement list containing \"ima\" and other template formats not supported.\n");
+ goto out;
+ }
+ } else {
+ first_record = 0;
+ is_ima_template = strcmp(entry.name, "ima") == 0 ? 1 : 0;
+ }
/* The "ima" template data is not length prefixed. Skip it. */
if (!is_ima_template) {
--
2.7.5
prev parent reply other threads:[~2020-07-07 2:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-07 2:27 [PATCH 0/3] ima-evm-utils: original "ima" template support Mimi Zohar
2020-07-07 2:27 ` [PATCH 1/3] ima-evm-utils: support the original "ima" template Mimi Zohar
2020-07-07 2:27 ` [PATCH 2/3] ima-evm-utils: read the TPM 1.2 binary_bios_measurements Mimi Zohar
2020-07-07 2:27 ` Mimi Zohar [this message]
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=1594088837-27526-4-git-send-email-zohar@linux.ibm.com \
--to=zohar@linux.ibm.com \
--cc=bmeneg@redhat.com \
--cc=linux-integrity@vger.kernel.org \
--cc=pvorel@suse.cz \
/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).