Philipp Deppenwiese has uploaded this change for review. ( https://review.coreboot.org/22831
Change subject: security/tpm: Add TPM_PCRRead tss function ......................................................................
security/tpm: Add TPM_PCRRead tss function
Change-Id: Ic85517a8a69f352a02d20a67fbba3d910ef03a1c Signed-off-by: Philipp Deppenwiese zaolin@das-labor.org --- M src/security/tpm/tss.h M src/security/tpm/tss/tcg-1.2/tss.c M src/security/tpm/tss/tcg-2.0/tss.c 3 files changed, 27 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/22831/1
diff --git a/src/security/tpm/tss.h b/src/security/tpm/tss.h index 3cc50ef..612df0f 100644 --- a/src/security/tpm/tss.h +++ b/src/security/tpm/tss.h @@ -151,6 +151,11 @@ uint8_t *out_digest);
/** + * Read current PCR digest + */ +uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest); + +/** * Get the entire set of permanent flags. */ uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags); diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c index b74abd0..2bb2269 100644 --- a/src/security/tpm/tss/tcg-1.2/tss.c +++ b/src/security/tpm/tss/tcg-1.2/tss.c @@ -411,3 +411,20 @@
return result; } + +uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest) +{ + struct s_tpm_pcr_read_cmd cmd; + uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE]; + uint32_t result; + + memcpy(&cmd, &tpm_pcr_read_cmd, sizeof(cmd)); + to_tpm_uint32(cmd.buffer + tpm_pcr_read_cmd.pcrNum, pcr_num); + + result = tlcl_send_receive(cmd.buffer, response, sizeof(response)); + if (result == TPM_SUCCESS) + memcpy(out_digest, response + kTpmResponseHeaderLength, + kPcrDigestLength); + + return result; +} diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c index 0dbf8c8..0bee09b 100644 --- a/src/security/tpm/tss/tcg-2.0/tss.c +++ b/src/security/tpm/tss/tcg-2.0/tss.c @@ -416,3 +416,8 @@ { return TPM_SUCCESS; } + +uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest) +{ + return TPM_SUCCESS; +}