From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
Roberto Sassu <roberto.sassu@huawei.com>,
"Bruno E . O . Meneguele" <brdeoliv@redhat.com>,
Mimi Zohar <zohar@linux.vnet.ibm.com>
Subject: [PATCH 06/10] ima-evm-utils: indicate measurement list signature verification failure
Date: Mon, 22 Jan 2018 09:54:01 -0500 [thread overview]
Message-ID: <1516632845-7087-7-git-send-email-zohar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1516632845-7087-1-git-send-email-zohar@linux.vnet.ibm.com>
Walking the measurement list and calculating the PCR to compare
against the TPM is only the first step. The next step is verifying
the file signatures contained in the measurement list. This patch
differentiates between the two.
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
---
src/evmctl.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/evmctl.c b/src/evmctl.c
index e0ed93d..f791a5b 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1333,13 +1333,14 @@ void ima_show(struct template_entry *entry)
log_debug_dump(entry->header.digest, sizeof(entry->header.digest));
}
-void ima_ng_show(struct template_entry *entry)
+int ima_ng_show(struct template_entry *entry)
{
uint8_t *fieldp = entry->template;
uint32_t field_len;
int total_len = entry->template_len, digest_len, len, sig_len;
uint8_t *digest, *sig = NULL;
char *algo, *path;
+ int err = 0;
/* get binary digest */
field_len = *(uint32_t *)fieldp;
@@ -1392,12 +1393,13 @@ void ima_ng_show(struct template_entry *entry)
if (sig) {
log_info(" ");
log_dump(sig, sig_len);
- ima_verify_signature(path, sig, sig_len);
+ err = ima_verify_signature(path, sig, sig_len);
} else
log_info("\n");
if (total_len)
log_err("Remain unprocessed data: %d\n", total_len);
+ return err;
}
static int ima_measurement(const char *file)
@@ -1407,6 +1409,7 @@ static int ima_measurement(const char *file)
struct template_entry entry = { .template = 0 };
FILE *fp;
int err = -1;
+ int verify_sig_failed = 0;
memset(fox, 0xff, SHA_DIGEST_LENGTH);
@@ -1452,10 +1455,12 @@ static int ima_measurement(const char *file)
if (validate)
ima_verify_template_hash(&entry);
- if (!strcmp(entry.name, "ima"))
+ if (!strcmp(entry.name, "ima")) {
ima_show(&entry);
- else
- ima_ng_show(&entry);
+ } else {
+ if (ima_ng_show(&entry) != 0)
+ verify_sig_failed = 1;
+ }
}
tpm_pcr_read(10, pcr10, sizeof(pcr10));
@@ -1469,6 +1474,8 @@ static int ima_measurement(const char *file)
if (memcmp(pcr, pcr10, sizeof(pcr))) {
log_err("PCRAgg does not match PCR-10\n");
goto out;
+ } else if (verify_sig_failed == 1) {
+ log_err("PCRAgg matches PCR-10, but list contains unknown keys or invalid signatures\n");
}
err = 0;
--
2.7.4
next prev parent reply other threads:[~2018-01-22 14:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 14:53 [PATCH 00/10] ima-evm-utils Mimi Zohar
2018-01-22 14:53 ` [PATCH 01/10] ima-evm-utils: fix "ima_measurement" template fields length Mimi Zohar
2018-01-22 14:53 ` [PATCH 02/10] ima-evm-utils: revert the change to use printf instead of log_info() Mimi Zohar
2018-01-22 14:53 ` [PATCH 03/10] ima-evm-utils: fix spelling error Mimi Zohar
2018-01-22 14:53 ` [PATCH 04/10] ima-evm-utils: remove the unnecessary display of the keyid Mimi Zohar
2018-01-22 14:54 ` [PATCH 05/10] ima-evm-utils: support verifying the measurement list using multiple keys Mimi Zohar
2018-01-22 14:54 ` Mimi Zohar [this message]
2018-01-22 14:54 ` [PATCH 07/10] ima-evm-utils: add support for specifying the pcr file location Mimi Zohar
2018-01-22 14:54 ` [PATCH 08/10] ima-evm-utils: verify the measurement list signature based on the list digest Mimi Zohar
2018-01-22 14:54 ` [PATCH 09/10] ima-evm-utils: verify IMA file hashes stored as xattrs Mimi Zohar
2018-01-22 14:54 ` [PATCH 10/10] ima-evm-utils: add support for validating multiple pcrs Mimi Zohar
2018-01-28 19:01 ` [PATCH 00/10] ima-evm-utils Mimi Zohar
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=1516632845-7087-7-git-send-email-zohar@linux.vnet.ibm.com \
--to=zohar@linux.vnet.ibm.com \
--cc=brdeoliv@redhat.com \
--cc=dmitry.kasatkin@gmail.com \
--cc=linux-integrity@vger.kernel.org \
--cc=roberto.sassu@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.