NV: allow reading FWMP before startup am: c456225bd5 am: f91bf20527
am: 39e898f8b5

Change-Id: I88c40dad59efef58f8daf51e875bda9d2f3f6833
diff --git a/NV.c b/NV.c
index 0099c19..3e639ea 100644
--- a/NV.c
+++ b/NV.c
@@ -1045,7 +1045,15 @@
        // indicated as present
        if(nvIndex.publicArea.attributes.TPMA_NV_PLATFORMCREATE == CLEAR)
        {
-           if(gc.shEnable == FALSE)
+           /*
+            * FWMP is a Chrome OS specific object saved at address 0x100a, it
+            * needs to be available for reading even before TPM2_Startup
+            * command is issued.
+            */
+           UINT32 isFwmpRead = (handle == 0x100100a) &&
+               IsReadOperation(commandCode);
+
+           if((gc.shEnable == FALSE) && !isFwmpRead)
                return TPM_RC_HANDLE;
        }
        // if phEnableNV is CLEAR, a platform created Index should not