From: Roberto Sassu <roberto.sassu@huawei.com>
To: Mimi Zohar <zohar@linux.ibm.com>,
"James.Bottomley@HansenPartnership.com"
<James.Bottomley@HansenPartnership.com>,
"jarkko.sakkinen@linux.intel.com"
<jarkko.sakkinen@linux.intel.com>
Cc: "linux-integrity@vger.kernel.org"
<linux-integrity@vger.kernel.org>,
"linux-security-module@vger.kernel.org"
<linux-security-module@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Silviu Vlasceanu <Silviu.Vlasceanu@huawei.com>
Subject: RE: [PATCH v2 5/8] ima: Switch to dynamically allocated buffer for template digests
Date: Thu, 6 Feb 2020 16:36:28 +0000 [thread overview]
Message-ID: <5bbf950910db4a5a853aaaeba5b18529@huawei.com> (raw)
In-Reply-To: <1581006834.5585.430.camel@linux.ibm.com>
> -----Original Message-----
> From: owner-linux-security-module@vger.kernel.org [mailto:owner-linux-
> security-module@vger.kernel.org] On Behalf Of Mimi Zohar
> Sent: Thursday, February 6, 2020 5:34 PM
> To: Roberto Sassu <roberto.sassu@huawei.com>;
> James.Bottomley@HansenPartnership.com;
> jarkko.sakkinen@linux.intel.com
> Cc: linux-integrity@vger.kernel.org; linux-security-module@vger.kernel.org;
> linux-kernel@vger.kernel.org; Silviu Vlasceanu
> <Silviu.Vlasceanu@huawei.com>
> Subject: Re: [PATCH v2 5/8] ima: Switch to dynamically allocated buffer for
> template digests
>
> On Thu, 2020-02-06 at 16:27 +0000, Roberto Sassu wrote:
> > > -----Original Message-----
> > > From: Mimi Zohar [mailto:zohar@linux.ibm.com]
> > > Sent: Thursday, February 6, 2020 5:08 PM
> > > To: Roberto Sassu <roberto.sassu@huawei.com>;
> > > James.Bottomley@HansenPartnership.com;
> > > jarkko.sakkinen@linux.intel.com
> > > Cc: linux-integrity@vger.kernel.org; linux-security-
> module@vger.kernel.org;
> > > linux-kernel@vger.kernel.org; Silviu Vlasceanu
> > > <Silviu.Vlasceanu@huawei.com>
> > > Subject: Re: [PATCH v2 5/8] ima: Switch to dynamically allocated buffer
> for
> > > template digests
> > >
> > > Hi Roberto,
> > >
> > > On Wed, 2020-02-05 at 11:33 +0100, Roberto Sassu wrote:
> > > > This patch dynamically allocates the array of tpm_digest structures in
> > > > ima_alloc_init_template() and ima_restore_template_data(). The size
> of
> > > the
> > > > array, stored in ima_num_template_digests, is initially equal to 1
> (SHA1)
> > > > and will be determined in the upcoming patches depending on the
> > > allocated
> > > > PCR banks and the chosen default IMA algorithm.
> > > >
> > > > Calculating the SHA1 digest is mandatory, as SHA1 still remains the
> default
> > > > hash algorithm for the measurement list. When IMA will support the
> > > Crypto
> > > > Agile format, remaining digests will be also provided.
> > > >
> > > > The position in the array of the SHA1 digest is stored in the
> ima_sha1_idx
> > > > global variable and it is determined at IMA initialization time.
> > > >
> > > > Changelog
> > > >
> > > > v1:
> > > > - move ima_sha1_idx to ima_crypto.c
> > > > - introduce ima_num_template_digests (suggested by Mimi)
> > >
> > > Instead of hardcoding "nr_allocated_banks + 1" or nr_allocated_banks +
> > > 2", I suggested defining "nr_allocated_banks + extra", where "extra"
> > > could be 0, 1, or 2.
> > >
> > > The rest of the code would remain exactly the same as you had.
> >
> > Ok. I did a small improvement. Since we determine the number of
> > required elements of ima_algo_array before kmalloc() I thought it
> > was ok to directly set that number of elements in a single variable.
> >
> > If you think that having two variables is better, I will change it.
>
> The connection to nr_allocated_banks is then not as visible. Using
> two variables is clearer.
Ok, no problem. I will change it in the next version.
Roberto
HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
Managing Director: Li Peng, Li Jian, Shi Yanli
next prev parent reply other threads:[~2020-02-06 16:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-05 10:33 [PATCH v2 0/8] ima: support stronger algorithms for attestation Roberto Sassu
2020-02-05 10:33 ` [PATCH v2 1/8] tpm: Initialize crypto_id of allocated_banks to HASH_ALGO__LAST Roberto Sassu
2020-02-05 21:57 ` Jarkko Sakkinen
2020-02-05 10:33 ` [PATCH v2 2/8] ima: Switch to ima_hash_algo for boot aggregate Roberto Sassu
[not found] ` <20200205144515.1DDE4217F4@mail.kernel.org>
2020-02-05 15:36 ` Roberto Sassu
2020-02-05 20:41 ` Mimi Zohar
2020-02-06 9:33 ` Roberto Sassu
2020-02-05 21:00 ` Mimi Zohar
2020-02-06 9:36 ` Roberto Sassu
2020-02-06 12:17 ` Mimi Zohar
2020-02-06 12:28 ` Roberto Sassu
2020-02-06 12:31 ` Mimi Zohar
2020-02-05 10:33 ` [PATCH v2 3/8] ima: Evaluate error in init_ima() Roberto Sassu
2020-02-05 10:39 ` Roberto Sassu
2020-02-05 10:33 ` [PATCH v2 4/8] ima: Store template digest directly in ima_template_entry Roberto Sassu
2020-02-05 10:33 ` [PATCH v2 5/8] ima: Switch to dynamically allocated buffer for template digests Roberto Sassu
2020-02-05 16:39 ` Roberto Sassu
2020-02-06 16:08 ` Mimi Zohar
2020-02-06 16:27 ` Roberto Sassu
2020-02-06 16:33 ` Mimi Zohar
2020-02-06 16:36 ` Roberto Sassu [this message]
2020-02-05 10:33 ` [PATCH v2 6/8] ima: Allocate and initialize tfm for each PCR bank Roberto Sassu
2020-02-05 23:41 ` kbuild test robot
2020-02-05 23:41 ` kbuild test robot
2020-02-05 23:41 ` [RFC PATCH] ima: ima_init_ima_crypto() can be static kbuild test robot
2020-02-05 23:41 ` kbuild test robot
2020-02-05 10:33 ` [PATCH v2 7/8] ima: Calculate and extend PCR with digests in ima_template_entry Roberto Sassu
2020-02-05 10:33 ` [PATCH v2 8/8] ima: Use ima_hash_algo for collision detection in the measurement list Roberto Sassu
2020-03-02 1:22 ` [ima] 9165b814d2: BUG:kernel_NULL_pointer_dereference,address kernel test robot
2020-03-02 1:22 ` kernel test robot
2020-03-02 9:46 ` Roberto Sassu
2020-03-02 9:46 ` [ima] 9165b814d2: BUG:kernel_NULL_pointer_dereference, address Roberto Sassu
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=5bbf950910db4a5a853aaaeba5b18529@huawei.com \
--to=roberto.sassu@huawei.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=Silviu.Vlasceanu@huawei.com \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@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 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.