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

Ken Goldman kgold at linux.ibm.com
Tue Dec 11 21:01:07 UTC 2018


On 12/4/2018 6:18 PM, Jarkko Sakkinen wrote:
> 
>> +		for (j = 0; j < pcr_selection.size_of_select; j++)
>> +			if (pcr_selection.pcr_select[j])
>> +				break;
>> +
>> +		if (j < pcr_selection.size_of_select) {
>> +			chip->allocated_banks[nr_alloc_banks] = hash_alg;
>> +			nr_alloc_banks++;
>> +		}
>> +
> 
> Why was this needed? Can CAP_PCRS return completely unallocated banks?
> 

Yes.  E.g., here's a TPM with 4 hash algorithms and two banks with 
allocated PCRs.

 > getcapability -cap 5
4 PCR selections
     hash TPM_ALG_SHA1
     TPMS_PCR_SELECTION length 3
     ff ff ff
     hash TPM_ALG_SHA256
     TPMS_PCR_SELECTION length 3
     ff ff ff
     hash TPM_ALG_SHA384
     TPMS_PCR_SELECTION length 3
     00 00 00
     hash TPM_ALG_SHA512
     TPMS_PCR_SELECTION length 3
     00 00 00



More information about the Linux-security-module-archive mailing list