SecurityPkg Tcg2: Remove use of module internal API InternalIsZeroBuffer()
authorHao Wu <hao.a.wu@intel.com>
Wed, 17 Aug 2016 13:28:39 +0000 (21:28 +0800)
committerHao Wu <hao.a.wu@intel.com>
Mon, 22 Aug 2016 10:54:32 +0000 (18:54 +0800)
This commit removes the internal implementation of the function
InternalIsZeroBuffer(). Instead, it will use the API IsZeroBuffer() from
BaseMemoryLib in MdePkg.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.c

index 7a97f6bdc7e67735163e996cf7d48eb252cc2219..5f4420ca86296866acb39e6aa3e8e8e88e1a23f0 100644 (file)
@@ -616,33 +616,6 @@ FillBufferWithTCG2EventLogFormat (
   }\r
 }\r
 \r
-/**\r
-  Check if buffer is all zero.\r
-\r
-  @param[in] Buffer      Buffer to be checked.\r
-  @param[in] BufferSize  Size of buffer to be checked.\r
-\r
-  @retval TRUE  Buffer is all zero.\r
-  @retval FALSE Buffer is not all zero.\r
-**/\r
-BOOLEAN\r
-InternalIsZeroBuffer (\r
-  IN VOID  *Buffer,\r
-  IN UINTN BufferSize\r
-  )\r
-{\r
-  UINT8 *BufferData;\r
-  UINTN Index;\r
-\r
-  BufferData = Buffer;\r
-  for (Index = 0; Index < BufferSize; Index++) {\r
-    if (BufferData[Index] != 0) {\r
-      return FALSE;\r
-    }\r
-  }\r
-  return TRUE;\r
-}\r
-\r
 /**\r
   This function publish the TCG2 configuration Form for TPM device.\r
 \r
@@ -735,7 +708,7 @@ InstallTcg2ConfigForm (
   } else {\r
     TempBuffer[0] = 0;\r
     for (Index = 0; Index < Pcrs.count; Index++) {\r
-      if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+      if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
         AppendBufferWithTpmAlgHash (TempBuffer, sizeof(TempBuffer), Pcrs.pcrSelections[Index].hash);\r
       }\r
     }\r
index 5d975561dec7dd2b6e60105bd03a605817e2dc18..319f24544ac36b18faa4e6c452b9a46c68b8d641 100644 (file)
@@ -201,33 +201,6 @@ InternalDumpHex (
   }\r
 }\r
 \r
-/**\r
-  Check if buffer is all zero.\r
-\r
-  @param[in] Buffer      Buffer to be checked.\r
-  @param[in] BufferSize  Size of buffer to be checked.\r
-\r
-  @retval TRUE  Buffer is all zero.\r
-  @retval FALSE Buffer is not all zero.\r
-**/\r
-BOOLEAN\r
-InternalIsZeroBuffer (\r
-  IN VOID  *Buffer,\r
-  IN UINTN BufferSize\r
-  )\r
-{\r
-  UINT8 *BufferData;\r
-  UINTN Index;\r
-\r
-  BufferData = Buffer;\r
-  for (Index = 0; Index < BufferSize; Index++) {\r
-    if (BufferData[Index] != 0) {\r
-      return FALSE;\r
-    }\r
-  }\r
-  return TRUE;\r
-}\r
-\r
 /**\r
   Get All processors EFI_CPU_LOCATION in system. LocationBuf is allocated inside the function\r
   Caller is responsible to free LocationBuf.\r
@@ -2471,31 +2444,31 @@ DriverEntry (
       switch (Pcrs.pcrSelections[Index].hash) {\r
       case TPM_ALG_SHA1:\r
         TpmHashAlgorithmBitmap |= EFI_TCG2_BOOT_HASH_ALG_SHA1;\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePCRBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA1;\r
         }        \r
         break;\r
       case TPM_ALG_SHA256:\r
         TpmHashAlgorithmBitmap |= EFI_TCG2_BOOT_HASH_ALG_SHA256;\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePCRBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA256;\r
         }\r
         break;\r
       case TPM_ALG_SHA384:\r
         TpmHashAlgorithmBitmap |= EFI_TCG2_BOOT_HASH_ALG_SHA384;\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePCRBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA384;\r
         }\r
         break;\r
       case TPM_ALG_SHA512:\r
         TpmHashAlgorithmBitmap |= EFI_TCG2_BOOT_HASH_ALG_SHA512;\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePCRBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA512;\r
         }\r
         break;\r
       case TPM_ALG_SM3_256:\r
         TpmHashAlgorithmBitmap |= EFI_TCG2_BOOT_HASH_ALG_SM3_256;\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePCRBanks |= EFI_TCG2_BOOT_HASH_ALG_SM3_256;\r
         }\r
         break;\r
index 2cffed4464b82500eee8cbb4e71c8347121a7074..0d779f1e3b17a312cd8259de70dff2a7df9f58f5 100644 (file)
@@ -224,33 +224,6 @@ EndofPeiSignalNotifyCallBack (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Check if buffer is all zero.\r
-\r
-  @param[in] Buffer      Buffer to be checked.\r
-  @param[in] BufferSize  Size of buffer to be checked.\r
-\r
-  @retval TRUE  Buffer is all zero.\r
-  @retval FALSE Buffer is not all zero.\r
-**/\r
-BOOLEAN\r
-InternalIsZeroBuffer (\r
-  IN VOID  *Buffer,\r
-  IN UINTN BufferSize\r
-  )\r
-{\r
-  UINT8 *BufferData;\r
-  UINTN Index;\r
-\r
-  BufferData = Buffer;\r
-  for (Index = 0; Index < BufferSize; Index++) {\r
-    if (BufferData[Index] != 0) {\r
-      return FALSE;\r
-    }\r
-  }\r
-  return TRUE;\r
-}\r
-\r
 /**\r
   Get TPML_DIGEST_VALUES data size.\r
 \r
@@ -383,27 +356,27 @@ SetTpm2HashMask (
       DEBUG ((EFI_D_INFO, "hash - %x\n", Pcrs.pcrSelections[Index].hash));\r
       switch (Pcrs.pcrSelections[Index].hash) {\r
       case TPM_ALG_SHA1:\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePcrBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA1;\r
         }        \r
         break;\r
       case TPM_ALG_SHA256:\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePcrBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA256;\r
         }\r
         break;\r
       case TPM_ALG_SHA384:\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePcrBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA384;\r
         }\r
         break;\r
       case TPM_ALG_SHA512:\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePcrBanks |= EFI_TCG2_BOOT_HASH_ALG_SHA512;\r
         }\r
         break;\r
       case TPM_ALG_SM3_256:\r
-        if (!InternalIsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
+        if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {\r
           ActivePcrBanks |= EFI_TCG2_BOOT_HASH_ALG_SM3_256;\r
         }\r
         break;\r