From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.103.53.11; helo=mail5.wrs.com; envelope-from=bill.paul@windriver.com; receiver=edk2-devel@lists.01.org Received: from mail5.wrs.com (mail5.windriver.com [192.103.53.11]) (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 9096C21E2568D for ; Thu, 25 Jan 2018 11:24:01 -0800 (PST) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id w0PJTTsW011769 (version=TLSv1 cipher=AES128-SHA bits=128 verify=OK); Thu, 25 Jan 2018 11:29:29 -0800 Received: from ala-wpaul-lx1.wrs.com (147.11.157.242) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 25 Jan 2018 11:29:29 -0800 From: Bill Paul Organization: Wind River Systems To: Date: Thu, 25 Jan 2018 11:34:13 -0800 User-Agent: KMail/1.13.5 (Linux/2.6.32-28-generic; KDE/4.4.5; x86_64; ; ) CC: "Zhang, Chao B" , Yao Jiewen , Long Qin References: <20180125045350.22372-1-chao.b.zhang@intel.com> <20180125045350.22372-2-chao.b.zhang@intel.com> In-Reply-To: <20180125045350.22372-2-chao.b.zhang@intel.com> MIME-Version: 1.0 Message-ID: <201801251134.14794.wpaul@windriver.com> Subject: Re: [PATCH] SecurityPkg/DxePhysicalPresenceLib: Reject illegal PCR bank allocation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jan 2018 19:24:02 -0000 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Of all the gin joints in all the towns in all the world, Zhang, Chao B had to walk into mine at 20:53 on Wednesday 24 January 2018 and say: > According to TCG PP1.3 spec, error PCR bank allocation input should be > rejected by Physical Presence. Firmware has to ensure that at least one > PCR banks is active. > > Cc: Long Qin > Cc: Yao Jiewen > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chao Zhang > --- > .../DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLib.c | 12 > ++++++++++++ 1 file changed, 12 insertions(+) > > diff --git > a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLi > b.c > b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLi > b.c index 5bf95a1..830266b 100644 > --- > a/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLi > b.c +++ > b/SecurityPkg/Library/DxeTcg2PhysicalPresenceLib/DxeTcg2PhysicalPresenceLi > b.c @@ -186,6 +186,18 @@ Tcg2ExecutePhysicalPresence ( > case TCG2_PHYSICAL_PRESENCE_SET_PCR_BANKS: > Status = Tpm2GetCapabilitySupportedAndActivePcrs > (&TpmHashAlgorithmBitmap, &ActivePcrBanks); ASSERT_EFI_ERROR (Status); > + > + // > + // PP spec requirements: > + // Firmware should check that all requested (set) hashing > algorithms are supported with respective PCR banks. + // Firmware > has to ensure that at least one PCR banks is active + // If not, an > error is returned and no action is taken > + // > + if (CommandParameter == 0 || (CommandParameter & > (~TpmHashAlgorithmBitmap)) != 0) { + DEBUG((DEBUG_ERROR, "PCR banks > %x to allocate are not supported by TPM. Skip operation\n", > CommandParameter)); + return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE > + } > + DEBUG((DEBUG_ERROR, "zhangchao TpmHashAlgorithmBitmap %x Was it your intention to have the debug error message string identify you by name? :) -Bill > CommandParameter %x\n", TpmHashAlgorithmBitmap, CommandParameter)); Status > = Tpm2PcrAllocateBanks (PlatformAuth, TpmHashAlgorithmBitmap, > CommandParameter); if (EFI_ERROR (Status)) { > return TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE; -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Member of Technical Staff, wpaul@windriver.com | Master of Unix-Fu - Wind River Systems ============================================================================= "I put a dollar in a change machine. Nothing changed." - George Carlin =============================================================================