<p>Philipp Deppenwiese has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22831">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">security/tpm: Add TPM_PCRRead tss function<br><br>Change-Id: Ic85517a8a69f352a02d20a67fbba3d910ef03a1c<br>Signed-off-by: Philipp Deppenwiese <zaolin@das-labor.org><br>---<br>M src/security/tpm/tss.h<br>M src/security/tpm/tss/tcg-1.2/tss.c<br>M src/security/tpm/tss/tcg-2.0/tss.c<br>3 files changed, 27 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/22831/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/security/tpm/tss.h b/src/security/tpm/tss.h<br>index 3cc50ef..612df0f 100644<br>--- a/src/security/tpm/tss.h<br>+++ b/src/security/tpm/tss.h<br>@@ -151,6 +151,11 @@<br>                  uint8_t *out_digest);<br> <br> /**<br>+ * Read current PCR digest<br>+ */<br>+uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest);<br>+<br>+/**<br>  * Get the entire set of permanent flags.<br>  */<br> uint32_t tlcl_get_permanent_flags(TPM_PERMANENT_FLAGS *pflags);<br>diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c<br>index b74abd0..2bb2269 100644<br>--- a/src/security/tpm/tss/tcg-1.2/tss.c<br>+++ b/src/security/tpm/tss/tcg-1.2/tss.c<br>@@ -411,3 +411,20 @@<br> <br>     return result;<br> }<br>+<br>+uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest)<br>+{<br>+ struct s_tpm_pcr_read_cmd cmd;<br>+       uint8_t response[TPM_LARGE_ENOUGH_COMMAND_SIZE];<br>+     uint32_t result;<br>+<br>+  memcpy(&cmd, &tpm_pcr_read_cmd, sizeof(cmd));<br>+        to_tpm_uint32(cmd.buffer + tpm_pcr_read_cmd.pcrNum, pcr_num);<br>+<br>+     result = tlcl_send_receive(cmd.buffer, response, sizeof(response));<br>+  if (result == TPM_SUCCESS)<br>+           memcpy(out_digest, response + kTpmResponseHeaderLength,<br>+                              kPcrDigestLength);<br>+<br>+        return result;<br>+}<br>diff --git a/src/security/tpm/tss/tcg-2.0/tss.c b/src/security/tpm/tss/tcg-2.0/tss.c<br>index 0dbf8c8..0bee09b 100644<br>--- a/src/security/tpm/tss/tcg-2.0/tss.c<br>+++ b/src/security/tpm/tss/tcg-2.0/tss.c<br>@@ -416,3 +416,8 @@<br> {<br>  return TPM_SUCCESS;<br> }<br>+<br>+uint32_t tlcl_pcr_read(int pcr_num, uint8_t *out_digest)<br>+{<br>+    return TPM_SUCCESS;<br>+}<br></pre><p>To view, visit <a href="https://review.coreboot.org/22831">change 22831</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22831"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ic85517a8a69f352a02d20a67fbba3d910ef03a1c </div>
<div style="display:none"> Gerrit-Change-Number: 22831 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Philipp Deppenwiese <zaolin.daisuki@gmail.com> </div>