From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.1186.1571276528966384796 for ; Wed, 16 Oct 2019 18:42:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=aJ1ctNzo; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: michael.a.kubacki@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Oct 2019 18:42:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,305,1566889200"; d="scan'208";a="220966795" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 16 Oct 2019 18:42:07 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:42:07 -0700 Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:42:07 -0700 Received: from NAM05-BY2-obe.outbound.protection.outlook.com (104.47.50.59) by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 16 Oct 2019 18:42:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nZOuD9fuIqtnJZMbZxeN3EK5klDerAwcHF4RlrSSLcDfuPuF4xF9VgljtARJHydmjXqk7wKwpNXtBhm5Tgu1Kx+GKziRjN5PhunR19hxCTRC9HbC5Dh/iiXRa9hInO4aYPZrCBMYjP0tszvnqVHrDUh0JwBQ+nMG+pcC61wKk5ngM8ds8DArGt6DyIjo6MZbmSo9UV0dzx5cgrm9DIdhGQBrfwE2UG61QpAHEgm2vrUdUl/3UYm3qimIkEmYInaVJMx0UzJt4Lk+hu7x1xsyPowaT0aNNRHplEpe64il0FGwM4MNWlkURzNNXYFleCnBraQKgfyX1iW5+HRK9s6vZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2cor4P7BuV0Vl3lco5zQ0UsGCfiBV7XZwykR8nh+czI=; b=LSJw7HG+yUwkwV9PKxibvQ5WIXHchcjvu4+ld4TjbA75UEuIPJmMF+suOtlVpAePwGry/LhfkotwW/WRnGx4ScdxQIRdLXNZtlacsuAc1TzyBPm50keFG7fgR8vttglndc6GaMtVimNTl3wG/Nr6Snw+KXOb+hDitgtWQ4UjYqmQA2+NUdncP/Qa9j9pI/tj7xXD2HbZJhvVmuPJ6gcqGihanqFpEbWSWZFBCkECMhi0P8VGAexWVcoMzL+dApbP2Kv1eZSaE+AEO5w9w3TGInCgi8AG0aFsLpmGOdboGV96H1WKKHxPs+XFyS8Gp7Waf23ir+N/9vnp42XknhjVhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2cor4P7BuV0Vl3lco5zQ0UsGCfiBV7XZwykR8nh+czI=; b=aJ1ctNzo8ft68czqTJ8FZKR3vA5b+8WhMbH3yXvom40zcWmsAAKj+7WEmAqI3p23CNvEvXQGKwbneRm3hPZWSSeBdV7FUtT4gxdIRwvsFr9AXjvjT6EhMrRqgvyZla4T+Np6HVKSn0WorErBdOOkM/EGPmf1br699VlXRzzD22U= Received: from DM6PR11MB3834.namprd11.prod.outlook.com (20.179.17.87) by DM6PR11MB3466.namprd11.prod.outlook.com (20.176.123.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.19; Thu, 17 Oct 2019 01:41:49 +0000 Received: from DM6PR11MB3834.namprd11.prod.outlook.com ([fe80::21f7:6d8d:919b:d755]) by DM6PR11MB3834.namprd11.prod.outlook.com ([fe80::21f7:6d8d:919b:d755%6]) with mapi id 15.20.2347.023; Thu, 17 Oct 2019 01:41:49 +0000 From: "Kubacki, Michael A" To: "Wu, Hao 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/PSZKadeBe1AgAAL0ZA= Date: Thu, 17 Oct 2019 01:41:49 +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: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmQ4MWEyMTItNWY4ZC00M2RlLWI3MjktM2I3YWJmNjQ5ZDIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiTUVTV1J5TTFqWmZCSXluMlEwbWNzQlZzdnBrb1NhclVZdHZUVE01UUduQVN5MGJuMmw1MXhoaWQzQ1hlN1FmdSJ9 dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: spf=none (sender IP is ) smtp.mailfrom=michael.a.kubacki@intel.com; x-originating-ip: [134.134.136.217] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d22b7a3b-0ea4-4939-5982-08d752a32db1 x-ms-traffictypediagnostic: DM6PR11MB3466: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:451; x-forefront-prvs: 01930B2BA8 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(136003)(396003)(366004)(376002)(346002)(189003)(199004)(13464003)(76176011)(14444005)(14454004)(25786009)(256004)(110136005)(26005)(107886003)(7696005)(6116002)(3846002)(316002)(9686003)(54906003)(8936002)(7736002)(5660300002)(86362001)(8676002)(6246003)(74316002)(102836004)(6436002)(486006)(55016002)(30864003)(52536014)(99286004)(71190400001)(71200400001)(11346002)(2906002)(476003)(4326008)(76116006)(33656002)(66946007)(478600001)(446003)(64756008)(53546011)(66476007)(66556008)(66446008)(81166006)(66066001)(305945005)(81156014)(2501003)(186003)(6506007)(229853002)(569006);DIR:OUT;SFP:1102;SCL:1;SRVR:DM6PR11MB3466;H:DM6PR11MB3834.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YUm9IFMMHhDpM1c44J2jHVQ0L2XorRjjHIwkMvOpbQRPq6zJMA6Esg7MXEOeJz0dVnTUaLPVsi6UlFDdHq9rL+dEaERkB+651AxnUXc8udDmn1HmRqp8LdUCDPaE80aiC/U6g47qmXEToBa7UbyCFYJ5skhrArVWkbhogbJbdk3im+G1yylT14NMISEoHkPyk7Fm8OvNVUWoS7pvLOpQcEKmQSEKOP9d7rYPqd/QPviZ6ucpBgrjCoc74yAIAfJz/0KMs8fASkcuseIdipa18GPVqYX48X6iA83zgZMjGOjD4EjhIhEmQR5ssgqsrybTwUnTzB9fxDzYz2MgoWoCcGMToMmZJVVJ/sQ9zzBSTZTZ85bcFdwwtwy1h5ZKhOO7rwHg1Ad4g5mhJB2a7+2RxBNjQBD+z2DXvfy58mutFNM= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: d22b7a3b-0ea4-4939-5982-08d752a32db1 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Oct 2019 01:41:49.3770 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UriPnwUF/VM9NQv/Sl/8Y2IdXoFvdp37JlaxHVcIYzv9YwBTIbXTnbZ/NqCGQrDYIKtsgXbJc1m2iFx4/xg8fcXtarg+hr5ed+Cpu0uiEKw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3466 Return-Path: michael.a.kubacki@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Your threshold is slightly lower than mine for adding the local variable. M= y test plan is already done on this patch series. Do you consider this mandatory? Thanks, Michael > -----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 Ers= ek > ; 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 >=20 > > -----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 fi= le > > in favor of passing the authenticated variable status as a parameter to > > the variable parsing functions. >=20 >=20 > One general level comment: > In this patch some of the functions have introduced a local variable > 'AuthFormat' > to reduce the repetitive occurrence of: >=20 > mVariableModuleGlobal->VariableGlobal.AuthFormat >=20 > I would suggest to adopt this approach for all the functions that have 3 = or > more > of such repetitive occurrences. >=20 > Other than this, the patch looks good to me, > Reviewed-by: Hao A Wu >=20 > Best Regards, > Hao Wu >=20 >=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(-) > > > > 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 no= t 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 are = 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 are = 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 are = 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 are = 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 are = 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 searching= variable. > > @param[in, out] PtrTrack Variable Track Pointer structur= e that > > contains Variable Information. > > + @param[in] AuthFormat TRUE indicates authenticated va= riables > are > > used. > > + FALSE indicates authenticated v= ariables 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 should = be used > > to get the next variable. > > The maximum number of entries is the m= ax value of > > VARIABLE_STORE_TYPE. > > @param[out] VariablePtr Pointer to variable header address. > > + @param[in] AuthFormat TRUE indicates authenticated variables= are > > used. > > + FALSE indicates authenticated variable= s 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 spe= cially. > > // > > 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 (Variab= le), > > 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_A= DDED) { > > 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, AuthFor= mat)) { > > + Point0 =3D (VOID *) GetVariableNamePtr (AddedVariable, > AuthFormat); > > + 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 VariableS= ize; > > @@ -829,7 +840,13 @@ FindVariable ( > > PtrTrack->EndPtr =3D GetEndPointer (VariableStoreHeader[Type])= ; > > PtrTrack->Volatile =3D (BOOLEAN) (Type =3D=3D VariableStoreTypeVol= atile); > > > > - 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 (GetVariableHeaderSiz= e () > + > > VarNameSize + VarDataSize); > > + VariableEntry->VariableSize =3D HEADER_ALIGN ( > > + GetVariableHeaderSize ( > > + mVariableModuleGlobal->VariableG= lobal.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 variabl= e 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 c= ache. > > @@ -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 pas= sed 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 > DataSize > > && > > + (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 = Variable > > Header and Name. > > // From DataOffset of NextVariable is to save the existing var= iable > data. > > // > > - DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr); > > + DataOffset =3D GetVariableDataOffset (CacheVariable->CurrPtr, > > AuthFormat); > > BufferForMerge =3D (UINT8 *) ((UINTN) NextVariable + DataOffse= t); > > - 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 de= fault > > 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 variabl= e 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; > > > > // > > // BufferForMerge(from DataOffset of NextVariable) has include= d 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 (AuthFormat)= ; > > 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 an= d > > // NextVariable->DataSize should not include pad size so that variab= le > > // 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->NonVolatileLastVariableOffset, > > - (UINT32) GetVariableHeaderSize (), > > + (UINT32) GetVariableHeaderSize (AuthFormat), > > (UINT8 *) NextVariable > > ); > > > > @@ -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 (AuthF= ormat) > > ); > > > > 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), 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]; > > > > @@ -2364,6 +2405,8 @@ VariableServiceGetNextVariableName ( > > return EFI_INVALID_PARAMETER; > > } > > > > + AuthFormat =3D mVariableModuleGlobal->VariableGlobal.AuthFormat; > > + > > // > > // Calculate the possible maximum length of name string, including t= he > Null > > terminator. > > // > > @@ -2387,13 +2430,27 @@ VariableServiceGetNextVariableName ( > > VariableStoreHeader[VariableStoreTypeHob] =3D > > (VARIABLE_STORE_HEADER *) (UINTN) mVariableModuleGlobal- > > >VariableGlobal.HobVariableBase; > > VariableStoreHeader[VariableStoreTypeNv] =3D mNvVariableCache; > > > > - 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 > 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 - GetVariableHeaderSi= ze > > (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 *) (UINT= N) > > 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 (mVariableModuleGl= obal- > > >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 > 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 (mVariableModule= Global- > > >VariableGlobal.AuthFormat); > > } else if ((Attributes & EFI_VARIABLE_NON_VOLATILE) !=3D 0) { > > - *MaximumVariableSize =3D mVariableModuleGlobal->MaxVariableSize = - > > GetVariableHeaderSize (); > > + *MaximumVariableSize =3D mVariableModuleGlobal->MaxVariableSize= - > > + GetVariableHeaderSize (mVariableModule= Global- > > >VariableGlobal.AuthFormat); > > } else { > > - *MaximumVariableSize =3D mVariableModuleGlobal- > > >MaxVolatileVariableSize - GetVariableHeaderSize (); > > + *MaximumVariableSize =3D mVariableModuleGlobal- > > >MaxVolatileVariableSize - > > + GetVariableHeaderSize (mVariableModule= Global- > > >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, mVariableModuleGlob= al- > > >VariableGlobal.AuthFormat); > > VariableSize =3D (UINT64) (UINTN) NextVariable - (UINT64) (UINTN) > Variable; > > > > if (AtRuntime ()) { > > @@ -2820,10 +2889,11 @@ VariableServiceQueryVariableInfoInternal ( > > VariablePtrTrack.StartPtr =3D GetStartPointer (VariableStoreHe= ader); > > VariablePtrTrack.EndPtr =3D GetEndPointer (VariableStoreHe= ader); > > 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 ( > > } > > } > > > > - 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 (mVariableModuleGlo= bal- > > >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, mVariableModuleGlob= al- > > >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; > > > > 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), 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 va= riable. > > @@ -3418,7 +3504,12 @@ FlushHobVariableToFlash ( > > // If set variable successful, or the updated or deleted varia= ble 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 (mVa= riableModuleGlobal- > > >VariableGlobal.AuthFormat); > > Status =3D AuthVariableLibInitialize (&mAuthContextIn, > > &mAuthContextOut); > > if (!EFI_ERROR (Status)) { > > DEBUG ((EFI_D_INFO, "Variable driver will work with auth variabl= e > > support!\n")); > > @@ -3574,7 +3666,7 @@ ConvertNormalVarStorageToAuthVarStorage ( > > AuthVarStroageSize +=3D StartPtr->NameSize + GET_PAD_SIZE (Start= Ptr- > > >NameSize); > > AuthVarStroageSize +=3D StartPtr->DataSize + GET_PAD_SIZE (Start= Ptr- > > >DataSize); > > } > > - StartPtr =3D GetNextVariablePtr (StartPtr); > > + StartPtr =3D GetNextVariablePtr (StartPtr, mVariableModuleGlobal- > > >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.C= urrPtr); > > - AuthVariableInfo->Data =3D GetVariableDataPtr (Variable.C= urrPtr); > > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (Variable.C= urrPtr, > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > + AuthVariableInfo->Data =3D GetVariableDataPtr (Variable.C= urrPtr, > > 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 (VariablePt= r); > > - AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePtr)= ; > > - AuthVariableInfo->DataSize =3D DataSizeOfVariable (VariablePt= r); > > - AuthVariableInfo->Data =3D GetVariableDataPtr (VariablePt= r); > > + AuthVariableInfo->VariableName =3D GetVariableNamePtr (VariablePt= r, > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > + AuthVariableInfo->VendorGuid =3D GetVendorGuidPtr (VariablePtr, > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > + AuthVariableInfo->DataSize =3D DataSizeOfVariable (VariablePt= r, > > mVariableModuleGlobal->VariableGlobal.AuthFormat); > > + AuthVariableInfo->Data =3D GetVariableDataPtr (VariablePt= r, > > 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. > > > > + @param[in] AuthFormat TRUE indicates authenticated variables are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 are > used. > > + FALSE indicates authenticated variables ar= e 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 no= t 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 are = 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 are = 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 are = 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 are = 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 are = 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 searching= variable. > > @param[in, out] PtrTrack Variable Track Pointer structur= e that > > contains Variable Information. > > + @param[in] AuthFormat TRUE indicates authenticated va= riables > are > > used. > > + FALSE indicates authenticated v= ariables 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, AuthFormat)= !=3D 0); > > + if (CompareMem (VariableName, Point, NameSizeOfVariable > > (PtrTrack->CurrPtr, AuthFormat)) =3D=3D 0) { > > if (PtrTrack->CurrPtr->State =3D=3D (VAR_IN_DELETED_TRAN= SITION & > > 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 m= ax value of > > VARIABLE_STORE_TYPE. > > @param[out] VariablePtr Pointer to variable header address. > > + @param[in] AuthFormat TRUE indicates authenticated variables= are > > used. > > + FALSE indicates authenticated variable= s 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[StoreType= ]); > > Variable.Volatile =3D (BOOLEAN) (StoreType =3D=3D > VariableStoreTypeVolatile); > > > > - Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, &Varia= ble); > > + Status =3D FindVariableEx (VariableName, VendorGuid, FALSE, &Varia= ble, > > 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, AuthFor= mat); > > } > > > > 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, > 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, 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, > AuthFormat); > > continue; > > } > > } > > @@ -642,7 +680,7 @@ VariableServiceGetNextVariableInternal ( > > } > > } > > > > - Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr); > > + Variable.CurrPtr =3D GetNextVariablePtr (Variable.CurrPtr, AuthFor= mat); > > } > > > > 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 (mVariableModu= leGlobal- > > >VariableGlobal.AuthFormat); > > > > Status =3D gMmst->MmAllocatePool ( > > EfiRuntimeServicesData, > > -- > > 2.16.2.windows.1 >=20