aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/tpm/tpm.h
diff options
context:
space:
mode:
authorGravatar Roberto Sassu <roberto.sassu@huawei.com> 2019-02-06 17:24:47 +0100
committerGravatar Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> 2019-02-13 09:48:50 +0200
commitbcfff8384f6c4e6627676ef07ccad9cfacd67849 (patch)
tree4a9e67c0f8419d7cbf56852b0b150efb90f8ca4c /drivers/char/tpm/tpm.h
parenttpm: remove @flags from tpm_transmit() (diff)
downloadlinux-bcfff8384f6c4e6627676ef07ccad9cfacd67849.tar.gz
linux-bcfff8384f6c4e6627676ef07ccad9cfacd67849.tar.bz2
linux-bcfff8384f6c4e6627676ef07ccad9cfacd67849.zip
tpm: dynamically allocate the allocated_banks array
This patch renames active_banks (member of tpm_chip) to allocated_banks, stores the number of allocated PCR banks in nr_allocated_banks (new member of tpm_chip), and replaces the static array with a pointer to a dynamically allocated array. tpm2_get_pcr_allocation() determines if a PCR bank is allocated by checking the mask in the TPML_PCR_SELECTION structure returned by the TPM for TPM2_Get_Capability(). If a bank is not allocated, the TPM returns that bank in TPML_PCR_SELECTION, with all bits in the mask set to zero. In this case, the bank is not included in chip->allocated_banks, to avoid that TPM driver users unnecessarily calculate a digest for that bank. One PCR bank with algorithm set to SHA1 is always allocated for TPM 1.x. As a consequence of the introduction of nr_allocated_banks, tpm_pcr_extend() does not check anymore if the algorithm stored in tpm_chip is equal to zero. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm.h')
-rw-r--r--drivers/char/tpm/tpm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 183e2b93e0fe..cd330ace6248 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -257,7 +257,8 @@ struct tpm_chip {
const struct attribute_group *groups[3];
unsigned int groups_cnt;
- u16 active_banks[7];
+ u32 nr_allocated_banks;
+ u16 *allocated_banks;
#ifdef CONFIG_ACPI
acpi_handle acpi_dev_handle;
char ppi_version[TPM_PPI_VERSION_LEN + 1];