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.

edk2-devel mailing list

Reply via email to