]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
SecurityPkg: Fix few typos
[mirror_edk2.git] / SecurityPkg / Library / DxeTcgPhysicalPresenceLib / DxeTcgPhysicalPresenceLib.c
index 174172d5d7a55ea93c5d2e54f59405b823f64507..ba1abe9e08c473e7042375cdffe213fbfc770bc5 100644 (file)
@@ -102,9 +102,13 @@ GetTpmCapability (
                           sizeof (RecvBuffer),\r
                           (UINT8*)&RecvBuffer\r
                           );\r
-  ASSERT_EFI_ERROR (Status);\r
-  ASSERT (TpmRsp->tag == SwapBytes16 (TPM_TAG_RSP_COMMAND));\r
-  ASSERT (TpmRsp->returnCode == 0);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  if ((TpmRsp->tag != SwapBytes16 (TPM_TAG_RSP_COMMAND)) || (TpmRsp->returnCode != 0)) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
 \r
   TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];\r
 \r
@@ -157,8 +161,14 @@ TpmPhysicalPresence (
                           sizeof (TpmRsp),\r
                           (UINT8*)&TpmRsp\r
                           );\r
-  ASSERT_EFI_ERROR (Status);\r
-  ASSERT (TpmRsp.tag == SwapBytes16 (TPM_TAG_RSP_COMMAND));\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  if (TpmRsp.tag != SwapBytes16 (TPM_TAG_RSP_COMMAND)) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
+\r
   if (TpmRsp.returnCode != 0) {\r
     //\r
     // If it fails, some requirements may be needed for this command.\r
@@ -175,7 +185,7 @@ TpmPhysicalPresence (
   @param[in] TcgProtocol              EFI TCG Protocol instance.\r
   @param[in] Ordinal                  TPM command code.\r
   @param[in] AdditionalParameterSize  Additional parameter size.\r
-  @param[in] AdditionalParameters     Pointer to the Additional paramaters.\r
+  @param[in] AdditionalParameters     Pointer to the Additional parameters.\r
 \r
   @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during sending command to TPM or\r
                                                   receiving response from TPM.\r
@@ -1273,7 +1283,10 @@ TcgPhysicalPresenceLibProcessRequest (
   //\r
   // Set operator physical presence flags\r
   //\r
-  TpmPhysicalPresence (TcgProtocol, TPM_PHYSICAL_PRESENCE_PRESENT);\r
+  Status = TpmPhysicalPresence (TcgProtocol, TPM_PHYSICAL_PRESENCE_PRESENT);\r
+  if (EFI_ERROR (Status)) {\r
+    return;\r
+  }\r
 \r
   //\r
   // Execute pending TPM request.\r