Ah, yes. We can call Sha384HashAll(). Thanks for reminder! > -----Original Message----- > From: Yao, Jiewen <jiewen....@intel.com> > Sent: Thursday, January 26, 2023 10:02 AM > To: Xu, Min M <min.m...@intel.com>; devel@edk2.groups.io; > kra...@redhat.com > Cc: Aktas, Erdem <erdemak...@google.com>; James Bottomley > <j...@linux.ibm.com>; Tom Lendacky <thomas.lenda...@amd.com>; > Michael Roth <michael.r...@amd.com> > Subject: RE: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add > SecTdxHelperLib > > Hey > I don't think it is a good idea to define a context size here, because that > will > assume the openssl implementation. Please don't do that. > > Could you please just use Sha384HashAll() API, if you don't like to allocate > memory? > > Thank you > Yao, Jiewen > > > -----Original Message----- > > From: Xu, Min M <min.m...@intel.com> > > Sent: Thursday, January 26, 2023 9:57 AM > > To: devel@edk2.groups.io; kra...@redhat.com > > Cc: Aktas, Erdem <erdemak...@google.com>; James Bottomley > > <j...@linux.ibm.com>; Yao, Jiewen <jiewen....@intel.com>; Tom > Lendacky > > <thomas.lenda...@amd.com>; Michael Roth <michael.r...@amd.com> > > Subject: RE: [edk2-devel] [PATCH V3 3/9] OvmfPkg/IntelTdx: Add > > SecTdxHelperLib > > > > On January 25, 2023 8:16 PM, Gerd Hoffmann wrote: > > > > +// > > > > +// SHA512_CTX is defined in <openssl/sha.h> and its size is 216 bytes. > > > > +// It can be built successfully with GCC5 compiler but failed with > VS2019. > > > > +// The error code showed in VS2019 is that "openssl/sha.h" cannot > > > > +be > > found. > > > > +// To overcome this error SHA512_CTX_SIZE is defined. > > > > +// > > > > +#define SHA512_CTX_SIZ 216 > > > > > > There is Sha384GetContextSize() > > > > > HashAndExtendToRtmr is designed to be run in very early stage and at > > that stage Memory allocation service is not ready. So we have to > > declare an array with size of SHA512_CTX_SIZE(216). > > > > Variable-length automatic arrays are allowed in C99. > > https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html So if ovmf is > > built with GCC, then the code below works: > > UINT8 Sha384Ctx[Sha384GetContextSize ()]; > > > > But unfortunately it is not supported in VS series. (I test it with > > VS2017) Building ... > > > tdvf2\EmbeddedPkg\Library\PrePiMemoryAllocationLib\PrePiMemoryAllocat > i > > on > > Lib.inf [X64] > > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2057: > > expected constant expression > > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2466: > > cannot allocate an array of constant size 0 > > tdvf2\OvmfPkg\IntelTdx\TdxHelperLib\SecTdxHelper.c(839): error C2133: > > 'Sha384Ctx': unknown size > > > > So Sha384GetContextSize() cannot be used here. > > > > Thanks > > Min
-=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#99060): https://edk2.groups.io/g/devel/message/99060 Mute This Topic: https://groups.io/mt/96513452/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-