From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.1238.1571277005383601126 for ; Wed, 16 Oct 2019 18:50:05 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 18:50:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,305,1566889200"; d="scan'208";a="202244177" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by FMSMGA003.fm.intel.com with ESMTP; 16 Oct 2019 18:50:04 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:50:04 -0700 Received: from fmsmsx605.amr.corp.intel.com (10.18.126.85) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 16 Oct 2019 18:50:03 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 16 Oct 2019 18:50:03 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Thu, 17 Oct 2019 09:49:57 +0800 From: "Wu, Hao A" To: "Kubacki, Michael A" , "devel@edk2.groups.io" CC: "Bi, Dandan" , Ard Biesheuvel , "Dong, Eric" , Laszlo Ersek , "Gao, Liming" , "Kinney, Michael D" , "Ni, Ray" , "Wang, Jian J" , "Yao, Jiewen" Subject: Re: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize auth status in VariableParsing Thread-Topic: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize auth status in VariableParsing Thread-Index: AQHVgudjinXHSYl3Y0GQUCcC/PSZKadeBe1AgAAL0ZCAAAFZMA== Date: Thu, 17 Oct 2019 01:49:56 +0000 Message-ID: References: <20191014233001.33024-1-michael.a.kubacki@intel.com> <20191014233001.33024-5-michael.a.kubacki@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Just expecting consistency for the rule, I found that for function VariableServiceGetNextVariableName(), there are 4 occurrences and the local variable is introduced. But for VariableExLibFindNextVariable(), there are 5 occurrences but no loc= al variable is introduced. Best Regards, Hao Wu > -----Original Message----- > From: Kubacki, Michael A > Sent: Thursday, October 17, 2019 9:42 AM > To: Wu, Hao A; devel@edk2.groups.io > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Liming; Ki= nney, > Michael D; Ni, Ray; Wang, Jian J; Yao, Jiewen > Subject: RE: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize auth > status in VariableParsing >=20 > Your threshold is slightly lower than mine for adding the local variable.= My > test plan is already > done on this patch series. Do you consider this mandatory? >=20 > Thanks, > Michael >=20 > > -----Original Message----- > > From: Wu, Hao A > > Sent: Wednesday, October 16, 2019 6:01 PM > > To: Kubacki, Michael A ; > > devel@edk2.groups.io > > Cc: Bi, Dandan ; Ard Biesheuvel > > ; Dong, Eric ; Laszlo > Ersek > > ; Gao, Liming ; Kinney, > Michael > > D ; Ni, Ray ; Wang, Jian = J > > ; Yao, Jiewen > > Subject: RE: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize > auth > > status in VariableParsing > > > > > -----Original Message----- > > > From: Kubacki, Michael A > > > Sent: Tuesday, October 15, 2019 7:30 AM > > > To: devel@edk2.groups.io > > > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Liming= ; > > Kinney, > > > Michael D; Ni, Ray; Wang, Jian J; Wu, Hao A; Yao, Jiewen > > > Subject: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize auth > > > status in VariableParsing > > > > > > The file VariableParsing.c provides generic functionality related > > > to parsing variable related structures and information. In order to > > > calculate offsets for certain operations, the functions must know if > > > authenticated variables are enabled as this increases the size of > > > variable headers. > > > > > > This change removes linking against a global variable in an external = file > > > in favor of passing the authenticated variable status as a parameter = to > > > the variable parsing functions. > > > > > > One general level comment: > > In this patch some of the functions have introduced a local variable > > 'AuthFormat' > > to reduce the repetitive occurrence of: > > > > mVariableModuleGlobal->VariableGlobal.AuthFormat > > > > I would suggest to adopt this approach for all the functions that have = 3 or > > more > > of such repetitive occurrences. > > > > Other than this, the patch looks good to me, > > Reviewed-by: Hao A Wu > > > > Best Regards, > > Hao Wu > > > > > > > > > > Cc: Dandan Bi > > > Cc: Ard Biesheuvel > > > Cc: Eric Dong > > > Cc: Laszlo Ersek > > > Cc: Liming Gao > > > Cc: Michael D Kinney > > > Cc: Ray Ni > > > Cc: Jian J Wang > > > Cc: Hao A Wu > > > Cc: Jiewen Yao > > > Signed-off-by: Michael Kubacki > > > --- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h | 82 > > > +++++-- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 258 > > > ++++++++++++++------ > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c | 15 > +- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c | 146 > > > +++++++---- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c | 5 > +- > > > 5 files changed, 339 insertions(+), 167 deletions(-) > > > > > > diff --git > > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > index 1777ce0e69..92a729d140 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > @@ -49,53 +49,65 @@ GetVariableStoreStatus ( > > > /** > > > This code gets the size of variable header. > > > > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > + > > > @return Size of variable header in bytes in type UINTN. > > > > > > **/ > > > UINTN > > > GetVariableHeaderSize ( > > > - VOID > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > > > > This code gets the size of name of variable. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the variable header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > @return UINTN Size of variable in bytes. > > > > > > **/ > > > UINTN > > > NameSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > This code sets the size of name of variable. > > > > > > - @param[in] Variable Pointer to the Variable Header. > > > - @param[in] NameSize Name size to set. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] NameSize Name size to set. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > **/ > > > VOID > > > SetNameSizeOfVariable ( > > > IN VARIABLE_HEADER *Variable, > > > - IN UINTN NameSize > > > + IN UINTN NameSize, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > > > > This code gets the size of variable data. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > @return Size of variable in bytes. > > > > > > **/ > > > UINTN > > > DataSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > @@ -103,80 +115,98 @@ DataSizeOfVariable ( > > > > > > @param[in] Variable Pointer to the Variable Header. > > > @param[in] DataSize Data size to set. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables are = not used. > > > > > > **/ > > > VOID > > > SetDataSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable, > > > - IN UINTN DataSize > > > + IN VARIABLE_HEADER *Variable, > > > + IN UINTN DataSize, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > > > > This code gets the pointer to the variable name. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to Variable Name which is Unicode encoding. > > > > > > **/ > > > CHAR16 * > > > GetVariableNamePtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > This code gets the pointer to the variable guid. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return A EFI_GUID* pointer to Vendor Guid. > > > > > > **/ > > > EFI_GUID * > > > GetVendorGuidPtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > > > > This code gets the pointer to the variable data. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to Variable Data. > > > > > > **/ > > > UINT8 * > > > GetVariableDataPtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > This code gets the variable data offset related to variable header= . > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Variable Data offset. > > > > > > **/ > > > UINTN > > > GetVariableDataOffset ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > > > > This code gets the pointer to the next variable header. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to next variable header. > > > > > > **/ > > > VARIABLE_HEADER * > > > GetNextVariablePtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > @@ -235,6 +265,8 @@ VariableCompareTimeStampInternal ( > > > @param[in] IgnoreRtCheck Ignore > > EFI_VARIABLE_RUNTIME_ACCESS > > > attribute > > > check at runtime when searchi= ng variable. > > > @param[in, out] PtrTrack Variable Track Pointer struct= ure that > > > contains Variable Information. > > > + @param[in] AuthFormat TRUE indicates authenticated = variables > > are > > > used. > > > + FALSE indicates authenticated= variables are not used. > > > > > > @retval EFI_SUCCESS Variable found successfully > > > @retval EFI_NOT_FOUND Variable not found > > > @@ -244,7 +276,8 @@ FindVariableEx ( > > > IN CHAR16 *VariableName, > > > IN EFI_GUID *VendorGuid, > > > IN BOOLEAN IgnoreRtCheck, > > > - IN OUT VARIABLE_POINTER_TRACK *PtrTrack > > > + IN OUT VARIABLE_POINTER_TRACK *PtrTrack, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > @@ -258,10 +291,12 @@ FindVariableEx ( > > > @param[in] VariableStoreList A list of variable stores that shoul= d be > used > > > to get the next variable. > > > The maximum number of entries is the= max value of > > > VARIABLE_STORE_TYPE. > > > @param[out] VariablePtr Pointer to variable header address. > > > + @param[in] AuthFormat TRUE indicates authenticated variabl= es > are > > > used. > > > + FALSE indicates authenticated variab= les are not used. > > > > > > @retval EFI_SUCCESS The function completed successfully. > > > @retval EFI_NOT_FOUND The next variable was not found. > > > - @retval EFI_INVALID_PARAMETER If VariableName is nt an empty > string, > > > while VendorGuid is NULL. > > > + @retval EFI_INVALID_PARAMETER If VariableName is not an empty > > string, > > > while VendorGuid is NULL. > > > @retval EFI_INVALID_PARAMETER The input values of VariableName > and > > > VendorGuid are not a name and > > > GUID of an existing variable. > > > > > > @@ -272,7 +307,8 @@ VariableServiceGetNextVariableInternal ( > > > IN CHAR16 *VariableName, > > > IN EFI_GUID *VendorGuid, > > > IN VARIABLE_STORE_HEADER **VariableStoreList, > > > - OUT VARIABLE_HEADER **VariablePtr > > > + OUT VARIABLE_HEADER **VariablePtr, > > > + IN BOOLEAN AuthFormat > > > ); > > > > > > /** > > > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > index 5cc12c2ae0..2e32905dfe 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > @@ -311,7 +311,7 @@ RecordVarErrorFlag ( > > > FALSE > > > ); > > > if (!EFI_ERROR (Status)) { > > > - VarErrFlag =3D (VAR_ERROR_FLAG *) GetVariableDataPtr > > (Variable.CurrPtr); > > > + VarErrFlag =3D (VAR_ERROR_FLAG *) GetVariableDataPtr > > (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > TempFlag =3D *VarErrFlag; > > > TempFlag &=3D Flag; > > > if (TempFlag =3D=3D *VarErrFlag) { > > > @@ -369,7 +369,7 @@ InitializeVarErrorFlag ( > > > FALSE > > > ); > > > if (!EFI_ERROR (Status)) { > > > - VarErrFlag =3D *((VAR_ERROR_FLAG *) GetVariableDataPtr > > > (Variable.CurrPtr)); > > > + VarErrFlag =3D *((VAR_ERROR_FLAG *) GetVariableDataPtr > > > (Variable.CurrPtr, mVariableModuleGlobal- > >VariableGlobal.AuthFormat)); > > > if (VarErrFlag =3D=3D Flag) { > > > return; > > > } > > > @@ -410,7 +410,11 @@ IsUserVariable ( > > > // then no need to check if the variable is user variable or not s= pecially. > > > // > > > if (mEndOfDxe && (mVariableModuleGlobal- > > > >CommonMaxUserVariableSpace !=3D mVariableModuleGlobal- > > > >CommonVariableSpace)) { > > > - if (VarCheckLibVariablePropertyGet (GetVariableNamePtr (Variable= ), > > > GetVendorGuidPtr (Variable), &Property) =3D=3D EFI_NOT_FOUND) { > > > + if (VarCheckLibVariablePropertyGet ( > > > + GetVariableNamePtr (Variable, mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat), > > > + GetVendorGuidPtr (Variable, mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat), > > > + &Property > > > + ) =3D=3D EFI_NOT_FOUND) { > > > return TRUE; > > > } > > > } > > > @@ -439,10 +443,14 @@ CalculateCommonUserVariableTotalSize ( > > > if (mEndOfDxe && (mVariableModuleGlobal- > > > >CommonMaxUserVariableSpace !=3D mVariableModuleGlobal- > > > >CommonVariableSpace)) { > > > Variable =3D GetStartPointer (mNvVariableCache); > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (mNvVariableCache))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, > > mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat); > > > VariableSize =3D (UINTN) NextVariable - (UINTN) Variable; > > > if ((Variable->Attributes & > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD) !=3D > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD) { > > > - if (VarCheckLibVariablePropertyGet (GetVariableNamePtr (Vari= able), > > > GetVendorGuidPtr (Variable), &Property) =3D=3D EFI_NOT_FOUND) { > > > + if (VarCheckLibVariablePropertyGet ( > > > + GetVariableNamePtr (Variable, mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat), > > > + GetVendorGuidPtr (Variable, mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat), > > > + &Property > > > + ) =3D=3D EFI_NOT_FOUND) { > > > // > > > // No property, it is user variable. > > > // > > > @@ -518,7 +526,9 @@ Reclaim ( > > > UINTN HwErrVariableTotalSize; > > > VARIABLE_HEADER *UpdatingVariable; > > > VARIABLE_HEADER *UpdatingInDeletedTransition; > > > + BOOLEAN AuthFormat; > > > > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > > UpdatingVariable =3D NULL; > > > UpdatingInDeletedTransition =3D NULL; > > > if (UpdatingPtrTrack !=3D NULL) { > > > @@ -540,7 +550,7 @@ Reclaim ( > > > MaximumBufferSize =3D sizeof (VARIABLE_STORE_HEADER); > > > > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (VariableStoreHeader))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, AuthFormat); > > > if ((Variable->State =3D=3D VAR_ADDED || Variable->State =3D= =3D > > > (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) && > > > Variable !=3D UpdatingVariable && > > > Variable !=3D UpdatingInDeletedTransition > > > @@ -590,7 +600,7 @@ Reclaim ( > > > // > > > Variable =3D GetStartPointer (VariableStoreHeader); > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (VariableStoreHeader))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, AuthFormat); > > > if (Variable !=3D UpdatingVariable && Variable->State =3D=3D VAR= _ADDED) { > > > VariableSize =3D (UINTN) NextVariable - (UINTN) Variable; > > > CopyMem (CurrPtr, (UINT8 *) Variable, VariableSize); > > > @@ -612,7 +622,7 @@ Reclaim ( > > > // > > > Variable =3D GetStartPointer (VariableStoreHeader); > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (VariableStoreHeader))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, AuthFormat); > > > if (Variable !=3D UpdatingVariable && Variable !=3D > > > UpdatingInDeletedTransition && Variable->State =3D=3D > > > (VAR_IN_DELETED_TRANSITION & VAR_ADDED)) { > > > > > > // > > > @@ -624,13 +634,14 @@ Reclaim ( > > > FoundAdded =3D FALSE; > > > AddedVariable =3D GetStartPointer ((VARIABLE_STORE_HEADER *) > > > ValidBuffer); > > > while (IsValidVariableHeader (AddedVariable, GetEndPointer > > > ((VARIABLE_STORE_HEADER *) ValidBuffer))) { > > > - NextAddedVariable =3D GetNextVariablePtr (AddedVariable); > > > - NameSize =3D NameSizeOfVariable (AddedVariable); > > > - if (CompareGuid (GetVendorGuidPtr (AddedVariable), > > > GetVendorGuidPtr (Variable)) && > > > - NameSize =3D=3D NameSizeOfVariable (Variable) > > > - ) { > > > - Point0 =3D (VOID *) GetVariableNamePtr (AddedVariable); > > > - Point1 =3D (VOID *) GetVariableNamePtr (Variable); > > > + NextAddedVariable =3D GetNextVariablePtr (AddedVariable, > > > AuthFormat); > > > + NameSize =3D NameSizeOfVariable (AddedVariable, AuthFormat); > > > + if (CompareGuid ( > > > + GetVendorGuidPtr (AddedVariable, AuthFormat), > > > + GetVendorGuidPtr (Variable, AuthFormat) > > > + ) && NameSize =3D=3D NameSizeOfVariable (Variable, AuthF= ormat)) { > > > + Point0 =3D (VOID *) GetVariableNamePtr (AddedVariable, > > AuthFormat); > > > + Point1 =3D (VOID *) GetVariableNamePtr (Variable, AuthForm= at); > > > if (CompareMem (Point0, Point1, NameSize) =3D=3D 0) { > > > FoundAdded =3D TRUE; > > > break; > > > @@ -735,7 +746,7 @@ Reclaim ( > > > mVariableModuleGlobal->CommonUserVariableTotalSize =3D 0; > > > Variable =3D GetStartPointer ((VARIABLE_STORE_HEADER > > > *)(UINTN)VariableBase); > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > ((VARIABLE_STORE_HEADER *)(UINTN)VariableBase))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, AuthFormat); > > > VariableSize =3D (UINTN) NextVariable - (UINTN) Variable; > > > if ((Variable->Attributes & > > EFI_VARIABLE_HARDWARE_ERROR_RECORD) > > > =3D=3D EFI_VARIABLE_HARDWARE_ERROR_RECORD) { > > > mVariableModuleGlobal->HwErrVariableTotalSize +=3D Variabl= eSize; > > > @@ -829,7 +840,13 @@ FindVariable ( > > > PtrTrack->EndPtr =3D GetEndPointer (VariableStoreHeader[Type= ]); > > > PtrTrack->Volatile =3D (BOOLEAN) (Type =3D=3D VariableStoreTypeV= olatile); > > > > > > - Status =3D FindVariableEx (VariableName, VendorGuid, IgnoreRtChe= ck, > > > PtrTrack); > > > + Status =3D FindVariableEx ( > > > + VariableName, > > > + VendorGuid, > > > + IgnoreRtCheck, > > > + PtrTrack, > > > + mVariableModuleGlobal->VariableGlobal.AuthFormat > > > + ); > > > if (!EFI_ERROR (Status)) { > > > return Status; > > > } > > > @@ -1199,7 +1216,11 @@ CheckRemainingSpaceForConsistencyInternal ( > > > VarNameSize +=3D GET_PAD_SIZE (VarNameSize); > > > VarDataSize =3D VariableEntry->VariableSize; > > > VarDataSize +=3D GET_PAD_SIZE (VarDataSize); > > > - VariableEntry->VariableSize =3D HEADER_ALIGN (GetVariableHeaderS= ize > () > > + > > > VarNameSize + VarDataSize); > > > + VariableEntry->VariableSize =3D HEADER_ALIGN ( > > > + GetVariableHeaderSize ( > > > + mVariableModuleGlobal- > >VariableGlobal.AuthFormat > > > + ) + VarNameSize + VarDataSize > > > + ); > > > > > > TotalNeededSize +=3D VariableEntry->VariableSize; > > > VariableEntry =3D VA_ARG (Args, VARIABLE_ENTRY_CONSISTENCY *); > > > @@ -1232,13 +1253,14 @@ CheckRemainingSpaceForConsistencyInternal > ( > > > VariableEntry->Name, > > > VariableEntry->Guid, > > > FALSE, > > > - &VariablePtrTrack > > > + &VariablePtrTrack, > > > + mVariableModuleGlobal->VariableGlobal.AuthFormat > > > ); > > > if (!EFI_ERROR (Status)) { > > > // > > > // Get size of Variable[Index]. > > > // > > > - NextVariable =3D GetNextVariablePtr (VariablePtrTrack.CurrPtr)= ; > > > + NextVariable =3D GetNextVariablePtr (VariablePtrTrack.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > OriginalVarSize =3D (UINTN) NextVariable - (UINTN) > > > VariablePtrTrack.CurrPtr; > > > // > > > // Add the original size of Variable[Index] to remaining varia= ble > storage > > > size. > > > @@ -1410,8 +1432,8 @@ AutoUpdateLangVariable ( > > > // Update Lang > > > // > > > VariableName =3D EFI_PLATFORM_LANG_VARIABLE_NAME; > > > - Data =3D GetVariableDataPtr (Variable.CurrPtr); > > > - DataSize =3D DataSizeOfVariable (Variable.CurrPtr); > > > + Data =3D GetVariableDataPtr (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + DataSize =3D DataSizeOfVariable (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > } else { > > > Status =3D FindVariable (EFI_LANG_VARIABLE_NAME, > > > &gEfiGlobalVariableGuid, &Variable, &mVariableModuleGlobal- > > > >VariableGlobal, FALSE); > > > if (!EFI_ERROR (Status)) { > > > @@ -1419,8 +1441,8 @@ AutoUpdateLangVariable ( > > > // Update PlatformLang > > > // > > > VariableName =3D EFI_LANG_VARIABLE_NAME; > > > - Data =3D GetVariableDataPtr (Variable.CurrPtr); > > > - DataSize =3D DataSizeOfVariable (Variable.CurrPtr); > > > + Data =3D GetVariableDataPtr (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + DataSize =3D DataSizeOfVariable (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > } else { > > > // > > > // Neither PlatformLang nor Lang is set, directly return > > > @@ -1598,6 +1620,7 @@ UpdateVariable ( > > > BOOLEAN IsCommonVariable; > > > BOOLEAN IsCommonUserVariable; > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > + BOOLEAN AuthFormat; > > > > > > if (mVariableModuleGlobal->FvbInstance =3D=3D NULL > > > && !mVariableModuleGlobal->VariableGlobal.EmuNvMode) { > > > // > > > @@ -1619,6 +1642,8 @@ UpdateVariable ( > > > } > > > } > > > > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > > + > > > // > > > // Check if CacheVariable points to the variable in variable HOB. > > > // If yes, let CacheVariable points to the variable in NV variable= cache. > > > @@ -1630,7 +1655,7 @@ UpdateVariable ( > > > CacheVariable->StartPtr =3D GetStartPointer (mNvVariableCache); > > > CacheVariable->EndPtr =3D GetEndPointer (mNvVariableCache); > > > CacheVariable->Volatile =3D FALSE; > > > - Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, > > > CacheVariable); > > > + Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, > > > CacheVariable, AuthFormat); > > > if (CacheVariable->CurrPtr =3D=3D NULL || EFI_ERROR (Status)) { > > > // > > > // There is no matched variable in NV variable cache. > > > @@ -1770,8 +1795,8 @@ UpdateVariable ( > > > // If the variable is marked valid, and the same data has been p= assed in, > > > // then return to the caller immediately. > > > // > > > - if (DataSizeOfVariable (CacheVariable->CurrPtr) =3D=3D DataSize = && > > > - (CompareMem (Data, GetVariableDataPtr (CacheVariable->CurrPt= r), > > > DataSize) =3D=3D 0) && > > > + if (DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) =3D= =3D > > DataSize > > > && > > > + (CompareMem (Data, GetVariableDataPtr (CacheVariable->CurrPt= r, > > > AuthFormat), DataSize) =3D=3D 0) && > > > ((Attributes & EFI_VARIABLE_APPEND_WRITE) =3D=3D 0) && > > > (TimeStamp =3D=3D NULL)) { > > > // > > > @@ -1791,9 +1816,13 @@ UpdateVariable ( > > > // NOTE: From 0 to DataOffset of NextVariable is reserved fo= r > Variable > > > Header and Name. > > > // From DataOffset of NextVariable is to save the existing v= ariable > > data. > > > // > > > - DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr= ); > > > + DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr= , > > > AuthFormat); > > > BufferForMerge =3D (UINT8 *) ((UINTN) NextVariable + DataOff= set); > > > - CopyMem (BufferForMerge, (UINT8 *) ((UINTN) CacheVariable- > > > >CurrPtr + DataOffset), DataSizeOfVariable (CacheVariable->CurrPtr)); > > > + CopyMem ( > > > + BufferForMerge, > > > + (UINT8 *) ((UINTN) CacheVariable->CurrPtr + DataOffset), > > > + DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) > > > + ); > > > > > > // > > > // Set Max Auth/Non-Volatile/Volatile Variable Data Size as = default > > > MaxDataSize. > > > @@ -1814,15 +1843,22 @@ UpdateVariable ( > > > MaxDataSize =3D PcdGet32 (PcdMaxHardwareErrorVariableSize)= - > > > DataOffset; > > > } > > > > > > - if (DataSizeOfVariable (CacheVariable->CurrPtr) + DataSize > > > > MaxDataSize) { > > > + if (DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) = + > > > DataSize > MaxDataSize) { > > > // > > > // Existing data size + new data size exceed maximum varia= ble size > > > limitation. > > > // > > > Status =3D EFI_INVALID_PARAMETER; > > > goto Done; > > > } > > > - CopyMem ((UINT8*) ((UINTN) BufferForMerge + > DataSizeOfVariable > > > (CacheVariable->CurrPtr)), Data, DataSize); > > > - MergedBufSize =3D DataSizeOfVariable (CacheVariable->CurrPtr= ) + > > > DataSize; > > > + CopyMem ( > > > + (UINT8*) ( > > > + (UINTN) BufferForMerge + DataSizeOfVariable (CacheVariab= le- > > > >CurrPtr, AuthFormat) > > > + ), > > > + Data, > > > + DataSize > > > + ); > > > + MergedBufSize =3D DataSizeOfVariable (CacheVariable->CurrPtr= , > > > AuthFormat) + > > > + DataSize; > > > > > > // > > > // BufferForMerge(from DataOffset of NextVariable) has inclu= ded > the > > > merged existing and new data. > > > @@ -1925,7 +1961,7 @@ UpdateVariable ( > > > // > > > NextVariable->Attributes =3D Attributes & > > (~EFI_VARIABLE_APPEND_WRITE); > > > > > > - VarNameOffset =3D GetVariableHeaderSize (); > > > + VarNameOffset =3D GetVariableHeaderSize (AuthForma= t); > > > VarNameSize =3D StrSize (VariableName); > > > CopyMem ( > > > (UINT8 *) ((UINTN) NextVariable + VarNameOffset), > > > @@ -1946,14 +1982,18 @@ UpdateVariable ( > > > ); > > > } > > > > > > - CopyMem (GetVendorGuidPtr (NextVariable), VendorGuid, sizeof > > > (EFI_GUID)); > > > + CopyMem ( > > > + GetVendorGuidPtr (NextVariable, AuthFormat), > > > + VendorGuid, > > > + sizeof (EFI_GUID) > > > + ); > > > // > > > // There will be pad bytes after Data, the NextVariable->NameSize = and > > > // NextVariable->DataSize should not include pad size so that vari= able > > > // service can get actual size in GetVariable. > > > // > > > - SetNameSizeOfVariable (NextVariable, VarNameSize); > > > - SetDataSizeOfVariable (NextVariable, DataSize); > > > + SetNameSizeOfVariable (NextVariable, VarNameSize, AuthFormat); > > > + SetDataSizeOfVariable (NextVariable, DataSize, AuthFormat); > > > > > > // > > > // The actual size of the variable that stores in storage should > > > @@ -2036,7 +2076,7 @@ UpdateVariable ( > > > TRUE, > > > Fvb, > > > mVariableModuleGlobal->NonVolatileLastVariableOffse= t, > > > - (UINT32) GetVariableHeaderSize (), > > > + (UINT32) GetVariableHeaderSize (AuthFormat), > > > (UINT8 *) NextVariable > > > ); > > > > > > @@ -2069,9 +2109,9 @@ UpdateVariable ( > > > FALSE, > > > TRUE, > > > Fvb, > > > - mVariableModuleGlobal->NonVolatileLastVariableOffse= t + > > > GetVariableHeaderSize (), > > > - (UINT32) (VarSize - GetVariableHeaderSize ()), > > > - (UINT8 *) NextVariable + GetVariableHeaderSize () > > > + mVariableModuleGlobal->NonVolatileLastVariableOffse= t + > > > GetVariableHeaderSize (AuthFormat), > > > + (UINT32) (VarSize - GetVariableHeaderSize (AuthForm= at)), > > > + (UINT8 *) NextVariable + GetVariableHeaderSize (Aut= hFormat) > > > ); > > > > > > if (EFI_ERROR (Status)) { > > > @@ -2291,7 +2331,7 @@ VariableServiceGetVariable ( > > > // > > > // Get data size > > > // > > > - VarDataSize =3D DataSizeOfVariable (Variable.CurrPtr); > > > + VarDataSize =3D DataSizeOfVariable (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > ASSERT (VarDataSize !=3D 0); > > > > > > if (*DataSize >=3D VarDataSize) { > > > @@ -2300,7 +2340,7 @@ VariableServiceGetVariable ( > > > goto Done; > > > } > > > > > > - CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSiz= e); > > > + CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); > > > if (Attributes !=3D NULL) { > > > *Attributes =3D Variable.CurrPtr->Attributes; > > > } > > > @@ -2357,6 +2397,7 @@ VariableServiceGetNextVariableName ( > > > EFI_STATUS Status; > > > UINTN MaxLen; > > > UINTN VarNameSize; > > > + BOOLEAN AuthFormat; > > > VARIABLE_HEADER *VariablePtr; > > > VARIABLE_STORE_HEADER > > *VariableStoreHeader[VariableStoreTypeMax]; > > > > > > @@ -2364,6 +2405,8 @@ VariableServiceGetNextVariableName ( > > > return EFI_INVALID_PARAMETER; > > > } > > > > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > > + > > > // > > > // Calculate the possible maximum length of name string, including= the > > Null > > > terminator. > > > // > > > @@ -2387,13 +2430,27 @@ VariableServiceGetNextVariableName ( > > > VariableStoreHeader[VariableStoreTypeHob] =3D > > > (VARIABLE_STORE_HEADER *) (UINTN) mVariableModuleGlobal- > > > >VariableGlobal.HobVariableBase; > > > VariableStoreHeader[VariableStoreTypeNv] =3D mNvVariableCach= e; > > > > > > - Status =3D VariableServiceGetNextVariableInternal (VariableName, > > > VendorGuid, VariableStoreHeader, &VariablePtr); > > > + Status =3D VariableServiceGetNextVariableInternal ( > > > + VariableName, > > > + VendorGuid, > > > + VariableStoreHeader, > > > + &VariablePtr, > > > + AuthFormat > > > + ); > > > if (!EFI_ERROR (Status)) { > > > - VarNameSize =3D NameSizeOfVariable (VariablePtr); > > > + VarNameSize =3D NameSizeOfVariable (VariablePtr, AuthFormat); > > > ASSERT (VarNameSize !=3D 0); > > > if (VarNameSize <=3D *VariableNameSize) { > > > - CopyMem (VariableName, GetVariableNamePtr (VariablePtr), > > > VarNameSize); > > > - CopyMem (VendorGuid, GetVendorGuidPtr (VariablePtr), sizeof > > > (EFI_GUID)); > > > + CopyMem ( > > > + VariableName, > > > + GetVariableNamePtr (VariablePtr, AuthFormat), > > > + VarNameSize > > > + ); > > > + CopyMem ( > > > + VendorGuid, > > > + GetVendorGuidPtr (VariablePtr, AuthFormat), > > > + sizeof (EFI_GUID) > > > + ); > > > Status =3D EFI_SUCCESS; > > > } else { > > > Status =3D EFI_BUFFER_TOO_SMALL; > > > @@ -2446,6 +2503,9 @@ VariableServiceSetVariable ( > > > VARIABLE_HEADER *NextVariable; > > > EFI_PHYSICAL_ADDRESS Point; > > > UINTN PayloadSize; > > > + BOOLEAN AuthFormat; > > > + > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > > > > > // > > > // Check input parameters. > > > @@ -2544,7 +2604,8 @@ VariableServiceSetVariable ( > > > // bytes for HwErrRec#### variable. > > > // > > > if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) =3D=3D > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD) { > > > - if (StrSize (VariableName) + PayloadSize > PcdGet32 > > > (PcdMaxHardwareErrorVariableSize) - GetVariableHeaderSize ()) { > > > + if (StrSize (VariableName) + PayloadSize > > > > + PcdGet32 (PcdMaxHardwareErrorVariableSize) - > > GetVariableHeaderSize > > > (AuthFormat)) { > > > return EFI_INVALID_PARAMETER; > > > } > > > } else { > > > @@ -2553,7 +2614,9 @@ VariableServiceSetVariable ( > > > // the DataSize is limited to maximum size of > > > Max(Auth|Volatile)VariableSize bytes. > > > // > > > if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) !=3D 0) { > > > - if (StrSize (VariableName) + PayloadSize > mVariableModuleGlob= al- > > > >MaxAuthVariableSize - GetVariableHeaderSize ()) { > > > + if (StrSize (VariableName) + PayloadSize > > > > + mVariableModuleGlobal->MaxAuthVariableSize - > > > + GetVariableHeaderSize (AuthFormat)) { > > > DEBUG ((DEBUG_ERROR, > > > "%a: Failed to set variable '%s' with Guid %g\n", > > > __FUNCTION__, VariableName, VendorGuid)); > > > @@ -2562,12 +2625,13 @@ VariableServiceSetVariable ( > > > "MaxAuthVariableSize(0x%x) - HeaderSize(0x%x)\n", > > > StrSize (VariableName), PayloadSize, > > > mVariableModuleGlobal->MaxAuthVariableSize, > > > - GetVariableHeaderSize () > > > + GetVariableHeaderSize (AuthFormat) > > > )); > > > return EFI_INVALID_PARAMETER; > > > } > > > } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > > > - if (StrSize (VariableName) + PayloadSize > mVariableModuleGlob= al- > > > >MaxVariableSize - GetVariableHeaderSize ()) { > > > + if (StrSize (VariableName) + PayloadSize > > > > + mVariableModuleGlobal->MaxVariableSize - > GetVariableHeaderSize > > > (AuthFormat)) { > > > DEBUG ((DEBUG_ERROR, > > > "%a: Failed to set variable '%s' with Guid %g\n", > > > __FUNCTION__, VariableName, VendorGuid)); > > > @@ -2576,12 +2640,13 @@ VariableServiceSetVariable ( > > > "MaxVariableSize(0x%x) - HeaderSize(0x%x)\n", > > > StrSize (VariableName), PayloadSize, > > > mVariableModuleGlobal->MaxVariableSize, > > > - GetVariableHeaderSize () > > > + GetVariableHeaderSize (AuthFormat) > > > )); > > > return EFI_INVALID_PARAMETER; > > > } > > > } else { > > > - if (StrSize (VariableName) + PayloadSize > mVariableModuleGlob= al- > > > >MaxVolatileVariableSize - GetVariableHeaderSize ()) { > > > + if (StrSize (VariableName) + PayloadSize > > > > + mVariableModuleGlobal->MaxVolatileVariableSize - > > > GetVariableHeaderSize (AuthFormat)) { > > > DEBUG ((DEBUG_ERROR, > > > "%a: Failed to set variable '%s' with Guid %g\n", > > > __FUNCTION__, VariableName, VendorGuid)); > > > @@ -2590,7 +2655,7 @@ VariableServiceSetVariable ( > > > "MaxVolatileVariableSize(0x%x) - HeaderSize(0x%x)\n", > > > StrSize (VariableName), PayloadSize, > > > mVariableModuleGlobal->MaxVolatileVariableSize, > > > - GetVariableHeaderSize () > > > + GetVariableHeaderSize (AuthFormat) > > > )); > > > return EFI_INVALID_PARAMETER; > > > } > > > @@ -2629,7 +2694,7 @@ VariableServiceSetVariable ( > > > // > > > NextVariable =3D GetStartPointer ((VARIABLE_STORE_HEADER *) > (UINTN) > > > Point); > > > while (IsValidVariableHeader (NextVariable, GetEndPointer > > > ((VARIABLE_STORE_HEADER *) (UINTN) Point))) { > > > - NextVariable =3D GetNextVariablePtr (NextVariable); > > > + NextVariable =3D GetNextVariablePtr (NextVariable, AuthFormat)= ; > > > } > > > mVariableModuleGlobal->NonVolatileLastVariableOffset =3D (UINTN) > > > NextVariable - (UINTN) Point; > > > } > > > @@ -2754,7 +2819,8 @@ VariableServiceQueryVariableInfoInternal ( > > > // > > > if ((Attributes & (EFI_VARIABLE_NON_VOLATILE | > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD)) =3D=3D > > > (EFI_VARIABLE_NON_VOLATILE | > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD)) { > > > *MaximumVariableStorageSize =3D PcdGet32 (PcdHwErrStorageSize); > > > - *MaximumVariableSize =3D PcdGet32 > > (PcdMaxHardwareErrorVariableSize) - > > > GetVariableHeaderSize (); > > > + *MaximumVariableSize =3D PcdGet32 > > (PcdMaxHardwareErrorVariableSize) > > > - > > > + GetVariableHeaderSize (mVariableModule= Global- > > > >VariableGlobal.AuthFormat); > > > } else { > > > if ((Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > > > if (AtRuntime ()) { > > > @@ -2768,11 +2834,14 @@ VariableServiceQueryVariableInfoInternal ( > > > // Let *MaximumVariableSize be Max(Auth|Volatile)VariableSize wi= th > > the > > > exception of the variable header size. > > > // > > > if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) !=3D 0) { > > > - *MaximumVariableSize =3D mVariableModuleGlobal- > > > >MaxAuthVariableSize - GetVariableHeaderSize (); > > > + *MaximumVariableSize =3D mVariableModuleGlobal- > > > >MaxAuthVariableSize - > > > + GetVariableHeaderSize (mVariableModu= leGlobal- > > > >VariableGlobal.AuthFormat); > > > } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > > > - *MaximumVariableSize =3D mVariableModuleGlobal->MaxVariableSiz= e > - > > > GetVariableHeaderSize (); > > > + *MaximumVariableSize =3D mVariableModuleGlobal- > >MaxVariableSize - > > > + GetVariableHeaderSize (mVariableModu= leGlobal- > > > >VariableGlobal.AuthFormat); > > > } else { > > > - *MaximumVariableSize =3D mVariableModuleGlobal- > > > >MaxVolatileVariableSize - GetVariableHeaderSize (); > > > + *MaximumVariableSize =3D mVariableModuleGlobal- > > > >MaxVolatileVariableSize - > > > + GetVariableHeaderSize (mVariableModu= leGlobal- > > > >VariableGlobal.AuthFormat); > > > } > > > } > > > > > > @@ -2785,7 +2854,7 @@ VariableServiceQueryVariableInfoInternal ( > > > // Now walk through the related variable store. > > > // > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (VariableStoreHeader))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, > mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat); > > > VariableSize =3D (UINT64) (UINTN) NextVariable - (UINT64) (UINTN= ) > > Variable; > > > > > > if (AtRuntime ()) { > > > @@ -2820,10 +2889,11 @@ VariableServiceQueryVariableInfoInternal ( > > > VariablePtrTrack.StartPtr =3D GetStartPointer (VariableStore= Header); > > > VariablePtrTrack.EndPtr =3D GetEndPointer (VariableStore= Header); > > > Status =3D FindVariableEx ( > > > - GetVariableNamePtr (Variable), > > > - GetVendorGuidPtr (Variable), > > > + GetVariableNamePtr (Variable, mVariableModuleGlob= al- > > > >VariableGlobal.AuthFormat), > > > + GetVendorGuidPtr (Variable, mVariableModuleGlobal= - > > > >VariableGlobal.AuthFormat), > > > FALSE, > > > - &VariablePtrTrack > > > + &VariablePtrTrack, > > > + mVariableModuleGlobal->VariableGlobal.AuthFormat > > > ); > > > if (!EFI_ERROR (Status) && VariablePtrTrack.CurrPtr->State != =3D > > > VAR_ADDED) { > > > if ((Variable->Attributes & > > EFI_VARIABLE_HARDWARE_ERROR_RECORD) > > > =3D=3D EFI_VARIABLE_HARDWARE_ERROR_RECORD) { > > > @@ -2851,10 +2921,13 @@ VariableServiceQueryVariableInfoInternal ( > > > } > > > } > > > > > > - if (*RemainingVariableStorageSize < GetVariableHeaderSize ()) { > > > + if (*RemainingVariableStorageSize < GetVariableHeaderSize > > > (mVariableModuleGlobal->VariableGlobal.AuthFormat)) { > > > *MaximumVariableSize =3D 0; > > > - } else if ((*RemainingVariableStorageSize - GetVariableHeaderSize = ()) < > > > *MaximumVariableSize) { > > > - *MaximumVariableSize =3D *RemainingVariableStorageSize - > > > GetVariableHeaderSize (); > > > + } else if ((*RemainingVariableStorageSize - GetVariableHeaderSize > > > (mVariableModuleGlobal->VariableGlobal.AuthFormat)) < > > > + *MaximumVariableSize > > > + ) { > > > + *MaximumVariableSize =3D *RemainingVariableStorageSize - > > > + GetVariableHeaderSize (mVariableModuleG= lobal- > > > >VariableGlobal.AuthFormat); > > > } > > > > > > return EFI_SUCCESS; > > > @@ -3331,7 +3404,7 @@ InitNonVolatileVariableStore ( > > > // > > > Variable =3D GetStartPointer (mNvVariableCache); > > > while (IsValidVariableHeader (Variable, GetEndPointer > > > (mNvVariableCache))) { > > > - NextVariable =3D GetNextVariablePtr (Variable); > > > + NextVariable =3D GetNextVariablePtr (Variable, > mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat); > > > VariableSize =3D (UINTN) NextVariable - (UINTN) Variable; > > > if ((Variable->Attributes & (EFI_VARIABLE_NON_VOLATILE | > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD)) =3D=3D > > > (EFI_VARIABLE_NON_VOLATILE | > > > EFI_VARIABLE_HARDWARE_ERROR_RECORD)) { > > > mVariableModuleGlobal->HwErrVariableTotalSize +=3D VariableSiz= e; > > > @@ -3365,8 +3438,10 @@ FlushHobVariableToFlash ( > > > VOID *VariableData; > > > VARIABLE_POINTER_TRACK VariablePtrTrack; > > > BOOLEAN ErrorFlag; > > > + BOOLEAN AuthFormat; > > > > > > ErrorFlag =3D FALSE; > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > > > > > // > > > // Flush the HOB variable to flash. > > > @@ -3379,7 +3454,7 @@ FlushHobVariableToFlash ( > > > mVariableModuleGlobal->VariableGlobal.HobVariableBase =3D 0; > > > for ( Variable =3D GetStartPointer (VariableStoreHeader) > > > ; IsValidVariableHeader (Variable, GetEndPointer > > (VariableStoreHeader)) > > > - ; Variable =3D GetNextVariablePtr (Variable) > > > + ; Variable =3D GetNextVariablePtr (Variable, AuthFormat) > > > ) { > > > if (Variable->State !=3D VAR_ADDED) { > > > // > > > @@ -3389,22 +3464,33 @@ FlushHobVariableToFlash ( > > > } > > > ASSERT ((Variable->Attributes & EFI_VARIABLE_NON_VOLATILE) != =3D 0); > > > if (VendorGuid =3D=3D NULL || VariableName =3D=3D NULL || > > > - !CompareGuid (VendorGuid, GetVendorGuidPtr (Variable)) || > > > - StrCmp (VariableName, GetVariableNamePtr (Variable)) !=3D = 0) { > > > - VariableData =3D GetVariableDataPtr (Variable); > > > - FindVariable (GetVariableNamePtr (Variable), GetVendorGuidPt= r > > > (Variable), &VariablePtrTrack, &mVariableModuleGlobal->VariableGlobal= , > > > FALSE); > > > + !CompareGuid (VendorGuid, GetVendorGuidPtr (Variable, > > > AuthFormat)) || > > > + StrCmp (VariableName, GetVariableNamePtr (Variable, > > > AuthFormat)) !=3D 0) { > > > + VariableData =3D GetVariableDataPtr (Variable, AuthFormat); > > > + FindVariable ( > > > + GetVariableNamePtr (Variable, AuthFormat), > > > + GetVendorGuidPtr (Variable, AuthFormat), > > > + &VariablePtrTrack, > > > + &mVariableModuleGlobal->VariableGlobal, FALSE > > > + ); > > > Status =3D UpdateVariable ( > > > - GetVariableNamePtr (Variable), > > > - GetVendorGuidPtr (Variable), > > > + GetVariableNamePtr (Variable, AuthFormat), > > > + GetVendorGuidPtr (Variable, AuthFormat), > > > VariableData, > > > - DataSizeOfVariable (Variable), > > > + DataSizeOfVariable (Variable, AuthFormat), > > > Variable->Attributes, > > > 0, > > > 0, > > > &VariablePtrTrack, > > > NULL > > > ); > > > - DEBUG ((EFI_D_INFO, "Variable driver flush the HOB variable = to > > > flash: %g %s %r\n", GetVendorGuidPtr (Variable), GetVariableNamePtr > > > (Variable), Status)); > > > + DEBUG (( > > > + DEBUG_INFO, > > > + "Variable driver flush the HOB variable to flash: %g %s %r= \n", > > > + GetVendorGuidPtr (Variable, AuthFormat), > > > + GetVariableNamePtr (Variable, AuthFormat), > > > + Status > > > + )); > > > } else { > > > // > > > // The updated or deleted variable is matched with this HOB = variable. > > > @@ -3418,7 +3504,12 @@ FlushHobVariableToFlash ( > > > // If set variable successful, or the updated or deleted var= iable is > > > matched with the HOB variable, > > > // set the HOB variable to DELETED state in local. > > > // > > > - DEBUG ((EFI_D_INFO, "Variable driver set the HOB variable to > > DELETED > > > state in local: %g %s\n", GetVendorGuidPtr (Variable), > > GetVariableNamePtr > > > (Variable))); > > > + DEBUG (( > > > + DEBUG_INFO, > > > + "Variable driver set the HOB variable to DELETED state in > > > local: %g %s\n", > > > + GetVendorGuidPtr (Variable, AuthFormat), > > > + GetVariableNamePtr (Variable, AuthFormat) > > > + )); > > > Variable->State &=3D VAR_DELETED; > > > } else { > > > ErrorFlag =3D TRUE; > > > @@ -3495,7 +3586,8 @@ VariableWriteServiceInitialize ( > > > // Authenticated variable initialize. > > > // > > > mAuthContextIn.StructSize =3D sizeof (AUTH_VAR_LIB_CONTEXT_IN); > > > - mAuthContextIn.MaxAuthVariableSize =3D mVariableModuleGlobal- > > > >MaxAuthVariableSize - GetVariableHeaderSize (); > > > + mAuthContextIn.MaxAuthVariableSize =3D mVariableModuleGlobal- > > > >MaxAuthVariableSize - > > > + GetVariableHeaderSize (m= VariableModuleGlobal- > > > >VariableGlobal.AuthFormat); > > > Status =3D AuthVariableLibInitialize (&mAuthContextIn, > > > &mAuthContextOut); > > > if (!EFI_ERROR (Status)) { > > > DEBUG ((EFI_D_INFO, "Variable driver will work with auth varia= ble > > > support!\n")); > > > @@ -3574,7 +3666,7 @@ ConvertNormalVarStorageToAuthVarStorage ( > > > AuthVarStroageSize +=3D StartPtr->NameSize + GET_PAD_SIZE > (StartPtr- > > > >NameSize); > > > AuthVarStroageSize +=3D StartPtr->DataSize + GET_PAD_SIZE (Sta= rtPtr- > > > >DataSize); > > > } > > > - StartPtr =3D GetNextVariablePtr (StartPtr); > > > + StartPtr =3D GetNextVariablePtr (StartPtr, mVariableModuleGloba= l- > > > >VariableGlobal.AuthFormat); > > > } > > > > > > // > > > @@ -3608,18 +3700,22 @@ ConvertNormalVarStorageToAuthVarStorage > ( > > > // Copy Variable Name > > > // > > > NextPtr =3D (UINT8 *) (AuthStartPtr + 1); > > > - CopyMem (NextPtr, GetVariableNamePtr (StartPtr), AuthStartPtr- > > > >NameSize); > > > + CopyMem ( > > > + NextPtr, > > > + GetVariableNamePtr (StartPtr, mVariableModuleGlobal- > > > >VariableGlobal.AuthFormat), > > > + AuthStartPtr->NameSize > > > + ); > > > // > > > // Copy Variable Data > > > // > > > NextPtr =3D NextPtr + AuthStartPtr->NameSize + GET_PAD_SIZE > > > (AuthStartPtr->NameSize); > > > - CopyMem (NextPtr, GetVariableDataPtr (StartPtr), AuthStartPtr- > > > >DataSize); > > > + CopyMem (NextPtr, GetVariableDataPtr (StartPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat), AuthStartPtr- > > > >DataSize); > > > // > > > // Go to next variable > > > // > > > AuthStartPtr =3D (AUTHENTICATED_VARIABLE_HEADER *) (NextPtr + > > > AuthStartPtr->DataSize + GET_PAD_SIZE (AuthStartPtr->DataSize)); > > > } > > > - StartPtr =3D GetNextVariablePtr (StartPtr); > > > + StartPtr =3D GetNextVariablePtr (StartPtr, mVariableModuleGlobal= - > > > >VariableGlobal.AuthFormat); > > > } > > > // > > > // Update Auth Storage Header > > > diff --git > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c > > > index c787ddba5b..e865a089d1 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c > > > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableExLib.c > > > @@ -56,8 +56,8 @@ VariableExLibFindVariable ( > > > return Status; > > > } > > > > > > - AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable= .CurrPtr); > > > - AuthVariableInfo->Data =3D GetVariableDataPtr (Variable= .CurrPtr); > > > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable= .CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + AuthVariableInfo->Data =3D GetVariableDataPtr (Variable= .CurrPtr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > AuthVariableInfo->Attributes =3D Variable.CurrPtr->Attributes= ; > > > if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) > > Variable.CurrPtr; > > > @@ -108,7 +108,8 @@ VariableExLibFindNextVariable ( > > > VariableName, > > > VendorGuid, > > > VariableStoreHeader, > > > - &VariablePtr > > > + &VariablePtr, > > > + mVariableModuleGlobal->VariableGlobal.AuthFormat > > > ); > > > if (EFI_ERROR (Status)) { > > > AuthVariableInfo->VariableName =3D NULL; > > > @@ -122,10 +123,10 @@ VariableExLibFindNextVariable ( > > > return Status; > > > } > > > > > > - AuthVariableInfo->VariableName =3D GetVariableNamePtr (Variable= Ptr); > > > - AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePt= r); > > > - AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable= Ptr); > > > - AuthVariableInfo->Data =3D GetVariableDataPtr (Variable= Ptr); > > > + AuthVariableInfo->VariableName =3D GetVariableNamePtr (Variable= Ptr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePt= r, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable= Ptr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > + AuthVariableInfo->Data =3D GetVariableDataPtr (Variable= Ptr, > > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > > AuthVariableInfo->Attributes =3D VariablePtr->Attributes; > > > if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > AuthVariablePtr =3D (AUTHENTICATED_VARIABLE_HEADER *) VariablePt= r; > > > diff --git > > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > index 870c9e3742..d458f1c608 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > @@ -78,17 +78,20 @@ GetVariableStoreStatus ( > > > /** > > > This code gets the size of variable header. > > > > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > + > > > @return Size of variable header in bytes in type UINTN. > > > > > > **/ > > > UINTN > > > GetVariableHeaderSize ( > > > - VOID > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > UINTN Value; > > > > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > Value =3D sizeof (AUTHENTICATED_VARIABLE_HEADER); > > > } else { > > > Value =3D sizeof (VARIABLE_HEADER); > > > @@ -101,20 +104,23 @@ GetVariableHeaderSize ( > > > > > > This code gets the size of name of variable. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the variable header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > @return UINTN Size of variable in bytes. > > > > > > **/ > > > UINTN > > > NameSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > if (AuthVariable->State =3D=3D (UINT8) (-1) || > > > AuthVariable->DataSize =3D=3D (UINT32) (-1) || > > > AuthVariable->NameSize =3D=3D (UINT32) (-1) || > > > @@ -136,20 +142,23 @@ NameSizeOfVariable ( > > > /** > > > This code sets the size of name of variable. > > > > > > - @param[in] Variable Pointer to the Variable Header. > > > - @param[in] NameSize Name size to set. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] NameSize Name size to set. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > **/ > > > VOID > > > SetNameSizeOfVariable ( > > > IN VARIABLE_HEADER *Variable, > > > - IN UINTN NameSize > > > + IN UINTN NameSize, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > AuthVariable->NameSize =3D (UINT32) NameSize; > > > } else { > > > Variable->NameSize =3D (UINT32) NameSize; > > > @@ -160,20 +169,23 @@ SetNameSizeOfVariable ( > > > > > > This code gets the size of variable data. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables a= re > > used. > > > + FALSE indicates authenticated variables = are not used. > > > > > > @return Size of variable in bytes. > > > > > > **/ > > > UINTN > > > DataSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > if (AuthVariable->State =3D=3D (UINT8) (-1) || > > > AuthVariable->DataSize =3D=3D (UINT32) (-1) || > > > AuthVariable->NameSize =3D=3D (UINT32) (-1) || > > > @@ -197,18 +209,21 @@ DataSizeOfVariable ( > > > > > > @param[in] Variable Pointer to the Variable Header. > > > @param[in] DataSize Data size to set. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables are = not used. > > > > > > **/ > > > VOID > > > SetDataSizeOfVariable ( > > > - IN VARIABLE_HEADER *Variable, > > > - IN UINTN DataSize > > > + IN VARIABLE_HEADER *Variable, > > > + IN UINTN DataSize, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > AuthVariable->DataSize =3D (UINT32) DataSize; > > > } else { > > > Variable->DataSize =3D (UINT32) DataSize; > > > @@ -219,36 +234,42 @@ SetDataSizeOfVariable ( > > > > > > This code gets the pointer to the variable name. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to Variable Name which is Unicode encoding. > > > > > > **/ > > > CHAR16 * > > > GetVariableNamePtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > - return (CHAR16 *) ((UINTN) Variable + GetVariableHeaderSize ()); > > > + return (CHAR16 *) ((UINTN) Variable + GetVariableHeaderSize > > > (AuthFormat)); > > > } > > > > > > /** > > > This code gets the pointer to the variable guid. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return A EFI_GUID* pointer to Vendor Guid. > > > > > > **/ > > > EFI_GUID * > > > GetVendorGuidPtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; > > > > > > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > > > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > > > + if (AuthFormat) { > > > return &AuthVariable->VendorGuid; > > > } else { > > > return &Variable->VendorGuid; > > > @@ -259,14 +280,17 @@ GetVendorGuidPtr ( > > > > > > This code gets the pointer to the variable data. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to Variable Data. > > > > > > **/ > > > UINT8 * > > > GetVariableDataPtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > UINTN Value; > > > @@ -274,9 +298,9 @@ GetVariableDataPtr ( > > > // > > > // Be careful about pad size for alignment. > > > // > > > - Value =3D (UINTN) GetVariableNamePtr (Variable); > > > - Value +=3D NameSizeOfVariable (Variable); > > > - Value +=3D GET_PAD_SIZE (NameSizeOfVariable (Variable)); > > > + Value =3D (UINTN) GetVariableNamePtr (Variable, AuthFormat); > > > + Value +=3D NameSizeOfVariable (Variable, AuthFormat); > > > + Value +=3D GET_PAD_SIZE (NameSizeOfVariable (Variable, AuthFormat)= ); > > > > > > return (UINT8 *) Value; > > > } > > > @@ -284,14 +308,17 @@ GetVariableDataPtr ( > > > /** > > > This code gets the variable data offset related to variable header= . > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Variable Data offset. > > > > > > **/ > > > UINTN > > > GetVariableDataOffset ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > UINTN Value; > > > @@ -299,9 +326,9 @@ GetVariableDataOffset ( > > > // > > > // Be careful about pad size for alignment > > > // > > > - Value =3D GetVariableHeaderSize (); > > > - Value +=3D NameSizeOfVariable (Variable); > > > - Value +=3D GET_PAD_SIZE (NameSizeOfVariable (Variable)); > > > + Value =3D GetVariableHeaderSize (AuthFormat); > > > + Value +=3D NameSizeOfVariable (Variable, AuthFormat); > > > + Value +=3D GET_PAD_SIZE (NameSizeOfVariable (Variable, AuthFormat)= ); > > > > > > return Value; > > > } > > > @@ -310,21 +337,24 @@ GetVariableDataOffset ( > > > > > > This code gets the pointer to the next variable header. > > > > > > - @param Variable Pointer to the Variable Header. > > > + @param[in] Variable Pointer to the Variable Header. > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > > used. > > > + FALSE indicates authenticated variables ar= e not used. > > > > > > @return Pointer to next variable header. > > > > > > **/ > > > VARIABLE_HEADER * > > > GetNextVariablePtr ( > > > - IN VARIABLE_HEADER *Variable > > > + IN VARIABLE_HEADER *Variable, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > UINTN Value; > > > > > > - Value =3D (UINTN) GetVariableDataPtr (Variable); > > > - Value +=3D DataSizeOfVariable (Variable); > > > - Value +=3D GET_PAD_SIZE (DataSizeOfVariable (Variable)); > > > + Value =3D (UINTN) GetVariableDataPtr (Variable, AuthFormat); > > > + Value +=3D DataSizeOfVariable (Variable, AuthFormat); > > > + Value +=3D GET_PAD_SIZE (DataSizeOfVariable (Variable, AuthFormat)= ); > > > > > > // > > > // Be careful about pad size for alignment. > > > @@ -415,6 +445,8 @@ VariableCompareTimeStampInternal ( > > > @param[in] IgnoreRtCheck Ignore > > EFI_VARIABLE_RUNTIME_ACCESS > > > attribute > > > check at runtime when searchi= ng variable. > > > @param[in, out] PtrTrack Variable Track Pointer struct= ure that > > > contains Variable Information. > > > + @param[in] AuthFormat TRUE indicates authenticated = variables > > are > > > used. > > > + FALSE indicates authenticated= variables are not used. > > > > > > @retval EFI_SUCCESS Variable found successfully > > > @retval EFI_NOT_FOUND Variable not found > > > @@ -424,7 +456,8 @@ FindVariableEx ( > > > IN CHAR16 *VariableName, > > > IN EFI_GUID *VendorGuid, > > > IN BOOLEAN IgnoreRtCheck, > > > - IN OUT VARIABLE_POINTER_TRACK *PtrTrack > > > + IN OUT VARIABLE_POINTER_TRACK *PtrTrack, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > VARIABLE_HEADER *InDeletedVariable; > > > @@ -439,7 +472,7 @@ FindVariableEx ( > > > > > > for ( PtrTrack->CurrPtr =3D PtrTrack->StartPtr > > > ; IsValidVariableHeader (PtrTrack->CurrPtr, PtrTrack->EndPtr) > > > - ; PtrTrack->CurrPtr =3D GetNextVariablePtr (PtrTrack->CurrPtr) > > > + ; PtrTrack->CurrPtr =3D GetNextVariablePtr (PtrTrack->CurrPtr, > > > AuthFormat) > > > ) { > > > if (PtrTrack->CurrPtr->State =3D=3D VAR_ADDED || > > > PtrTrack->CurrPtr->State =3D=3D (VAR_IN_DELETED_TRANSITION & > > > VAR_ADDED) > > > @@ -453,11 +486,11 @@ FindVariableEx ( > > > return EFI_SUCCESS; > > > } > > > } else { > > > - if (CompareGuid (VendorGuid, GetVendorGuidPtr (PtrTrack- > > >CurrPtr))) > > > { > > > - Point =3D (VOID *) GetVariableNamePtr (PtrTrack->CurrPtr= ); > > > + if (CompareGuid (VendorGuid, GetVendorGuidPtr (PtrTrack- > > >CurrPtr, > > > AuthFormat))) { > > > + Point =3D (VOID *) GetVariableNamePtr (PtrTrack->CurrPtr= , > > > AuthFormat); > > > > > > - ASSERT (NameSizeOfVariable (PtrTrack->CurrPtr) !=3D 0); > > > - if (CompareMem (VariableName, Point, NameSizeOfVariable > > > (PtrTrack->CurrPtr)) =3D=3D 0) { > > > + ASSERT (NameSizeOfVariable (PtrTrack->CurrPtr, AuthForma= t) !=3D > 0); > > > + if (CompareMem (VariableName, Point, NameSizeOfVariable > > > (PtrTrack->CurrPtr, AuthFormat)) =3D=3D 0) { > > > if (PtrTrack->CurrPtr->State =3D=3D (VAR_IN_DELETED_TR= ANSITION & > > > VAR_ADDED)) { > > > InDeletedVariable =3D PtrTrack->CurrPtr; > > > } else { > > > @@ -486,6 +519,8 @@ FindVariableEx ( > > > @param[in] VariableStoreList A list of variable stores that shoul= d be > used > > > to get the next variable. > > > The maximum number of entries is the= max value of > > > VARIABLE_STORE_TYPE. > > > @param[out] VariablePtr Pointer to variable header address. > > > + @param[in] AuthFormat TRUE indicates authenticated variabl= es > are > > > used. > > > + FALSE indicates authenticated variab= les are not used. > > > > > > @retval EFI_SUCCESS The function completed successfully. > > > @retval EFI_NOT_FOUND The next variable was not found. > > > @@ -500,7 +535,8 @@ VariableServiceGetNextVariableInternal ( > > > IN CHAR16 *VariableName, > > > IN EFI_GUID *VendorGuid, > > > IN VARIABLE_STORE_HEADER **VariableStoreList, > > > - OUT VARIABLE_HEADER **VariablePtr > > > + OUT VARIABLE_HEADER **VariablePtr, > > > + IN BOOLEAN AuthFormat > > > ) > > > { > > > EFI_STATUS Status; > > > @@ -525,7 +561,7 @@ VariableServiceGetNextVariableInternal ( > > > Variable.EndPtr =3D GetEndPointer (VariableStoreList[StoreTy= pe]); > > > Variable.Volatile =3D (BOOLEAN) (StoreType =3D=3D > > VariableStoreTypeVolatile); > > > > > > - Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, > &Variable); > > > + Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, > &Variable, > > > AuthFormat); > > > if (!EFI_ERROR (Status)) { > > > break; > > > } > > > @@ -552,7 +588,7 @@ VariableServiceGetNextVariableInternal ( > > > // > > > // If variable name is not empty, get next variable. > > > // > > > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > > > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, AuthF= ormat); > > > } > > > > > > while (TRUE) { > > > @@ -605,13 +641,14 @@ VariableServiceGetNextVariableInternal ( > > > VariablePtrTrack.StartPtr =3D Variable.StartPtr; > > > VariablePtrTrack.EndPtr =3D Variable.EndPtr; > > > Status =3D FindVariableEx ( > > > - GetVariableNamePtr (Variable.CurrPtr), > > > - GetVendorGuidPtr (Variable.CurrPtr), > > > + GetVariableNamePtr (Variable.CurrPtr, AuthForma= t), > > > + GetVendorGuidPtr (Variable.CurrPtr, AuthFormat)= , > > > FALSE, > > > - &VariablePtrTrack > > > + &VariablePtrTrack, > > > + AuthFormat > > > ); > > > if (!EFI_ERROR (Status) && VariablePtrTrack.CurrPtr->State= =3D=3D > > > VAR_ADDED) { > > > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPt= r); > > > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPt= r, > > AuthFormat); > > > continue; > > > } > > > } > > > @@ -625,13 +662,14 @@ VariableServiceGetNextVariableInternal ( > > > VariableInHob.StartPtr =3D GetStartPointer > > > (VariableStoreList[VariableStoreTypeHob]); > > > VariableInHob.EndPtr =3D GetEndPointer > > > (VariableStoreList[VariableStoreTypeHob]); > > > Status =3D FindVariableEx ( > > > - GetVariableNamePtr (Variable.CurrPtr), > > > - GetVendorGuidPtr (Variable.CurrPtr), > > > + GetVariableNamePtr (Variable.CurrPtr, AuthForma= t), > > > + GetVendorGuidPtr (Variable.CurrPtr, AuthFormat)= , > > > FALSE, > > > - &VariableInHob > > > + &VariableInHob, > > > + AuthFormat > > > ); > > > if (!EFI_ERROR (Status)) { > > > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPt= r); > > > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPt= r, > > AuthFormat); > > > continue; > > > } > > > } > > > @@ -642,7 +680,7 @@ VariableServiceGetNextVariableInternal ( > > > } > > > } > > > > > > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > > > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, AuthF= ormat); > > > } > > > > > > Done: > > > diff --git > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > > > index ce409f22a3..5e24bc4a62 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > > > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c > > > @@ -975,8 +975,9 @@ MmVariableServiceInitialize ( > > > ); > > > ASSERT_EFI_ERROR (Status); > > > > > > - mVariableBufferPayloadSize =3D GetMaxVariableSize () + > > > - OFFSET_OF > > > (SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY, > > > Name) - GetVariableHeaderSize (); > > > + mVariableBufferPayloadSize =3D GetMaxVariableSize () + > > > + OFFSET_OF > > > (SMM_VARIABLE_COMMUNICATE_VAR_CHECK_VARIABLE_PROPERTY, > > > Name) - > > > + GetVariableHeaderSize (mVariableMo= duleGlobal- > > > >VariableGlobal.AuthFormat); > > > > > > Status =3D gMmst->MmAllocatePool ( > > > EfiRuntimeServicesData, > > > -- > > > 2.16.2.windows.1 > > >=20