[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1580479108.6104.73.camel@linux.ibm.com>
Date: Fri, 31 Jan 2020 08:58:28 -0500
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Roberto Sassu <roberto.sassu@...wei.com>,
"jarkko.sakkinen@...ux.intel.com" <jarkko.sakkinen@...ux.intel.com>,
"james.bottomley@...senpartnership.com"
<james.bottomley@...senpartnership.com>,
"linux-integrity@...r.kernel.org" <linux-integrity@...r.kernel.org>
Cc: "linux-security-module@...r.kernel.org"
<linux-security-module@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Silviu Vlasceanu <Silviu.Vlasceanu@...wei.com>
Subject: Re: [PATCH 5/8] ima: allocate and initialize tfm for each PCR bank
On Fri, 2020-01-31 at 13:42 +0000, Roberto Sassu wrote:
> > -----Original Message-----
> > From: linux-integrity-owner@...r.kernel.org [mailto:linux-integrity-
> > owner@...r.kernel.org] On Behalf Of Mimi Zohar
> > Sent: Friday, January 31, 2020 1:19 PM
> > To: Roberto Sassu <roberto.sassu@...wei.com>;
> > jarkko.sakkinen@...ux.intel.com;
> > james.bottomley@...senpartnership.com; linux-integrity@...r.kernel.org
> > Cc: linux-security-module@...r.kernel.org; linux-kernel@...r.kernel.org;
> > Silviu Vlasceanu <Silviu.Vlasceanu@...wei.com>
> > Subject: Re: [PATCH 5/8] ima: allocate and initialize tfm for each PCR bank
> >
> > On Mon, 2020-01-27 at 18:04 +0100, Roberto Sassu wrote:
> > > This patch creates a crypto_shash structure for each allocated PCR bank
> > and
> > > for SHA1 if a bank with that algorithm is not currently allocated.
> > >
> > > Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
> >
> > <snip>
> >
> > > +int __init ima_init_crypto(void)
> > > +{
> > > + enum hash_algo algo;
> > > + long rc;
> > > + int i;
> > > +
> > > + rc = ima_init_ima_crypto();
> > > + if (rc)
> > > + return rc;
> > > +
> > > + ima_algo_array = kmalloc_array(ima_tpm_chip-
> > >nr_allocated_banks + 1,
> > > + sizeof(*ima_algo_array), GFP_KERNEL);
> >
> > Perhaps instead of hard coding "nr_allocated_banks + 1", create a
> > variable for storing the number of "extra" banks. Walk the banks
> > setting ima_sha1_idx and, later, in a subsequent patch set
> > ima_hash_algo_idx.
>
> I could store the indexes in an array and add ARRAY_SIZE of that array.
Your current patches are straight forward and easy to review. I
really like that. What I'm proposing is a minor change, at least I
think it is a minor change. I trust whatever change you decide to
make will be just as easy to review.
Before re-posting, please define ima_sha1_idx and ima_hash_algo_idx as
__ro_after_init.
thanks,
Mimi
Powered by blists - more mailing lists