From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.850.1571274080271859028 for ; Wed, 16 Oct 2019 18:01:20 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 18:01:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,305,1566889200"; d="scan'208";a="225985338" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga002.fm.intel.com with ESMTP; 16 Oct 2019 18:01:19 -0700 Received: from fmsmsx125.amr.corp.intel.com (10.18.125.40) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:01:19 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX125.amr.corp.intel.com (10.18.125.40) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:01:18 -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:01:14 +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/PSZKadeBe1A Date: Thu, 17 Oct 2019 01:01:14 +0000 Message-ID: References: <20191014233001.33024-1-michael.a.kubacki@intel.com> <20191014233001.33024-5-michael.a.kubacki@intel.com> In-Reply-To: <20191014233001.33024-5-michael.a.kubacki@intel.com> 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 > -----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; Ki= nney, > Michael D; Ni, Ray; Wang, Jian J; Wu, Hao A; Yao, Jiewen > Subject: [PATCH V4 04/10] MdeModulePkg/Variable: Parameterize auth > status in VariableParsing >=20 > 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. >=20 > 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 'AuthF= ormat' 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 >=20 > 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(-) >=20 > 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. >=20 > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. > + > @return Size of variable header in bytes in type UINTN. >=20 > **/ > UINTN > GetVariableHeaderSize ( > - VOID > + IN BOOLEAN AuthFormat > ); >=20 > /** >=20 > This code gets the size of name of variable. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the variable header. > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > @return UINTN Size of variable in bytes. >=20 > **/ > UINTN > NameSizeOfVariable ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** > This code sets the size of name of variable. >=20 > - @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 are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > **/ > VOID > SetNameSizeOfVariable ( > IN VARIABLE_HEADER *Variable, > - IN UINTN NameSize > + IN UINTN NameSize, > + IN BOOLEAN AuthFormat > ); >=20 > /** >=20 > This code gets the size of variable data. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > @return Size of variable in bytes. >=20 > **/ > UINTN > DataSizeOfVariable ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** > @@ -103,80 +115,98 @@ DataSizeOfVariable ( >=20 > @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. >=20 > **/ > VOID > SetDataSizeOfVariable ( > - IN VARIABLE_HEADER *Variable, > - IN UINTN DataSize > + IN VARIABLE_HEADER *Variable, > + IN UINTN DataSize, > + IN BOOLEAN AuthFormat > ); >=20 > /** >=20 > This code gets the pointer to the variable name. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to Variable Name which is Unicode encoding. >=20 > **/ > CHAR16 * > GetVariableNamePtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** > This code gets the pointer to the variable guid. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return A EFI_GUID* pointer to Vendor Guid. >=20 > **/ > EFI_GUID * > GetVendorGuidPtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** >=20 > This code gets the pointer to the variable data. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to Variable Data. >=20 > **/ > UINT8 * > GetVariableDataPtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** > This code gets the variable data offset related to variable header. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Variable Data offset. >=20 > **/ > UINTN > GetVariableDataOffset ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** >=20 > This code gets the pointer to the next variable header. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to next variable header. >=20 > **/ > VARIABLE_HEADER * > GetNextVariablePtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ); >=20 > /** > @@ -235,6 +265,8 @@ VariableCompareTimeStampInternal ( > @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCES= S > attribute > check at runtime when searching v= ariable. > @param[in, out] PtrTrack Variable Track Pointer structure = that > contains Variable Information. > + @param[in] AuthFormat TRUE indicates authenticated vari= ables are > used. > + FALSE indicates authenticated var= iables are not used. >=20 > @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 > ); >=20 > /** > @@ -258,10 +291,12 @@ FindVariableEx ( > @param[in] VariableStoreList A list of variable stores that should 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 variables a= re > used. > + FALSE indicates authenticated variables = are not used. >=20 > @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. >=20 > @@ -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 > ); >=20 > /** > 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.CurrP= tr); > + VarErrFlag =3D (VAR_ERROR_FLAG *) GetVariableDataPtr (Variable.CurrP= tr, > 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 speci= ally. > // > 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, mVariableModuleGlob= al- > >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 (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) { > // > // No property, it is user variable. > // > @@ -518,7 +526,9 @@ Reclaim ( > UINTN HwErrVariableTotalSize; > VARIABLE_HEADER *UpdatingVariable; > VARIABLE_HEADER *UpdatingInDeletedTransition; > + BOOLEAN AuthFormat; >=20 > + 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); >=20 > 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_ADD= ED) { > 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)) { >=20 > // > @@ -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, AuthForma= t)) { > + Point0 =3D (VOID *) GetVariableNamePtr (AddedVariable, AuthFor= mat); > + Point1 =3D (VOID *) GetVariableNamePtr (Variable, AuthFormat); > 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 VariableSiz= e; > @@ -829,7 +840,13 @@ FindVariable ( > PtrTrack->EndPtr =3D GetEndPointer (VariableStoreHeader[Type]); > PtrTrack->Volatile =3D (BOOLEAN) (Type =3D=3D VariableStoreTypeVolat= ile); >=20 > - Status =3D FindVariableEx (VariableName, VendorGuid, IgnoreRtCheck, > 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 (GetVariableHeaderSize = () + > VarNameSize + VarDataSize); > + VariableEntry->VariableSize =3D HEADER_ALIGN ( > + GetVariableHeaderSize ( > + mVariableModuleGlobal->VariableGlo= bal.AuthFormat > + ) + VarNameSize + VarDataSize > + ); >=20 > 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 variable = 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; >=20 > if (mVariableModuleGlobal->FvbInstance =3D=3D NULL > && !mVariableModuleGlobal->VariableGlobal.EmuNvMode) { > // > @@ -1619,6 +1642,8 @@ UpdateVariable ( > } > } >=20 > + 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 cac= he. > @@ -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 passe= d in, > // then return to the caller immediately. > // > - if (DataSizeOfVariable (CacheVariable->CurrPtr) =3D=3D DataSize && > - (CompareMem (Data, GetVariableDataPtr (CacheVariable->CurrPtr), > DataSize) =3D=3D 0) && > + if (DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) =3D=3D D= ataSize > && > + (CompareMem (Data, GetVariableDataPtr (CacheVariable->CurrPtr, > 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 for Va= riable > Header and Name. > // From DataOffset of NextVariable is to save the existing varia= ble data. > // > - DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr); > + DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr, > AuthFormat); > BufferForMerge =3D (UINT8 *) ((UINTN) NextVariable + DataOffset)= ; > - CopyMem (BufferForMerge, (UINT8 *) ((UINTN) CacheVariable- > >CurrPtr + DataOffset), DataSizeOfVariable (CacheVariable->CurrPtr)); > + CopyMem ( > + BufferForMerge, > + (UINT8 *) ((UINTN) CacheVariable->CurrPtr + DataOffset), > + DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) > + ); >=20 > // > // Set Max Auth/Non-Volatile/Volatile Variable Data Size as defa= ult > MaxDataSize. > @@ -1814,15 +1843,22 @@ UpdateVariable ( > MaxDataSize =3D PcdGet32 (PcdMaxHardwareErrorVariableSize) - > DataOffset; > } >=20 > - if (DataSizeOfVariable (CacheVariable->CurrPtr) + DataSize > > MaxDataSize) { > + if (DataSizeOfVariable (CacheVariable->CurrPtr, AuthFormat) + > DataSize > MaxDataSize) { > // > // Existing data size + new data size exceed maximum variable = 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 (CacheVariable- > >CurrPtr, AuthFormat) > + ), > + Data, > + DataSize > + ); > + MergedBufSize =3D DataSizeOfVariable (CacheVariable->CurrPtr, > AuthFormat) + > + DataSize; >=20 > // > // BufferForMerge(from DataOffset of NextVariable) has included = the > merged existing and new data. > @@ -1925,7 +1961,7 @@ UpdateVariable ( > // > NextVariable->Attributes =3D Attributes & (~EFI_VARIABLE_APPEND_WRITE= ); >=20 > - VarNameOffset =3D GetVariableHeaderSize (); > + VarNameOffset =3D GetVariableHeaderSize (AuthFormat); > VarNameSize =3D StrSize (VariableName); > CopyMem ( > (UINT8 *) ((UINTN) NextVariable + VarNameOffset), > @@ -1946,14 +1982,18 @@ UpdateVariable ( > ); > } >=20 > - 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 variable > // service can get actual size in GetVariable. > // > - SetNameSizeOfVariable (NextVariable, VarNameSize); > - SetDataSizeOfVariable (NextVariable, DataSize); > + SetNameSizeOfVariable (NextVariable, VarNameSize, AuthFormat); > + SetDataSizeOfVariable (NextVariable, DataSize, AuthFormat); >=20 > // > // The actual size of the variable that stores in storage should > @@ -2036,7 +2076,7 @@ UpdateVariable ( > TRUE, > Fvb, > mVariableModuleGlobal->NonVolatileLastVariableOffset, > - (UINT32) GetVariableHeaderSize (), > + (UINT32) GetVariableHeaderSize (AuthFormat), > (UINT8 *) NextVariable > ); >=20 > @@ -2069,9 +2109,9 @@ UpdateVariable ( > FALSE, > TRUE, > Fvb, > - mVariableModuleGlobal->NonVolatileLastVariableOffset + > GetVariableHeaderSize (), > - (UINT32) (VarSize - GetVariableHeaderSize ()), > - (UINT8 *) NextVariable + GetVariableHeaderSize () > + mVariableModuleGlobal->NonVolatileLastVariableOffset + > GetVariableHeaderSize (AuthFormat), > + (UINT32) (VarSize - GetVariableHeaderSize (AuthFormat))= , > + (UINT8 *) NextVariable + GetVariableHeaderSize (AuthFor= mat) > ); >=20 > 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); >=20 > if (*DataSize >=3D VarDataSize) { > @@ -2300,7 +2340,7 @@ VariableServiceGetVariable ( > goto Done; > } >=20 > - CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr), VarDataSize); > + 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]; >=20 > @@ -2364,6 +2405,8 @@ VariableServiceGetNextVariableName ( > return EFI_INVALID_PARAMETER; > } >=20 > + 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 mNvVariableCache; >=20 > - 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; >=20 > // > // 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) - GetVariableHeaderSi= ze > (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 > mVariableModuleGlobal- > >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 > mVariableModuleGlobal- > >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 > mVariableModuleGlobal- > >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 (mVariableModuleGlob= al- > >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 with t= he > exception of the variable header size. > // > if ((Attributes & VARIABLE_ATTRIBUTE_AT_AW) !=3D 0) { > - *MaximumVariableSize =3D mVariableModuleGlobal- > >MaxAuthVariableSize - GetVariableHeaderSize (); > + *MaximumVariableSize =3D mVariableModuleGlobal- > >MaxAuthVariableSize - > + GetVariableHeaderSize (mVariableModuleGl= obal- > >VariableGlobal.AuthFormat); > } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > - *MaximumVariableSize =3D mVariableModuleGlobal->MaxVariableSize - > GetVariableHeaderSize (); > + *MaximumVariableSize =3D mVariableModuleGlobal->MaxVariableSize - > + GetVariableHeaderSize (mVariableModuleGl= obal- > >VariableGlobal.AuthFormat); > } else { > - *MaximumVariableSize =3D mVariableModuleGlobal- > >MaxVolatileVariableSize - GetVariableHeaderSize (); > + *MaximumVariableSize =3D mVariableModuleGlobal- > >MaxVolatileVariableSize - > + GetVariableHeaderSize (mVariableModuleGl= obal- > >VariableGlobal.AuthFormat); > } > } >=20 > @@ -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) Va= riable; >=20 > if (AtRuntime ()) { > @@ -2820,10 +2889,11 @@ VariableServiceQueryVariableInfoInternal ( > VariablePtrTrack.StartPtr =3D GetStartPointer (VariableStoreHead= er); > VariablePtrTrack.EndPtr =3D GetEndPointer (VariableStoreHead= er); > Status =3D FindVariableEx ( > - GetVariableNamePtr (Variable), > - GetVendorGuidPtr (Variable), > + GetVariableNamePtr (Variable, mVariableModuleGlobal- > >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 ( > } > } >=20 > - 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 (mVariableModuleGloba= l- > >VariableGlobal.AuthFormat); > } >=20 > 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 VariableSize; > @@ -3365,8 +3438,10 @@ FlushHobVariableToFlash ( > VOID *VariableData; > VARIABLE_POINTER_TRACK VariablePtrTrack; > BOOLEAN ErrorFlag; > + BOOLEAN AuthFormat; >=20 > ErrorFlag =3D FALSE; > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; >=20 > // > // Flush the HOB variable to flash. > @@ -3379,7 +3454,7 @@ FlushHobVariableToFlash ( > mVariableModuleGlobal->VariableGlobal.HobVariableBase =3D 0; > for ( Variable =3D GetStartPointer (VariableStoreHeader) > ; IsValidVariableHeader (Variable, GetEndPointer (VariableStoreH= eader)) > - ; 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), GetVendorGuidPtr > (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 vari= able. > @@ -3418,7 +3504,12 @@ FlushHobVariableToFlash ( > // If set variable successful, or the updated or deleted variabl= e 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 DEL= ETED > 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 (mVari= ableModuleGlobal- > >VariableGlobal.AuthFormat); > Status =3D AuthVariableLibInitialize (&mAuthContextIn, > &mAuthContextOut); > if (!EFI_ERROR (Status)) { > DEBUG ((EFI_D_INFO, "Variable driver will work with auth variable > support!\n")); > @@ -3574,7 +3666,7 @@ ConvertNormalVarStorageToAuthVarStorage ( > AuthVarStroageSize +=3D StartPtr->NameSize + GET_PAD_SIZE (StartPt= r- > >NameSize); > AuthVarStroageSize +=3D StartPtr->DataSize + GET_PAD_SIZE (StartPt= r- > >DataSize); > } > - StartPtr =3D GetNextVariablePtr (StartPtr); > + StartPtr =3D GetNextVariablePtr (StartPtr, mVariableModuleGlobal- > >VariableGlobal.AuthFormat); > } >=20 > // > @@ -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; > } >=20 > - AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable.Cur= rPtr); > - AuthVariableInfo->Data =3D GetVariableDataPtr (Variable.Cur= rPtr); > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable.Cur= rPtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat); > + AuthVariableInfo->Data =3D GetVariableDataPtr (Variable.Cur= rPtr, > 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; > } >=20 > - AuthVariableInfo->VariableName =3D GetVariableNamePtr (VariablePtr)= ; > - AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePtr); > - AuthVariableInfo->DataSize =3D DataSizeOfVariable (VariablePtr)= ; > - AuthVariableInfo->Data =3D GetVariableDataPtr (VariablePtr)= ; > + AuthVariableInfo->VariableName =3D GetVariableNamePtr (VariablePtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat); > + AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat); > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (VariablePtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat); > + AuthVariableInfo->Data =3D GetVariableDataPtr (VariablePtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat); > AuthVariableInfo->Attributes =3D VariablePtr->Attributes; > if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > AuthVariablePtr =3D (AUTHENTICATED_VARIABLE_HEADER *) VariablePtr; > 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. >=20 > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. > + > @return Size of variable header in bytes in type UINTN. >=20 > **/ > UINTN > GetVariableHeaderSize ( > - VOID > + IN BOOLEAN AuthFormat > ) > { > UINTN Value; >=20 > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > + if (AuthFormat) { > Value =3D sizeof (AUTHENTICATED_VARIABLE_HEADER); > } else { > Value =3D sizeof (VARIABLE_HEADER); > @@ -101,20 +104,23 @@ GetVariableHeaderSize ( >=20 > This code gets the size of name of variable. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the variable header. > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > @return UINTN Size of variable in bytes. >=20 > **/ > UINTN > NameSizeOfVariable ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ) > { > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; >=20 > 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. >=20 > - @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 are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > **/ > VOID > SetNameSizeOfVariable ( > IN VARIABLE_HEADER *Variable, > - IN UINTN NameSize > + IN UINTN NameSize, > + IN BOOLEAN AuthFormat > ) > { > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; >=20 > 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 ( >=20 > This code gets the size of variable data. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are u= sed. > + FALSE indicates authenticated variables are = not used. >=20 > @return Size of variable in bytes. >=20 > **/ > UINTN > DataSizeOfVariable ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ) > { > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; >=20 > 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 ( >=20 > @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. >=20 > **/ > VOID > SetDataSizeOfVariable ( > - IN VARIABLE_HEADER *Variable, > - IN UINTN DataSize > + IN VARIABLE_HEADER *Variable, > + IN UINTN DataSize, > + IN BOOLEAN AuthFormat > ) > { > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; >=20 > 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 ( >=20 > This code gets the pointer to the variable name. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to Variable Name which is Unicode encoding. >=20 > **/ > CHAR16 * > GetVariableNamePtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ) > { > - return (CHAR16 *) ((UINTN) Variable + GetVariableHeaderSize ()); > + return (CHAR16 *) ((UINTN) Variable + GetVariableHeaderSize > (AuthFormat)); > } >=20 > /** > This code gets the pointer to the variable guid. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return A EFI_GUID* pointer to Vendor Guid. >=20 > **/ > EFI_GUID * > GetVendorGuidPtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ) > { > AUTHENTICATED_VARIABLE_HEADER *AuthVariable; >=20 > AuthVariable =3D (AUTHENTICATED_VARIABLE_HEADER *) Variable; > - if (mVariableModuleGlobal->VariableGlobal.AuthFormat) { > + if (AuthFormat) { > return &AuthVariable->VendorGuid; > } else { > return &Variable->VendorGuid; > @@ -259,14 +280,17 @@ GetVendorGuidPtr ( >=20 > This code gets the pointer to the variable data. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to Variable Data. >=20 > **/ > 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)); >=20 > return (UINT8 *) Value; > } > @@ -284,14 +308,17 @@ GetVariableDataPtr ( > /** > This code gets the variable data offset related to variable header. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Variable Data offset. >=20 > **/ > 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)); >=20 > return Value; > } > @@ -310,21 +337,24 @@ GetVariableDataOffset ( >=20 > This code gets the pointer to the next variable header. >=20 > - @param Variable Pointer to the Variable Header. > + @param[in] Variable Pointer to the Variable Header. > + @param[in] AuthFormat TRUE indicates authenticated variables are use= d. > + FALSE indicates authenticated variables are no= t used. >=20 > @return Pointer to next variable header. >=20 > **/ > VARIABLE_HEADER * > GetNextVariablePtr ( > - IN VARIABLE_HEADER *Variable > + IN VARIABLE_HEADER *Variable, > + IN BOOLEAN AuthFormat > ) > { > UINTN Value; >=20 > - 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)); >=20 > // > // Be careful about pad size for alignment. > @@ -415,6 +445,8 @@ VariableCompareTimeStampInternal ( > @param[in] IgnoreRtCheck Ignore EFI_VARIABLE_RUNTIME_ACCES= S > attribute > check at runtime when searching v= ariable. > @param[in, out] PtrTrack Variable Track Pointer structure = that > contains Variable Information. > + @param[in] AuthFormat TRUE indicates authenticated vari= ables are > used. > + FALSE indicates authenticated var= iables are not used. >=20 > @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 ( >=20 > 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->CurrP= tr))) > { > - Point =3D (VOID *) GetVariableNamePtr (PtrTrack->CurrPtr); > + if (CompareGuid (VendorGuid, GetVendorGuidPtr (PtrTrack->CurrP= tr, > AuthFormat))) { > + Point =3D (VOID *) GetVariableNamePtr (PtrTrack->CurrPtr, > AuthFormat); >=20 > - ASSERT (NameSizeOfVariable (PtrTrack->CurrPtr) !=3D 0); > - if (CompareMem (VariableName, Point, NameSizeOfVariable > (PtrTrack->CurrPtr)) =3D=3D 0) { > + ASSERT (NameSizeOfVariable (PtrTrack->CurrPtr, AuthFormat) != =3D 0); > + if (CompareMem (VariableName, Point, NameSizeOfVariable > (PtrTrack->CurrPtr, AuthFormat)) =3D=3D 0) { > if (PtrTrack->CurrPtr->State =3D=3D (VAR_IN_DELETED_TRANSI= TION & > VAR_ADDED)) { > InDeletedVariable =3D PtrTrack->CurrPtr; > } else { > @@ -486,6 +519,8 @@ FindVariableEx ( > @param[in] VariableStoreList A list of variable stores that should 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 variables a= re > used. > + FALSE indicates authenticated variables = are not used. >=20 > @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[StoreType])= ; > Variable.Volatile =3D (BOOLEAN) (StoreType =3D=3D VariableStoreTypeV= olatile); >=20 > - Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, &Variabl= e); > + Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, &Variabl= e, > 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, AuthForma= t); > } >=20 > 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, AuthFormat), > + GetVendorGuidPtr (Variable.CurrPtr, AuthFormat), > FALSE, > - &VariablePtrTrack > + &VariablePtrTrack, > + AuthFormat > ); > if (!EFI_ERROR (Status) && VariablePtrTrack.CurrPtr->State =3D= =3D > VAR_ADDED) { > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, A= uthFormat); > 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, AuthFormat), > + GetVendorGuidPtr (Variable.CurrPtr, AuthFormat), > FALSE, > - &VariableInHob > + &VariableInHob, > + AuthFormat > ); > if (!EFI_ERROR (Status)) { > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, A= uthFormat); > continue; > } > } > @@ -642,7 +680,7 @@ VariableServiceGetNextVariableInternal ( > } > } >=20 > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, AuthForma= t); > } >=20 > 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); >=20 > - 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 (mVariableModule= Global- > >VariableGlobal.AuthFormat); >=20 > Status =3D gMmst->MmAllocatePool ( > EfiRuntimeServicesData, > -- > 2.16.2.windows.1