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
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
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
@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
//\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