From: Stefan Berger <stefanb@linux.ibm.com>
To: Mimi Zohar <zohar@linux.ibm.com>, linux-integrity@vger.kernel.org
Subject: Re: [ima-evm-utils][PATCH] Limit comparing the calculated PCR value to just a single bank
Date: Tue, 9 Feb 2021 11:44:44 -0500 [thread overview]
Message-ID: <668a7a2e-5a3a-af8a-ea9e-f285fb13545e@linux.ibm.com> (raw)
In-Reply-To: <20210209164116.152447-1-zohar@linux.ibm.com>
On 2/9/21 11:41 AM, Mimi Zohar wrote:
> TPM 2.0 banks may be extended either with a padded SHA1 hash or more
> recently with a per TPM bank calculated hash. If the measurement list
> is carried across kexec, the original kernel might extend the TPM
> differently than the new kernel.
>
> Support for verifying a mixed IMA measurement list is not supported. To
> permit verifying just the SHA1 bank, specify "--verify-bank=sha1" on the
> command line.
>
> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
> ---
> src/evmctl.c | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/src/evmctl.c b/src/evmctl.c
> index f7ffe388ef4f..051c218cc8b5 100644
> --- a/src/evmctl.c
> +++ b/src/evmctl.c
> @@ -125,6 +125,7 @@ static char *caps_str;
> static char *ima_str;
> static char *selinux_str;
> static char *search_type;
> +static char *verify_bank;
> static int verify_list_sig;
> static int recursive;
> static int msize;
> @@ -2011,6 +2012,16 @@ static int ima_measurement(const char *file)
> pseudo_banks_mask = (1 << num_banks) - 1;
> pseudo_padded_banks_mask = pseudo_banks_mask;
>
> + /* Instead of verifying all the banks, only verify a single bank */
> + for (c = 0; c < num_banks; c++) {
> + if (verify_bank
> + && strcmp(pseudo_padded_banks[c].algo_name, verify_bank)) {
> + pseudo_banks_mask ^= (1 << c);
> + pseudo_padded_banks_mask ^= (1 << c);
> + break;
> + }
> + }
> +
> while (fread(&entry.header, sizeof(entry.header), 1, fp)) {
> entry_num++;
> if (entry.header.name_len > TCG_EVENT_NAME_LEN_MAX) {
> @@ -2537,7 +2548,7 @@ struct command cmds[] = {
> {"ima_verify", cmd_verify_ima, 0, "file", "Verify IMA signature (for debugging).\n"},
> {"ima_setxattr", cmd_setxattr_ima, 0, "[--sigfile file]", "Set IMA signature from sigfile\n"},
> {"ima_hash", cmd_hash_ima, 0, "file", "Make file content hash.\n"},
> - {"ima_measurement", cmd_ima_measurement, 0, "[--ignore-violations] [--verify-sig [--key key1, key2, ...]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] file", "Verify measurement list (experimental).\n"},
> + {"ima_measurement", cmd_ima_measurement, 0, "[--ignore-violations] [--verify-sig [--key key1, key2, ...]] [--pcrs [hash-algorithm,]file [--pcrs hash-algorithm,file] ...] [--verify-bank hash-algorithm] file", "Verify measurement list (experimental).\n"},
> {"ima_boot_aggregate", cmd_ima_bootaggr, 0, "[--pcrs hash-algorithm,file] [TPM 1.2 BIOS event log]", "Calculate per TPM bank boot_aggregate digests\n"},
> {"ima_fix", cmd_ima_fix, 0, "[-t fdsxm] path", "Recursively fix IMA/EVM xattrs in fix mode.\n"},
> {"ima_clear", cmd_ima_clear, 0, "[-t fdsxm] path", "Recursively remove IMA/EVM xattrs.\n"},
> @@ -2578,6 +2589,7 @@ static struct option opts[] = {
> {"xattr-user", 0, 0, 140},
> {"ignore-violations", 0, 0, 141},
> {"pcrs", 1, 0, 142},
> + {"verify-bank", 2, 0, 143},
> {}
>
> };
> @@ -2766,6 +2778,9 @@ int main(int argc, char *argv[])
> }
> pcrfile[npcrfile++] = optarg;
> break;
> + case 143:
> + verify_bank = optarg;
> + break;
> case '?':
> exit(1);
> break;
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
prev parent reply other threads:[~2021-02-09 16:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-09 16:41 [ima-evm-utils][PATCH] Limit comparing the calculated PCR value to just a single bank Mimi Zohar
2021-02-09 16:44 ` Stefan Berger [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=668a7a2e-5a3a-af8a-ea9e-f285fb13545e@linux.ibm.com \
--to=stefanb@linux.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