[SLOF] [PATCH v4 26/33] tpm2: Prefix functions with tpm12_ and adapt for TPM 2 case
Stefan Berger
stefanb at linux.vnet.ibm.com
Thu Dec 12 07:27:21 AEDT 2019
Prefex remaining TPM 1.2 related function with tpm12_ and adapt
some functions to handle the TPM 2 case in the switch statement.
Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
---
lib/libtpm/tcgbios.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/libtpm/tcgbios.c b/lib/libtpm/tcgbios.c
index bc54c8d..02b5ba8 100644
--- a/lib/libtpm/tcgbios.c
+++ b/lib/libtpm/tcgbios.c
@@ -1268,10 +1268,16 @@ static int tpm12_process_cfg(tpm_ppi_op ppi_op, bool verbose)
uint32_t tpm_process_opcode(uint8_t op, bool verbose)
{
- return tpm12_process_cfg(op, verbose);
+ switch (TPM_version) {
+ case TPM_VERSION_1_2:
+ return tpm12_process_cfg(op, verbose);
+ case TPM_VERSION_2:
+ break;
+ }
+ return TCGBIOS_GENERAL_ERROR;
}
-int tpm_get_state(void)
+static int tpm12_get_state(void)
{
int state = 0;
struct tpm_permanent_flags pf;
@@ -1299,6 +1305,17 @@ int tpm_get_state(void)
return state;
}
+int tpm_get_state(void)
+{
+ switch (TPM_version) {
+ case TPM_VERSION_1_2:
+ return tpm12_get_state();
+ case TPM_VERSION_2:
+ break;
+ }
+ return ~0;
+}
+
uint32_t tpm_measure_scrtm(void)
{
uint32_t rc;
--
2.17.1
More information about the SLOF
mailing list