<p>Werner Zeh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/29176">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">security/tpm: Unify return value for tlcl_resume() across TPM 1.2 and 2.0<br><br>The TPM_Startup is slightly different in terms of the return value among<br>TPM version 1.2 and TPM 2.0. TPM 1.2 returns TPM_E_INVALID_POSTINIT<br>while TPM 2.0 returns TPM_RC_INITIALIZE in the case where the<br>TPM_Startup command is inappropriate. Do not expose this difference to<br>the TSPI layer but instead handle it in the TSS layer and provide a<br>common return value for both versions.<br><br>Change-Id: Ibaca1aa6100eaac69a3c1ba00e8c50dedc097d02<br>Signed-off-by: Werner Zeh <werner.zeh@siemens.com><br>---<br>M src/security/tpm/tspi/tspi.c<br>M src/security/tpm/tss/tcg-1.2/tss.c<br>2 files changed, 11 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/29176/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/security/tpm/tspi/tspi.c b/src/security/tpm/tspi/tspi.c</span><br><span>index fccf224..c13a9d2 100644</span><br><span>--- a/src/security/tpm/tspi/tspi.c</span><br><span>+++ b/src/security/tpm/tspi/tspi.c</span><br><span>@@ -97,10 +97,10 @@</span><br><span>         /* Handle special init for S3 resume path */</span><br><span>         if (s3flag) {</span><br><span>                result = tlcl_resume();</span><br><span style="color: hsl(0, 100%, 40%);">-         if (result == TPM_E_INVALID_POSTINIT)</span><br><span style="color: hsl(120, 100%, 40%);">+         if (result == TPM_SUCCESS) {</span><br><span>                         printk(BIOS_INFO, "TPM: Already initialized.\n");</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-             return TPM_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+                   return TPM_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span>    }</span><br><span> </span><br><span>        result = tlcl_startup();</span><br><span>diff --git a/src/security/tpm/tss/tcg-1.2/tss.c b/src/security/tpm/tss/tcg-1.2/tss.c</span><br><span>index 0cb7eaa..db98669 100644</span><br><span>--- a/src/security/tpm/tss/tcg-1.2/tss.c</span><br><span>+++ b/src/security/tpm/tss/tcg-1.2/tss.c</span><br><span>@@ -103,7 +103,7 @@</span><br><span>  VBDEBUG("TPM: command 0x%x returned 0x%x\n",</span><br><span>               tpm_command_code(request), result);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-return result;</span><br><span style="color: hsl(120, 100%, 40%);">+ return result;</span><br><span> }</span><br><span> </span><br><span> </span><br><span>@@ -174,8 +174,14 @@</span><br><span> </span><br><span> uint32_t tlcl_resume(void)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+     uint32_t result;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   VBDEBUG("TPM: Resume\n");</span><br><span style="color: hsl(0, 100%, 40%);">-     return send(tpm_resume_cmd.buffer);</span><br><span style="color: hsl(120, 100%, 40%);">+   result = send(tpm_resume_cmd.buffer);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (result == TPM_E_INVALID_POSTINIT)</span><br><span style="color: hsl(120, 100%, 40%);">+         return TPM_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+   else</span><br><span style="color: hsl(120, 100%, 40%);">+          return result;</span><br><span> }</span><br><span> </span><br><span> uint32_t tlcl_self_test_full(void)</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/29176">change 29176</a>. To unsubscribe, or for help writing mail filters, 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/29176"/><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: Ibaca1aa6100eaac69a3c1ba00e8c50dedc097d02 </div>
<div style="display:none"> Gerrit-Change-Number: 29176 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Werner Zeh <werner.zeh@siemens.com> </div>