Re: [PATCH v6 1/7] tpm: dynamically allocate the allocated_banks array

From: Jarkko Sakkinen
Date: Wed Dec 12 2018 - 13:32:14 EST


On Thu, Dec 06, 2018 at 06:56:33PM +0100, Roberto Sassu wrote:
> 2 PCR selections
> hash TPM_ALG_SHA1
> TPMS_PCR_SELECTION length 3
> ff ff ff
> hash TPM_ALG_SHA256
> TPMS_PCR_SELECTION length 3
> 00 00 00
>
> The pcr_select fields - "ff ff ff" and "00 00 00" - are bit masks for
> the enabled PCRs. The SHA1 bank is enabled for all PCRs (0-23), while
> the SHA256 bank is not enabled.

Uh, thanks. Can you add a note to the commit message?


> >
> > /* Check that at least some of the PCRs have been allocated. This is
> > * required because CAP_PCRS ...
> > */
> > if (memchr_inv(pcr_selection.pcr_select, 0, pcr_selection.size_of_select))
> > nr_allocated_banks++;
> >
> > [yeah, comment would be awesome about CAP_PCRS. Did not finish up the
> > comment because I don't know the answer]
> >
> > In addition, it would be consistent to call the local variable also
> > nr_allocated_banks (not nr_alloc_banks).
>
> Unfortunately, I exceed the limit of characters per line.

Not sure what you mean?

/Jarkko