[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1583208222.8544.168.camel@linux.ibm.com>
Date: Mon, 02 Mar 2020 23:03:42 -0500
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Roberto Sassu <roberto.sassu@...wei.com>,
James.Bottomley@...senPartnership.com,
jarkko.sakkinen@...ux.intel.com
Cc: linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, silviu.vlasceanu@...wei.com
Subject: Re: [PATCH v3 7/8] ima: Calculate and extend PCR with digests in
ima_template_entry
On Mon, 2020-02-10 at 11:04 +0100, Roberto Sassu wrote:
> @@ -219,6 +214,8 @@ int ima_restore_measurement_entry(struct ima_template_entry *entry)
>
> int __init ima_init_digests(void)
> {
> + u16 digest_size;
> + u16 crypto_id;
> int i;
>
> if (!ima_tpm_chip)
> @@ -229,8 +226,17 @@ int __init ima_init_digests(void)
> if (!digests)
> return -ENOMEM;
>
> - for (i = 0; i < ima_tpm_chip->nr_allocated_banks; i++)
> + for (i = 0; i < ima_tpm_chip->nr_allocated_banks; i++) {
> digests[i].alg_id = ima_tpm_chip->allocated_banks[i].alg_id;
> + digest_size = ima_tpm_chip->allocated_banks[i].digest_size;
> + crypto_id = ima_tpm_chip->allocated_banks[i].crypto_id;
> +
> + /* for unmapped TPM algorithms digest is still a padded SHA1 */
> + if (crypto_id == HASH_ALGO__LAST)
> + digest_size = SHA1_DIGEST_SIZE;
> +
> + memset(digests[i].digest, 0xff, digest_size);
Shouldn't the memset here be of the actual digest size even for
unmapped TPM algorithms.
> + }
>
> return 0;
> }
Powered by blists - more mailing lists