From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web12.5375.1642382013908313819 for ; Sun, 16 Jan 2022 17:13:34 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=mTcjBrVX; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: dandan.bi@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642382013; x=1673918013; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=c0K/AILmgOwOqkeGCTzTI8QQSgnQV59KV1Uhq/TcY+I=; b=mTcjBrVXUvrmyeHThhBx2tMThFBwLULpJeG4hNofq0nFJEf+cPPDJpCU 80ItoPUrV8a1AS63D5wOJA8yKtuubAsAARKvhHQXHK6ndRIbBqKBxuqCz K3243nMHvKwP/CVkWMWfsjGlmKBgvXnrEik6wcKcw3jYq3Bjd/9pA+7vh XtymK2CYJk5V5Sy8OUMQtM+B2CX+YR+brwzMfvUpLfJPsBhqgSujn80BC TBtgzrQzk+TKerZ+gcXu8tO7SxeY9/RasQLVRNlINolDCNaVtuFiBuQv/ /6BCin+ZIgORI8FLSFTY6ZlJL+HIRx+1x2npBBD+YA5XwfOJWh/gWhTU/ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10229"; a="225211405" X-IronPort-AV: E=Sophos;i="5.88,294,1635231600"; d="scan'208";a="225211405" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jan 2022 17:13:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,294,1635231600"; d="scan'208";a="529892193" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga007.fm.intel.com with ESMTP; 16 Jan 2022 17:13:32 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sun, 16 Jan 2022 17:13:32 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sun, 16 Jan 2022 17:13:31 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Sun, 16 Jan 2022 17:13:31 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.171) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Sun, 16 Jan 2022 17:13:31 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mQrp5OexYBFimOz3TysYDOcjJOoLIMNYMJgA/VDKvzhdbrEjCMkuAU3uTSeAUrQtoxh/h8Nns+Xe7YKf0/1QXNHGI5dTbgIwPSgsIBwZXSxQX7XwmA1ljQ+zVvfTEsChmNvAc2VR+uLb70gBJkgeaH2a5AJLHermuLmNm2x1g3+/cqGs2VnCcrXyXOzX2bt/+r/CnGABZIkm8eHSvWumxw6erVYuzKCCPxAbnImVDAoVt78A1vAncOEfhtZqA1nAXmFiHZs0H/YN1+cMptv6k7OQlgJznNEGw79BnREv7j0u5pEXzROrkA29KE4U8Y/oF2ZnZQp8yAJMfjYvcofRUg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oouogU6r7xFUUBVgYtgBuLhcz464N5OKFOiMHosCERY=; b=Lz7g1qtHluSn/P9/jgd074bE9las+Uye6NH3NhExvmxvIT78Wt5PyR5RC84lydZ6g5FzSJVlDhR/zxb+7DpKqKBZUOuDc57ys5NKVlwufRTJ47WzZOb6F779wIEsSMHfLQNwvdOYLOCqOVQhbu62VD3Ic1SlUHdjPOOrRBpmxP/0NPVECwa9eVjGz575sViXIv4JOkIOlvVNWD2kudoD29xqfMSdG25aIVyS3QUzZIPLTkUGI3zGYPjpYYqQ3XDgHs0DXirVJk6svT4+ag7ASE4JtFiJVwZVJeT3OnJ/B5H1/fNf3qi70Gwg8DAnJwarHclQo92eI05A9AjkRDys0Q== 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 Received: from PH0PR11MB5928.namprd11.prod.outlook.com (2603:10b6:510:144::16) by MN2PR11MB3725.namprd11.prod.outlook.com (2603:10b6:208:f9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Mon, 17 Jan 2022 01:13:29 +0000 Received: from PH0PR11MB5928.namprd11.prod.outlook.com ([fe80::b003:4016:91be:20d7]) by PH0PR11MB5928.namprd11.prod.outlook.com ([fe80::b003:4016:91be:20d7%6]) with mapi id 15.20.4888.013; Mon, 17 Jan 2022 01:13:29 +0000 From: "Dandan Bi" To: "Huang, Long1" , "devel@edk2.groups.io" CC: "Feng, Bob C" , "Gao, Liming" , "Chen, Lin Z" , "Li, Zhuangzhi" Subject: Re: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for authenticated variable Thread-Topic: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for authenticated variable Thread-Index: AQHYB5L5xav2d7GRL0WrI42fM2OQUaxgbtbQgAYAu/A= Date: Mon, 17 Jan 2022 01:13:28 +0000 Message-ID: References: <802446c5bddb6e7de746d733c68d92c0e09e5ca8.1642007174.git.long1.huang@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 41863278-ee30-450d-ec61-08d9d9569221 x-ms-traffictypediagnostic: MN2PR11MB3725:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XT1qUAvI3Y6FlYztM3jgmmXnq0zl5KqU6UUuj2GhyAV4swsK9MzfzwTriH4emgiLGtcIYxSEoS544xTrAu6TJL7xygKvm8p06SO0NwNc7eHRBhM4x0DxoyZjYgZyfv7xfiktzxwHz5asChvmhutx81efZNfJVwMFE/1kbdMvtSMUXCJSrbVjpPONKcwPtsnKbau4v+Q0OIn7ypj/ypJ1//zB4Q1mjQu8BSQqYRrG8ltruk/L/xXwWVoASDhs+EH1OErCNZDA6j4roGt8zFAOcFpbCRMEbEFSpmRqC6Z4OrqdC0RjMCt+SLutqjTopzjOPtTm/+CJlrOsvdRTZiSZ0WumO/OPbFoDAAPTeYY25YNWpyaJY2mxTcTngC7a6SX4Zgdur+7bmA/68IK01RHi8AKfH3qjMh1DWeiXNUGEUyLZWS5fASeWO6WxJeyFeFoqIU/kdoev5NHX3tXQAe+rwCqZLvRKKmpaVhG7sYSKxbH4Q01cHoswXvunHBPtOgNDF9Bk38x98940SHcHZdeuDcJI5fRksCHRZ5xTxtZg97bTp/usUhKxa8sTSEXjJeymJ1TUL32cihViC5r7zv29TnWkyLSETOqAvSJwvmnikK72rF08jsP0SbbxRHi3O5b1QRdzMZ2fShjdo0aPejLeeVQIETfcp4j/L3t+0jMFGLDEy+jCfn1ptLcaO+orEWxiXsCJTuZDk31M9+97k7swq4Fo8HegYoRKwD5lStzc/WCkb8zl+0TRPhRSfYS1rWMaTWUZsaD9HCkD6ymDuxWepPEH2wR2Epp/ezWBtZ10wZA= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5928.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(508600001)(52536014)(9686003)(55016003)(86362001)(6506007)(53546011)(2906002)(5660300002)(107886003)(82960400001)(38070700005)(186003)(26005)(71200400001)(4326008)(30864003)(122000001)(38100700002)(83380400001)(66946007)(76116006)(54906003)(33656002)(316002)(110136005)(8936002)(7696005)(8676002)(66476007)(66446008)(64756008)(66556008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n6nxyOfk1fJTH7+E3SB96eN+okt18cvPWtO2FH5BZx4Gvctlblh04buX5lWc?= =?us-ascii?Q?rWjPXVqfI0x2WZWlJHCZwEiQnJdOBGsREG+kgqKjFsHrAFcS2AZKP4huWvka?= =?us-ascii?Q?0sfWfRaHwP+b04+5phhQhvG4TCMeIN3mK8XiaFfMxE95gNKXlFk9eFafPTY2?= =?us-ascii?Q?D6MtvXUbrveSaH6hX38c0mXC/Fzv0jd2hPczT2wD/ll/fDUpLZs/56FFD/26?= =?us-ascii?Q?SLl7aH75vrfs0uCMXoblb30+dUN0NLhxtNa+PokNK6lb3Pri+v8GYxJTljxG?= =?us-ascii?Q?OTcCcNK2FqE5hVk5hgY4e73TbUQUUCTZRDEezDoDs9JITErh1vhAIspHtRb0?= =?us-ascii?Q?U42iYep80GA1jwXJ6jMeVwm9iJJk1uQWJHpZ8zp1qYkAHl/opW8n8Dt2X2cs?= =?us-ascii?Q?kDUNmeWEx4bBaUj3Dov2CPdb6hveWS7Om962rSE7UMds7Xh6cIMX6dkHzGxH?= =?us-ascii?Q?bPrUA1aS98lH3an7h1KgRu8xwTmY5kh8oqt0DpBKIEMoj+YNtDKTKFgGSw90?= =?us-ascii?Q?hZdu6xNcwO9gfiaB1ivFnNZY/R39/VIYmS65slHBn9uItodWJqNrnQA0qsut?= =?us-ascii?Q?gUmSIGrmM73lTAw4AEcxKXq2XrTyB899WtECF0eOZ8BZ0MjaTBTsMQiVFHwd?= =?us-ascii?Q?kVlTACedRUa9XSdubtuoJzeoUMC13kzK/JVCBqkV0jRzizhyv1cNB4LGe7ds?= =?us-ascii?Q?m40PM93FAcLP76AfnByWBIOsGQvp7L8Pe0/bXW68HLPLq592oprPfTOZ2ezJ?= =?us-ascii?Q?745LKo/Iwhv1bhDEhlhx4rYN7WTBDqIePcCwq8qDYPBqXCNeo/s2DgNvdNlZ?= =?us-ascii?Q?lMErlasgVtJfkI7sfy1eVGUATcsYIt5B/EW+bXtX9u2x1VdN1YBc9bkS8N62?= =?us-ascii?Q?fWUUYGyExIcwwEgLOOX3Pp4oyBSehjw32IulYC760E5bbsc1/AgDgTPa/Idv?= =?us-ascii?Q?xd6XQMoYnO6q37nE6kmVaFRMu/uoKxQrCb+iT+1AzooEAxJH+/qSBQsFJQqf?= =?us-ascii?Q?O7sTNceSPW3yWS7855gGzQwpSNdLOMwCq7l+Y2hd031OPzAu4b2LNyOUSUzr?= =?us-ascii?Q?rypQflvzku0S+7iGSNCvAv+/sSJRwa5UrFqKtdYfGCF6vqKa/znM/txOTt95?= =?us-ascii?Q?bpvkBKNcCykHBjZ5nI0KKY2HDQTv4l4GIOtsE/g+IMTvoE0NFpmwx4yh4Fo5?= =?us-ascii?Q?K9i3SqIIpw3f6aMlSgyvttkwUzv71dfClsymVkd7In9mBQ3YHFzX2YCkCBAU?= =?us-ascii?Q?cFzokRwX8me4Bx/PM1ydDbOcZIbJaJurnp7t3tNNu3BuQ35nCEMZlenPn6RO?= =?us-ascii?Q?eDrPSywTHeriAq4zx7wOQa+AVg/VQihwDYugvdUXaOA1aET+oR0Qh/6JbftT?= =?us-ascii?Q?q9duHRIY/T4Fz/3PIzZzVwKgEGtdchWdHtST2YKZpwVOxu0jmCZZyrZ77vtB?= =?us-ascii?Q?kuDFi6N1Vv9lYs8K0JBm62fjP2NGnpkYdu+THcoKm5ghrZGB5OkjfT3f8Sr7?= =?us-ascii?Q?tsfvFubMeztexksTyEorfABqdXrUBoYVA+hr49OnMTOU82dkkr9QQhsSBKAZ?= =?us-ascii?Q?o+AmGTVSlladqSZGP2d+o0DoXngdBAY9Cg+PKv8QZzri1VL60q4vBmTeQSPI?= =?us-ascii?Q?qQ=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5928.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 41863278-ee30-450d-ec61-08d9d9569221 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jan 2022 01:13:29.0341 (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: hdTsatmawjw5ezDfhjk9aYz/UewLU0W+kutwQjQhkWzynmU9z6F+lTpwFR/QuEbg0CunAC7IH+h95eEe/Z4EeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3725 Return-Path: dandan.bi@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I will push this patch today if no other comment. Thanks, Dandan > -----Original Message----- > From: Bi, Dandan > Sent: Thursday, January 13, 2022 1:35 PM > To: Huang, Long1 ; devel@edk2.groups.io > Cc: Feng, Bob C ; Gao, Liming > ; Chen, Lin Z ; Li, > Zhuangzhi > Subject: RE: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for > authenticated variable >=20 > The change is ok to me. Reviewed-by: Dandan Bi >=20 > Hi Liming, >=20 > Could you also help review it? >=20 >=20 > Thanks, > Dandan > > -----Original Message----- > > From: Huang, Long1 > > Sent: Thursday, January 13, 2022 1:06 AM > > To: devel@edk2.groups.io > > Cc: Huang, Long1 ; Feng, Bob C > > ; Gao, Liming ; Bi, > > Dandan ; Chen, Lin Z ; Li, > > Zhuangzhi > > Subject: [PATCH] MdeModulePkg/HiiDatabaseDxe: Add Support for > > authenticated variable > > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D3796 > > > > Database.c: > > 1. Replace PcdGetExPtr with PcdGetExPtr. > > 2. Add FindAuthVariableData function to parse authenticated > variable > > type for getting a correct default value in > > PcdNvStoreDefaultValueBuffer. > > > > Signed-off-by: Huang Long > > > > Cc: Bob Feng > > Cc: Liming Gao > > Cc: Dandan Bi > > Cc: Lin Z Chen > > Cc: Zhuangzhi Li > > --- > > .../Universal/HiiDatabaseDxe/Database.c | 130 ++++++++++++++---- > > .../HiiDatabaseDxe/HiiDatabaseDxe.inf | 3 + > > 2 files changed, 105 insertions(+), 28 deletions(-) > > > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c > > b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c > > index 0b09c24d52..c7a92d6aed 100644 > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c > > @@ -603,6 +603,45 @@ FindVariableData ( > > return NULL; > > > > } > > > > > > > > +/** > > > > + Find the matched authenticated variable from the input variable stor= age. > > > > + > > > > + @param[in] VariableStorage Point to the variable storage header. > > > > + @param[in] VarGuid A unique identifier for the variable. > > > > + @param[in] VarAttribute The attributes bitmask for the variable. > > > > + @param[in] VarName A Null-terminated ascii string that is th= e name > of > > the variable. > > > > + > > > > + @return Pointer to the matched variable header or NULL if not found. > > > > +**/ > > > > +AUTHENTICATED_VARIABLE_HEADER * > > > > +FindAuthVariableData ( > > > > + IN VARIABLE_STORE_HEADER *VariableStorage, > > > > + IN EFI_GUID *VarGuid, > > > > + IN UINT32 VarAttribute, > > > > + IN CHAR16 *VarName > > > > + ) > > > > +{ > > > > + AUTHENTICATED_VARIABLE_HEADER *AuthVariableHeader; > > > > + AUTHENTICATED_VARIABLE_HEADER *AuthVariableEnd; > > > > + > > > > + AuthVariableEnd =3D (AUTHENTICATED_VARIABLE_HEADER *)((UINT8 > > *)VariableStorage + VariableStorage->Size); > > > > + AuthVariableHeader =3D (AUTHENTICATED_VARIABLE_HEADER > > *)(VariableStorage + 1); > > > > + AuthVariableHeader =3D (AUTHENTICATED_VARIABLE_HEADER > > *)HEADER_ALIGN (AuthVariableHeader); > > > > + while (AuthVariableHeader < AuthVariableEnd) { > > > > + if (CompareGuid (&AuthVariableHeader->VendorGuid, VarGuid) && > > > > + (AuthVariableHeader->Attributes =3D=3D VarAttribute) && > > > > + (StrCmp (VarName, (CHAR16 *)(AuthVariableHeader + 1)) =3D=3D 0= )) > > > > + { > > > > + return AuthVariableHeader; > > > > + } > > > > + > > > > + AuthVariableHeader =3D (AUTHENTICATED_VARIABLE_HEADER *)((UINT8 > > *)AuthVariableHeader + sizeof (AUTHENTICATED_VARIABLE_HEADER) + > > AuthVariableHeader->NameSize + AuthVariableHeader->DataSize); > > > > + AuthVariableHeader =3D (AUTHENTICATED_VARIABLE_HEADER > > *)HEADER_ALIGN (AuthVariableHeader); > > > > + } > > > > + > > > > + return NULL; > > > > +} > > > > + > > > > /** > > > > Find question default value from PcdNvStoreDefaultValueBuffer > > > > > > > > @@ -626,25 +665,29 @@ FindQuestionDefaultSetting ( > > IN BOOLEAN BitFieldQuestion > > > > ) > > > > { > > > > - VARIABLE_HEADER *VariableHeader; > > > > - VARIABLE_STORE_HEADER *VariableStorage; > > > > - LIST_ENTRY *Link; > > > > - VARSTORAGE_DEFAULT_DATA *Entry; > > > > - VARIABLE_STORE_HEADER *NvStoreBuffer; > > > > - UINT8 *DataBuffer; > > > > - UINT8 *BufferEnd; > > > > - BOOLEAN IsFound; > > > > - UINTN Index; > > > > - UINT32 BufferValue; > > > > - UINT32 BitFieldVal; > > > > - UINTN BitOffset; > > > > - UINTN ByteOffset; > > > > - UINTN BitWidth; > > > > - UINTN StartBit; > > > > - UINTN EndBit; > > > > - PCD_DEFAULT_DATA *DataHeader; > > > > - PCD_DEFAULT_INFO *DefaultInfo; > > > > - PCD_DATA_DELTA *DeltaData; > > > > + VARIABLE_HEADER *VariableHeader; > > > > + AUTHENTICATED_VARIABLE_HEADER *AuthVariableHeader; > > > > + VARIABLE_STORE_HEADER *VariableStorage; > > > > + LIST_ENTRY *Link; > > > > + VARSTORAGE_DEFAULT_DATA *Entry; > > > > + VARIABLE_STORE_HEADER *NvStoreBuffer; > > > > + VOID *ValueSource; > > > > + VOID *BitValueSource; > > > > + UINT8 *DataBuffer; > > > > + UINT8 *BufferEnd; > > > > + BOOLEAN AuthFormat; > > > > + BOOLEAN IsFound; > > > > + UINTN Index; > > > > + UINT32 BufferValue; > > > > + UINT32 BitFieldVal; > > > > + UINTN BitOffset; > > > > + UINTN ByteOffset; > > > > + UINTN BitWidth; > > > > + UINTN StartBit; > > > > + UINTN EndBit; > > > > + PCD_DEFAULT_DATA *DataHeader; > > > > + PCD_DEFAULT_INFO *DefaultInfo; > > > > + PCD_DATA_DELTA *DeltaData; > > > > > > > > if (gSkuId =3D=3D 0xFFFFFFFFFFFFFFFF) { > > > > gSkuId =3D LibPcdGetSku (); > > > > @@ -666,7 +709,7 @@ FindQuestionDefaultSetting ( > > } > > > > > > > > if (Link =3D=3D &gVarStorageList) { > > > > - DataBuffer =3D (UINT8 *)PcdGetPtr (PcdNvStoreDefaultValue= Buffer); > > > > + DataBuffer =3D (UINT8 *)PcdGetExPtr > > (&gEfiMdeModulePkgTokenSpaceGuid, PcdNvStoreDefaultValueBuffer); > > > > gNvDefaultStoreSize =3D ((PCD_NV_STORE_DEFAULT_BUFFER_HEADER > > *)DataBuffer)->Length; > > > > // > > > > // The first section data includes NV storage default setting. > > > > @@ -750,12 +793,27 @@ FindQuestionDefaultSetting ( > > return EFI_NOT_FOUND; > > > > } > > > > > > > > + // > > > > + // Judge if the variable type is authenticated, default is false > > > > + // > > > > + AuthFormat =3D FALSE; > > > > + if (CompareGuid (&VariableStorage->Signature, > > &gEfiAuthenticatedVariableGuid)) { > > > > + AuthFormat =3D TRUE; > > > > + } > > > > + > > > > // > > > > // Find the question default value from the variable storage > > > > // > > > > - VariableHeader =3D FindVariableData (VariableStorage, > > &EfiVarStore->Guid, > > EfiVarStore->Attributes, (CHAR16 *)EfiVarStore->Name); > > > > - if (VariableHeader =3D=3D NULL) { > > > > - return EFI_NOT_FOUND; > > > > + if(AuthFormat) { > > > > + AuthVariableHeader =3D FindAuthVariableData (VariableStorage, > > &EfiVarStore->Guid, EfiVarStore->Attributes, (CHAR16 *)EfiVarStore- > > >Name); > > > > + if (AuthVariableHeader =3D=3D NULL) { > > > > + return EFI_NOT_FOUND; > > > > + } > > > > + } else { > > > > + VariableHeader =3D FindVariableData (VariableStorage, > > + &EfiVarStore->Guid, > > EfiVarStore->Attributes, (CHAR16 *)EfiVarStore->Name); > > > > + if (VariableHeader =3D=3D NULL) { > > > > + return EFI_NOT_FOUND; > > > > + } > > > > } > > > > > > > > StartBit =3D 0; > > > > @@ -770,8 +828,24 @@ FindQuestionDefaultSetting ( > > Width =3D EndBit / 8 + 1; > > > > } > > > > > > > > - if (VariableHeader->DataSize < ByteOffset + Width) { > > > > - return EFI_INVALID_PARAMETER; > > > > + if (AuthFormat) { > > > > + if (AuthVariableHeader->DataSize < ByteOffset + Width) { > > > > + return EFI_INVALID_PARAMETER; > > > > + } > > > > + > > > > + ValueSource =3D (UINT8 *)AuthVariableHeader + sizeof > > (AUTHENTICATED_VARIABLE_HEADER) + AuthVariableHeader->NameSize > + > > IfrQuestionHdr->VarStoreInfo.VarOffset; > > > > + if (BitFieldQuestion) { > > > > + BitValueSource =3D (UINT8 *)AuthVariableHeader + sizeof > > (AUTHENTICATED_VARIABLE_HEADER) + AuthVariableHeader->NameSize > + > > ByteOffset; > > > > + } > > > > + } else { > > > > + if (VariableHeader->DataSize < ByteOffset + Width) { > > > > + return EFI_INVALID_PARAMETER; > > > > + } > > > > + > > > > + ValueSource =3D (UINT8 *)VariableHeader + sizeof (VARIABLE_HEADER) > > + + > > VariableHeader->NameSize + IfrQuestionHdr->VarStoreInfo.VarOffset; > > > > + if (BitFieldQuestion) { > > > > + BitValueSource =3D (UINT8 *)VariableHeader + sizeof > > + (VARIABLE_HEADER) > > + VariableHeader->NameSize + ByteOffset; > > > > + } > > > > } > > > > > > > > // > > > > @@ -779,11 +853,11 @@ FindQuestionDefaultSetting ( > > // > > > > if (ValueBuffer !=3D NULL) { > > > > if (BitFieldQuestion) { > > > > - CopyMem (&BufferValue, (UINT8 *)VariableHeader + sizeof > > (VARIABLE_HEADER) + VariableHeader->NameSize + ByteOffset, Width); > > > > + CopyMem (&BufferValue, BitValueSource, Width); > > > > BitFieldVal =3D BitFieldRead32 (BufferValue, StartBit, EndBit); > > > > CopyMem (ValueBuffer, &BitFieldVal, Width); > > > > } else { > > > > - CopyMem (ValueBuffer, (UINT8 *)VariableHeader + sizeof > > (VARIABLE_HEADER) + VariableHeader->NameSize + IfrQuestionHdr- > > >VarStoreInfo.VarOffset, Width); > > > > + CopyMem (ValueBuffer, ValueSource, Width); > > > > } > > > > } > > > > > > > > @@ -832,7 +906,7 @@ UpdateDefaultSettingInFormPackage ( > > // If no default setting, do nothing > > > > // > > > > if (gNvDefaultStoreSize =3D=3D 0) { > > > > - gNvDefaultStoreSize =3D PcdGetSize (PcdNvStoreDefaultValueBuffer); > > > > + gNvDefaultStoreSize =3D PcdGetExSize > > (&gEfiMdeModulePkgTokenSpaceGuid, PcdNvStoreDefaultValueBuffer); > > > > } > > > > > > > > if (gNvDefaultStoreSize < sizeof > > (PCD_NV_STORE_DEFAULT_BUFFER_HEADER)) { > > > > diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf > > b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf > > index 0116fb6ecb..dac4d614a8 100644 > > --- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf > > +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf > > @@ -86,6 +86,9 @@ > > gEfiHiiImageDecoderNameJpegGuid > > |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## > > SOMETIMES_CONSUMES ## GUID > > > > gEfiHiiImageDecoderNamePngGuid > > |gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol ## > > SOMETIMES_CONSUMES ## GUID > > > > gEdkiiIfrBitVarstoreGuid = ## > > SOMETIMES_CONSUMES ## GUID > > > > + gEfiAuthenticatedVariableGuid > > > > + gEfiVariableGuid > > > > + gEfiMdeModulePkgTokenSpaceGuid > > > > > > > > [Depex] > > > > TRUE > > > > -- > > 2.25.1