From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 66A2D817B2 for ; Tue, 10 Jan 2017 10:16:46 -0800 (PST) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP; 10 Jan 2017 10:16:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,344,1477983600"; d="scan'208";a="51452768" Received: from mdkinney-mobl.amr.corp.intel.com ([10.254.91.144]) by orsmga005.jf.intel.com with ESMTP; 10 Jan 2017 10:16:46 -0800 From: Michael Kinney To: edk2-devel@lists.01.org Date: Tue, 10 Jan 2017 10:16:43 -0800 Message-Id: <1484072204-35608-3-git-send-email-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.6.3.windows.1 In-Reply-To: <1484072204-35608-1-git-send-email-michael.d.kinney@intel.com> References: <1484072204-35608-1-git-send-email-michael.d.kinney@intel.com> Subject: [Patch 2/3] QuarkPlatformPkg/Tpm12DeviceLibAtmelI2c: Fix SubmitCommand() out size X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2017 18:16:46 -0000 https://bugzilla.tianocore.org/show_bug.cgi?id=336 When the Tpm12SubmitCommand() detects a response packet that is the same size as a TPM_RSP_COMMAND_HDR, it returns EFI_SUCCESS without reading any additional response packet information from the TPM. In that case, the return parameter OutputParameterBlockSize is not be updated, so the size of that OutputParameterBlock returned is the value passed in which could be larger than what is actually returned from the TPM. Set the OutputParameterBlockSize to the size of the TPM_RSP_COMMAND_HDR when this specific condition is detected. Cc: Kelly Steele Cc: Lee Leahy Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney --- QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c b/QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c index 08a005f..3aab530 100644 --- a/QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c +++ b/QuarkPlatformPkg/Library/Tpm12DeviceLibAtmelI2c/TisPc.c @@ -355,6 +355,7 @@ Tpm12SubmitCommand ( TpmOutSize = SwapBytes32 (ReadUnaligned32 (&ResponseHeader->paramSize)); if (TpmOutSize == sizeof (TPM_RSP_COMMAND_HDR)) { + *OutputParameterBlockSize = TpmOutSize; Status = EFI_SUCCESS; goto Done; } -- 2.6.3.windows.1