<p>Philipp Deppenwiese has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/29326">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">security/tpm: Move TPM2 NVRAM specific settings<br><br>* Move TPM2 NVRAM default parameters from vboot<br>to a tpm2 specific header<br><br>Change-Id: Iec9d1c272ed8d0872c9bbc406e98a19ac7a376bd<br>Signed-off-by: Philipp Deppenwiese <zaolin@das-labor.org><br>---<br>M src/security/tpm/tss/tcg-2.0/tss_structures.h<br>M src/security/vboot/secdata_tpm.c<br>2 files changed, 30 insertions(+), 29 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/29326/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/security/tpm/tss/tcg-2.0/tss_structures.h b/src/security/tpm/tss/tcg-2.0/tss_structures.h</span><br><span>index e902f3c..89f7219 100644</span><br><span>--- a/src/security/tpm/tss/tcg-2.0/tss_structures.h</span><br><span>+++ b/src/security/tpm/tss/tcg-2.0/tss_structures.h</span><br><span>@@ -151,6 +151,36 @@</span><br><span> #define PT_VAR                                 (PT_GROUP * 2)</span><br><span> #define TPM_PT_PERMANENT               ((TPM_PT)(PT_VAR + 0))</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * Different sets of NVRAM space attributes apply to the "ro" spaces,</span><br><span style="color: hsl(120, 100%, 40%);">+ * i.e. those which should not be possible to delete or modify once</span><br><span style="color: hsl(120, 100%, 40%);">+ * the RO exits, and the rest of the NVRAM spaces.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+const static TPMA_NV ro_space_attributes = {</span><br><span style="color: hsl(120, 100%, 40%);">+       .TPMA_NV_PPWRITE = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+ .TPMA_NV_AUTHREAD = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+        .TPMA_NV_PPREAD = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+  .TPMA_NV_PLATFORMCREATE = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+  .TPMA_NV_WRITE_STCLEAR = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+   .TPMA_NV_POLICY_DELETE = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const static TPMA_NV rw_space_attributes = {</span><br><span style="color: hsl(120, 100%, 40%);">+       .TPMA_NV_PPWRITE = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+ .TPMA_NV_AUTHREAD = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+        .TPMA_NV_PPREAD = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+  .TPMA_NV_PLATFORMCREATE = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This policy digest was obtained using TPM2_PolicyPCR</span><br><span style="color: hsl(120, 100%, 40%);">+ * selecting only PCR_0 with a value of all zeros.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+const static uint8_t pcr0_unchanged_policy[] = {</span><br><span style="color: hsl(120, 100%, 40%);">+    0x09, 0x93, 0x3C, 0xCE, 0xEB, 0xB4, 0x41, 0x11, 0x18, 0x81, 0x1D,</span><br><span style="color: hsl(120, 100%, 40%);">+     0xD4, 0x47, 0x78, 0x80, 0x08, 0x88, 0x86, 0x62, 0x2D, 0xD7, 0x79,</span><br><span style="color: hsl(120, 100%, 40%);">+     0x94, 0x46, 0x62, 0x26, 0x68, 0x8E, 0xEE, 0xE6, 0x6A, 0xA1};</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /* Structures of payloads of various TPM2 commands. */</span><br><span> struct tpm2_get_capability {</span><br><span>     TPM_CAP capability;</span><br><span>diff --git a/src/security/vboot/secdata_tpm.c b/src/security/vboot/secdata_tpm.c</span><br><span>index c62f18b..286b2be 100644</span><br><span>--- a/src/security/vboot/secdata_tpm.c</span><br><span>+++ b/src/security/vboot/secdata_tpm.c</span><br><span>@@ -168,35 +168,6 @@</span><br><span> static const uint8_t rec_hash_data[REC_HASH_NV_SIZE] = { };</span><br><span> </span><br><span> #if IS_ENABLED(CONFIG_TPM2)</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * Different sets of NVRAM space attributes apply to the "ro" spaces,</span><br><span style="color: hsl(0, 100%, 40%);">- * i.e. those which should not be possible to delete or modify once</span><br><span style="color: hsl(0, 100%, 40%);">- * the RO exits, and the rest of the NVRAM spaces.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-const static TPMA_NV ro_space_attributes = {</span><br><span style="color: hsl(0, 100%, 40%);">-  .TPMA_NV_PPWRITE = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-   .TPMA_NV_AUTHREAD = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-  .TPMA_NV_PPREAD = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-    .TPMA_NV_PLATFORMCREATE = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-    .TPMA_NV_WRITE_STCLEAR = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-     .TPMA_NV_POLICY_DELETE = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-const static TPMA_NV rw_space_attributes = {</span><br><span style="color: hsl(0, 100%, 40%);">-       .TPMA_NV_PPWRITE = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-   .TPMA_NV_AUTHREAD = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-  .TPMA_NV_PPREAD = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-    .TPMA_NV_PLATFORMCREATE = 1,</span><br><span style="color: hsl(0, 100%, 40%);">-};</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-/*</span><br><span style="color: hsl(0, 100%, 40%);">- * This policy digest was obtained using TPM2_PolicyPCR</span><br><span style="color: hsl(0, 100%, 40%);">- * selecting only PCR_0 with a value of all zeros.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">-const static uint8_t pcr0_unchanged_policy[] = {</span><br><span style="color: hsl(0, 100%, 40%);">-    0x09, 0x93, 0x3C, 0xCE, 0xEB, 0xB4, 0x41, 0x11, 0x18, 0x81, 0x1D,</span><br><span style="color: hsl(0, 100%, 40%);">-       0xD4, 0x47, 0x78, 0x80, 0x08, 0x88, 0x86, 0x62, 0x2D, 0xD7, 0x79,</span><br><span style="color: hsl(0, 100%, 40%);">-       0x94, 0x46, 0x62, 0x26, 0x68, 0x8E, 0xEE, 0xE6, 0x6A, 0xA1};</span><br><span> </span><br><span> /* Nothing special in the TPM2 path yet. */</span><br><span> static uint32_t safe_write(uint32_t index, const void *data, uint32_t length)</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/29326">change 29326</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/29326"/><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: Iec9d1c272ed8d0872c9bbc406e98a19ac7a376bd </div>
<div style="display:none"> Gerrit-Change-Number: 29326 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Philipp Deppenwiese <zaolin.daisuki@gmail.com> </div>