]> 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 32e07000969349f518aed1516f8f63b351d87b1e..ba1abe9e08c473e7042375cdffe213fbfc770bc5 100644 (file)
@@ -9,13 +9,7 @@
   ExecutePendingTpmRequest() will receive untrusted input and do validation.\r
 \r
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -108,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
@@ -163,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
@@ -181,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
@@ -1279,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