Re: [PATCH 2/2] ima: support calculating the boot_aggregate based on different TPM banks

From: Mimi Zohar
Date: Wed Jan 29 2020 - 18:20:19 EST


On Tue, 2020-01-28 at 10:40 -0500, Mimi Zohar wrote:
> > This code assumes that the algorithm used to calculate boot_aggregate and
> > the algorithm of the PCR bank can be different. I don't know if it is possible to
> > communicate to the verifier which bank has been selected (it depends on
> > the local configuration).
>
> Agreed, but defaulting to the first bank would only happen if the IMA
> default hash algorithm is not a configured TPM algorithm.
>
> >
> > In my opinion the safest approach would be to use the same algorithm for the
> > digest and the PCR bank. If you agree to this, then the code above must be
> > moved to ima_calc_boot_aggregate() so that the algorithm of the selected
> > PCR bank can be passed to ima_alloc_tfm().
>
> Using the same hash algorithm, preferably the IMA hash default
> algorithm, for reading the TPM PCR bank and calculating the
> boot_aggregate makes sense.
>
> >
> > The selected PCR bank might be not the first, if the algorithm is unknown to
> > the crypto subsystem.
>
> It sounds like you're suggesting finding a common configured hash
> algorithm between the TPM and the kernel.Â

I'd like to clarify the logic for the case when a common algorithm
does not exist. ÂNone of the TPM allocated banks are known by the
kernel. ÂIf the hash algorithm of the boot_aggregate represents not
only that of the digest included in the measurement list, but also of
the TPM PCR bank read, what should happen? ÂShould the boot aggregate
be 0's, like in the case when there isn't a TPM?

thanks,

Mimi