From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com []) by mx.groups.io with SMTP id smtpd.web09.3729.1578020675360032184 for ; Thu, 02 Jan 2020 19:04:46 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: zhichao.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jan 2020 19:04:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,389,1571727600"; d="scan'208";a="252455166" Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga002.fm.intel.com with ESMTP; 02 Jan 2020 19:04:44 -0800 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jiewen Yao , Jian J Wang , Chao Zhang Subject: [PATCH 10/13] SecurityPkg/Tcg2PhysicalPresenceLib: Extend the submit preOS func Date: Fri, 3 Jan 2020 11:04:24 +0800 Message-Id: <20200103030428.28176-11-zhichao.gao@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200103030428.28176-1-zhichao.gao@intel.com> References: <20200103030428.28176-1-zhichao.gao@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2443 Extend the Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx to handle the FunctionIndex. And modify the all of this function to avoid build error. Cc: Jiewen Yao Cc: Jian J Wang Cc: Chao Zhang Signed-off-by: Zhichao Gao --- SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h | 4 +++- .../DxeTcg2PhysicalPresenceLib.c | 1 + .../SmmTcg2PhysicalPresenceLib.c | 11 ++++++++++- SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c | 10 +++++++--- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h b/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h index 39febcb655..8b71c32d53 100644 --- a/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h +++ b/SecurityPkg/Include/Library/Tcg2PhysicalPresenceLib.h @@ -2,7 +2,7 @@ This library is intended to be used by BDS modules. This library will execute TPM2 request. -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -127,6 +127,7 @@ Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( Caution: This function may receive untrusted input. + @param[in, out] Pointer to FunctionIndex TPM physical presence Function Index. @param[in, out] Pointer to OperationRequest TPM physical presence operation request. @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter. @@ -135,6 +136,7 @@ Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( **/ UINT32 Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( + IN OUT UINT32 *FunctionIndex, IN OUT UINT32 *OperationRequest, IN OUT UINT32 *RequestParameter ); diff --git a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c index 1ae19436c2..090ed2781e 100644 --- a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c +++ b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c @@ -1199,6 +1199,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( if ((PpData.PPRequest != OperationRequest) || (PpData.PPRequestParameter != RequestParameter)) { + PpData.PPFunction = (UINT8)TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2; PpData.PPRequest = (UINT8)OperationRequest; PpData.PPRequestParameter = RequestParameter; DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE); diff --git a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c index 72b51ed5e9..271ee51060 100644 --- a/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c +++ b/SecurityPkg/Library/SmmTcg2PhysicalPresenceLib/SmmTcg2PhysicalPresenceLib.c @@ -89,6 +89,7 @@ Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( Caution: This function may receive untrusted input. + @param[in, out] Pointer to FunctionIndex TPM physical presence Function Index. @param[in, out] Pointer to OperationRequest TPM physical presence operation request. @param[in, out] Pointer to RequestParameter TPM physical presence operation request parameter. @@ -97,6 +98,7 @@ Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction ( **/ UINT32 Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( + IN OUT UINT32 *FunctionIndex, IN OUT UINT32 *OperationRequest, IN OUT UINT32 *RequestParameter ) @@ -135,6 +137,7 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( if ((PpData.PPRequest != *OperationRequest) || (PpData.PPRequestParameter != *RequestParameter)) { + PpData.PPFunction = (UINT8)*FunctionIndex; PpData.PPRequest = (UINT8)*OperationRequest; PpData.PPRequestParameter = *RequestParameter; DataSize = sizeof (EFI_TCG2_PHYSICAL_PRESENCE); @@ -211,13 +214,19 @@ Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction ( IN UINT32 RequestParameter ) { + UINT32 TempFunctionIndex; UINT32 TempOperationRequest; UINT32 TempRequestParameter; + TempFunctionIndex = TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2; TempOperationRequest = OperationRequest; TempRequestParameter = RequestParameter; - return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx(&TempOperationRequest, &TempRequestParameter); + return Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( + &TempFunctionIndex, + &TempOperationRequest, + &TempRequestParameter + ); } /** diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c index 91aebb62b8..d9e8be1403 100644 --- a/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c +++ b/SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c @@ -9,7 +9,7 @@ PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check. -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -80,6 +80,7 @@ PhysicalPresenceCallback ( { UINT32 MostRecentRequest; UINT32 Response; + UINT32 FunctionIndex; UINT32 OperationRequest; UINT32 RequestParameter; @@ -95,12 +96,15 @@ PhysicalPresenceCallback ( } else if ((mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS) || (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_SUBMIT_REQUEST_TO_BIOS_2)) { + FunctionIndex = mTcgNvs->PhysicalPresence.Parameter; OperationRequest = mTcgNvs->PhysicalPresence.Request; RequestParameter = mTcgNvs->PhysicalPresence.RequestParameter; mTcgNvs->PhysicalPresence.ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunctionEx ( - &OperationRequest, - &RequestParameter + &FunctionIndex, ///< Arg2, Function Index (2 or 7) + &OperationRequest, ///< Arg3, Integer1 (Operation value, valid for both Function Index 2 and 7) + &RequestParameter ///< Arg3, Integer2 (Operation Parameter, valid for Function Index 7 only) ); + mTcgNvs->PhysicalPresence.Parameter = FunctionIndex; mTcgNvs->PhysicalPresence.Request = OperationRequest; mTcgNvs->PhysicalPresence.RequestParameter = RequestParameter; } else if (mTcgNvs->PhysicalPresence.Parameter == TCG_ACPI_FUNCTION_GET_USER_CONFIRMATION_STATUS_FOR_REQUEST) { -- 2.21.0.windows.1