summaryrefslogtreecommitdiff
path: root/include/tpm-common.h
diff options
context:
space:
mode:
authorIlias Apalodimas <ilias.apalodimas@linaro.org>2024-12-24 08:01:09 -0800
committerIlias Apalodimas <ilias.apalodimas@linaro.org>2025-01-07 15:45:51 +0200
commitffdbf775e71b8160a37ca65bfa38ed037807dbf2 (patch)
tree40bd279ee1ab66014d938f6e499ff162125695ac /include/tpm-common.h
parent8dc886ce314282de9d65fac1e8c68ee40d30f678 (diff)
tpm: Keep the active PCRs in the chip private data
We have a lot of code trying to reason about the active TPM PCRs when creating an EventLog. Since changing the active banks can't be done on the fly and requires a TPM reset, let's store them in the chip private data instead. Upcoming patches will use this during the EventLog creation. Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'include/tpm-common.h')
-rw-r--r--include/tpm-common.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/include/tpm-common.h b/include/tpm-common.h
index 1ba81386ce1..fd33cba6ef2 100644
--- a/include/tpm-common.h
+++ b/include/tpm-common.h
@@ -42,12 +42,22 @@ enum tpm_version {
TPM_V2,
};
+/*
+ * We deviate from this draft of the specification by increasing the value of
+ * TPM2_NUM_PCR_BANKS from 3 to 16 to ensure compatibility with TPM2
+ * implementations that have enabled a larger than typical number of PCR
+ * banks. This larger value for TPM2_NUM_PCR_BANKS is expected to be included
+ * in a future revision of the specification.
+ */
+#define TPM2_NUM_PCR_BANKS 16
+
/**
* struct tpm_chip_priv - Information about a TPM, stored by the uclass
*
- * These values must be set up by the device's probe() method before
+ * Some of hese values must be set up by the device's probe() method before
* communcation is attempted. If the device has an xfer() method, this is
* not needed. There is no need to set up @buf.
+ * The active_banks is only valid for TPMv2 after the device is initialized.
*
* @version: TPM stack to be used
* @duration_ms: Length of each duration type in milliseconds
@@ -55,6 +65,8 @@ enum tpm_version {
* @buf: Buffer used during the exchanges with the chip
* @pcr_count: Number of PCR per bank
* @pcr_select_min: Minimum size in bytes of the pcrSelect array
+ * @active_bank_count: Number of active PCR banks
+ * @active_banks: Array of active PCRs
* @plat_hier_disabled: Platform hierarchy has been disabled (TPM is locked
* down until next reboot)
*/
@@ -68,6 +80,10 @@ struct tpm_chip_priv {
/* TPM v2 specific data */
uint pcr_count;
uint pcr_select_min;
+#if IS_ENABLED(CONFIG_TPM_V2)
+ u8 active_bank_count;
+ u32 active_banks[TPM2_NUM_PCR_BANKS];
+#endif
bool plat_hier_disabled;
};