From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 C3BB421E082BC for ; Wed, 7 Mar 2018 12:44:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AB16B406E946; Wed, 7 Mar 2018 20:50:39 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-123-198.rdu2.redhat.com [10.10.123.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DB451102E2A; Wed, 7 Mar 2018 20:50:36 +0000 (UTC) To: "Zeng, Star" , "marcandre.lureau@redhat.com" Cc: "edk2-devel@lists.01.org" , "Yao, Jiewen" , "Zhang, Chao B" References: <20180306202718.4061-1-marcandre.lureau@redhat.com> <1dbffca1-c83e-0839-45b5-62875b0cfae0@redhat.com> <0C09AFA07DD0434D9E2A0C6AEB0483103BA47A81@shsmsx102.ccr.corp.intel.com> From: Laszlo Ersek Message-ID: Date: Wed, 7 Mar 2018 21:50:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BA47A81@shsmsx102.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 07 Mar 2018 20:50:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 07 Mar 2018 20:50:39 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH 1/1] RFC: SecurityPkg: only clear HashInterface informations 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: Wed, 07 Mar 2018 20:44:25 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 03/07/18 10:42, Zeng, Star wrote: > Hi Laszlo, > > Good analysis. > > Yes, the SupportedHashMask field in HashInterfaceHob will have stale value, but that does not impact the functionality since the code have. > So the patch could fix the problem. > > HashLibBaseCryptoRouterPeiConstructor(): > Status = PcdSet32S (PcdTcg2HashAlgorithmBitmap, 0); > > RegisterHashInterfaceLib(): > HashInterfaceHob->SupportedHashMask = PcdGet32 (PcdTcg2HashAlgorithmBitmap) | HashMask; > > HashStart()/HashUpdate()/HashCompleteAndExtend()/HashAndExtend(): > if (HashInterfaceHob->HashInterfaceCount == 0) { > return EFI_UNSUPPORTED; > } > > RegisterHashInterfaceLib(): > if (HashInterfaceHob->HashInterfaceCount >= HASH_COUNT) { > return EFI_OUT_OF_RESOURCES; > } Ugh, this is a bit too complex for me to digest right now, but I'll trust you if you say the value doesn't matter :) > As I know, Chao has helped push the patch. Yes, that's correct, it's commit 4cc2b63bd829 ("SecurityPkg: only clear HashInterface information", 2018-03-07). > But I am fine with keeping this patch or continue refining the code. :) I would slightly prefer clearing the SupportedHashMask field as well (or adding a comment explaining why it's not necessary), because then the uninitiated reader, like me, wouldn't have to ask themselves why the field isn't being cleared :) But, given your response, I don't feel strongly about it any longer; I'll leave it up to Marc-André. (Also, if we have to choose between extending the ZeroMem() and writing the comment, I think the former is easier :) I could write that too, but I couldn't write the comment.) > Is it working with " ZeroMem (HashInterfaceHob, sizeof (*HashInterfaceHob) - sizeof (EFI_GUID)) " if to refine the code? I'll skip this question based on your later followup. Thanks! Laszlo