From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web09.25956.1664177826158236910 for ; Mon, 26 Sep 2022 00:37:07 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=cmRqF0V6; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: heng.luo@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664177826; x=1695713826; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=xlmaNeDRviDa8tz3LMqXJc9dopTXSJNIGZ3QVgh6MfQ=; b=cmRqF0V6MwW8M60MGsaQ6bMU5cS9frFmahpDbeCsn7tNMIcGWHj7PsYm vfMSmQgr+fLZBdki0irVxS5qjhvmbai51K63/8N/K25NTBrcCZMspMJjt 4DlWLgzrkt7SVghndja4CYd4uiCY3kPtwapON6fscGRXM5acQBQxeUrqj U9J6uV/MFpIa0d09zNfihFfhP57KO7culwqWn5QZ+50xJu6xrc+5DQmhO sqiC5s1iY6zmD2Pq/I1sGV/m7ka93T1YuYN2zr1wAmTdDUuH5Obrr+IfE Zq/7jxx+prHyt+FdvsePeoto5aV/0jiO+knx5FB52g2+KkKzl6oJo0YRy Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10481"; a="300946085" X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="300946085" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2022 00:37:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10481"; a="763343037" X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="763343037" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga001.fm.intel.com with ESMTP; 26 Sep 2022 00:37:05 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 26 Sep 2022 00:37:05 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 26 Sep 2022 00:37:05 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.42) 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.2375.31; Mon, 26 Sep 2022 00:37:04 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdpRxgdMDEiD3VgJAVZoc2c/5fQiZ50nsd3mwzejD7hNgwDXXCGRZez+4BM14b5ocH7GxQ5Rc2YUcmJKZ92tOcseim1V1gj2eCS9iRcOItbZqZnuHyb4KXAjbO36BnV3bCoXoNC4oSF5tLS5H8sRFxScrHNoSX+2WKJxdAkwOtzdZgBSzxjzVhn9qHETXpJ6kBI3PYTiSwA+CAHyVETrmPDaR23eU8JhtL15MPHdMOqg89dQ7CbDz+66hFCXw4ZHSl90OsHEjDWqBwkerlnREKP1Qc1mTrOYoDg+xcyrcqzvf5+Re28xo65sW8cX2kMa9NBusgzZ9uZYLJBeOy7r8Q== 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=gUFu61U7bJKrUC88z8tEKZYuXBfLV71s9oU0+If5DeA=; b=cQWJVx4MS422hz9xhC2mucIzcR+r5q46vuCmXK1GzS9rhAkPlwjDZlIyXdgcOlrab9/2rGIz5gu/lZzKGbKauUIusoEGQ90vVqOjAxV97Ao22URCulxqk9i5z7lCzoL6qlDcmdHHPFMWtRud9j9DIKlsF9F/H+t1UcOmltQhuUkN2vT21ujULYStTul6YPmO1xEOXhqK7uaMGasuJ/mq46bPN1jRRLEip8u9yzxuBUBeNHBo22KLpS2Bq/X8e5g8V0bho9cF6s6NN+sH+SEQKqdfJ4NvOeothUopmW1NHG5yER1movohruGK5qw4Utbzs4qy0UgIokcRxK68CXnqIA== 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 SN6PR11MB2752.namprd11.prod.outlook.com (2603:10b6:805:59::31) by CH3PR11MB7203.namprd11.prod.outlook.com (2603:10b6:610:148::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.24; Mon, 26 Sep 2022 07:37:02 +0000 Received: from SN6PR11MB2752.namprd11.prod.outlook.com ([fe80::2891:b96f:4eea:87eb]) by SN6PR11MB2752.namprd11.prod.outlook.com ([fe80::2891:b96f:4eea:87eb%4]) with mapi id 15.20.5654.025; Mon, 26 Sep 2022 07:37:01 +0000 From: "Heng Luo" To: "devel@edk2.groups.io" , "Clark-williams, Zachary" CC: Zachary Clark-Williams , Maciej Rabeda Subject: Re: [edk2-devel] [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Topic: [edk2-devel] [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Index: AQHYyHKp57YhAoW3JEO7+8a+4lgD/a3xYswQ Date: Mon, 26 Sep 2022 07:37:01 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR11MB2752:EE_|CH3PR11MB7203:EE_ x-ms-office365-filtering-correlation-id: d2dad58f-b8c1-4750-ac25-08da9f91e6c2 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ZHIjNVXfiSwMDKSJUF5A7Xdg9fyPU0Swh59UTMf85BUdTvn//BqcJGWlpMf5txN98UGqhV8qQDmh/Zs+i+yUGhLEWg49lVZJp13trQM72y5gZVlmXdgrxt8vTE62ZY1YUp2Pgd/54jHlKDWsJnC9iAoAxLbCVcRk9Vlg/KbFx5nBeiMUoJD6RezWBKkRDAINjeJZhYuGZ2P+lLwiprm7QEQkBAfv5Mn37Jq4siP66NLnNqNBkU7FfTto9N4XoJAiyOxHPE3gXZXWgKA4EOBeAXeimNaJiKKoe101y4an4uF5Q42yvAKb/p2/fkYhv3bekCaleNnM2KIBTSUgefp7lRzjQtIAvK3b+/kBps6Z2oaipVEc6065ykIF01hnTnjfys9BI3kEFMc6k81PEB+Sp0sLBbH3KW1iYqn4/YKHsVl1MOlj05876Xj4bESjcpE1ai3r4lLNW+SxyExOF9V+2G029qklIvNko3aFjk3K7DeLIu4AGIYathFeVp2nVdIgRPhjwH48i4aEog6F5zBSBpFN6IhCMJR4D2+UeRDAolus5SFGxpW/hgvUdYoJiL1Lt54B+HQFoA9pJ1abld3wqL8Fr18N4EPe7bAIWX1+tRBYXr5zLHYrjJlZ7/O6jlficimNbARoe3upQxbSDvba2FlGV+tOGafeHwg8HW6YBn/IqMrhWsKdU4KY/GJ3NHAqpMvdxG0wzab+bFrWND6LgEPWyjcCr7dV3MQCi2npd6Q6LshcCRzkex3TAKjVmECL2jTqE6Ax7pt9rjymlXGZhyynXXxDShdy7fiIcdzzo5ehmTHzGQ3NKlUZIjdE+YwWWtVE9H5CPYRmmZc885FTnkFa445FX/jSU7RFo/WfqnY= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2752.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(6029001)(376002)(346002)(39860400002)(366004)(136003)(396003)(451199015)(38100700002)(83380400001)(2906002)(966005)(82960400001)(19627235002)(41300700001)(316002)(38070700005)(6636002)(54906003)(66476007)(66946007)(66556008)(76116006)(478600001)(66446008)(64756008)(8676002)(4326008)(55016003)(186003)(53546011)(26005)(7696005)(9686003)(110136005)(6506007)(33656002)(86362001)(71200400001)(30864003)(8936002)(52536014)(5660300002)(122000001)(559001)(579004)(44824005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BqhfjeXABz9C1CfiEyVYNNZYwPzzTvWe/O6J85rZajpJIAeHrAMMRFmuBGFn?= =?us-ascii?Q?XRKg8cdHYp0d0aZ3O4T8SGyRj0WZRM2XCIR1UsNw54/rGHFn6k9n1KZe9Qd9?= =?us-ascii?Q?Nlfsyf219Fe82heU3BmGxZXTO7578tkyqUpPZi4vLVuGF1D70tupCI9u0Pal?= =?us-ascii?Q?sTWZXI/sG/2PbD0lIypXkrX6f69xiUVXOKQ1q0Ft6flixH9hi6xgkQPupQnU?= =?us-ascii?Q?lpz+hrkZcwuDjmiNrk5XSOFcrrgkRyyeCJvxlVjwZZKsULGTudG7GuWDPPIU?= =?us-ascii?Q?TLupg/fhG+MFCesO8FpLTg909ATcHtneWqR6mOk678/5NyIDgAg3GxxFjv4f?= =?us-ascii?Q?+Yq2AM+zCmKBho6+wDYi9PWOUaeBCl77NP+iWfWm4xU5EHA3Emr3X406UuAh?= =?us-ascii?Q?ZjNtpAie3AWnhiX2C8GVoOTh/s8cdNdkhTLfSg3whqMfX/ozoPNkR7p2rJDf?= =?us-ascii?Q?MKIb0VsYsCULQY0lUqGyC/G1hzRGqwuYuYlMXls9ycHI8xG/Wyc8ML4DDZAp?= =?us-ascii?Q?MBvF1l6g71GX39MuJ4Rlr3N7Fg6AwMrjO9Ru8fBPk/bVBuUFMZrOaerUO2c2?= =?us-ascii?Q?soCOJwyaxLmwAGVrBjkiVeC1QP8WMY3oks6+r29YhgDRu5ujxcPW+JLR2p1r?= =?us-ascii?Q?bAjcn3HyshcGyyKEeY+HJVASDtX4sjkUDzZtEqBBvOre+B3g3j0RRNIQuzuL?= =?us-ascii?Q?WmlQ6OHF3CAVJV2s1dJxxYvu7jy0i/ZDCGqty8N/0yAYTyQOhX8he13Ehdkd?= =?us-ascii?Q?TGgRMCVwMML3rae1cRV4JCZWyKCCL1sdpEqSgGnWutoTMfhj7Ar3qdyG4rnI?= =?us-ascii?Q?/FGbEMhipSCmZ86Q06igDndsRR/sLzx0UoJslbWmHvpnno2OAkJCUpNoBMcO?= =?us-ascii?Q?cvJ00qwgy3gEf+sVo0CNzey1QLmFwynpXWwmb79twPyMvB319eYKcLqLcF8z?= =?us-ascii?Q?6VYhWD/CYhDFXxx30y5oA0RpUVXw4oTUiBT+Y8D3pK2WzBtL6ApAWcX2fAw4?= =?us-ascii?Q?wdgLkgIYlBvHRXkIoUZDZeqy7Dt8w9PUHDNGQTAx9fZN97hUiYcVNb8Rr3Nw?= =?us-ascii?Q?xDC7xzEkZp6493S/bK9LCQ3GPKSdMSOPGSC7mrpRk/kqDts7iAZQdMi0vit+?= =?us-ascii?Q?czEdXZwlPeb3No/iX+F2ZkA9vDsW3HG4dPvK1Fb/Iz4pFnEBVu0sq2ZOZQ0h?= =?us-ascii?Q?YQD4NBUDIIa0Wma5V55Qg3uDodMb6rogXIpw4+Cyxg6WxL12NBtNl4+oSUFn?= =?us-ascii?Q?tiE2Nwx8/e9q5rEjl8/delLpv5V97ist2L4TqtPF2qSIWpo34no7KP7vKJor?= =?us-ascii?Q?JxwceTSsCDdglruRP9AAUbxXirOntwmz4icAe4wdls/+Su0oEtUBRMKBsDbh?= =?us-ascii?Q?Ns2X1AI58b2cHSrS30bMjcG0dYRjkBJijy7zUi1oKiw3sdrzPgbQQ+8J0lw8?= =?us-ascii?Q?24BjvS+MJSMpjIarMEuYLYerG5IQ4hOJXS2hTW11RkWPtSNye+4/aoqQmSWI?= =?us-ascii?Q?wXaWtWZraEZv4fssm0ShmAyfINppBcrOhf/l1jyXX1P7t6E2jgRC1XZ4HnxI?= =?us-ascii?Q?fXlejFA7+ari2JWan3BB185fCeBXHW2YIKF0YYz8?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR11MB2752.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2dad58f-b8c1-4750-ac25-08da9f91e6c2 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2022 07:37:01.6782 (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: Jtgs1Z+NRhdzYC8xIbXLi6B5XtAHtAzQHtoSTlxhnvGCMLLqPvS/44AN/ezRi4XHQclF4CrHKTHf7yNFbvW2Kw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR11MB7203 Return-Path: heng.luo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Zachary, > @@ -420,22 +422,34 @@ WifiMgrConfigPassword ( > // > // Set password to supplicant > // > + if (Profile->Password[StrLen (Profile->Password)] !=3D '\0') { > + Profile->Password[StrLen (Profile->Password)] =3D L'\0'; } > + I don't understand this change, StrLen returns the length of a Null-termina= ted Unicode string, it means "Profile->Password[StrLen (Profile->Password)]= " should always be 0. Did you see exceptional case? Thanks, Heng > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Clark- > williams, Zachary > Sent: Thursday, September 15, 2022 3:43 AM > To: devel@edk2.groups.io > Cc: Zachary Clark-Williams ; Clark-williams, Zachar= y > > Subject: [edk2-devel] [PATCH] NetworkPkg: Add WiFi profile sync protocol > support >=20 > From: Zachary Clark-Williams >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3845 >=20 > Enables KVM and One Click Recovery WLAN capability with WiFi Profile Sync > feature and protocol. Adding WiFiProfileSyncProtocol, which supports the > profilesync driver operations for transferring WiFi profiles from AMT to = the > Supplicant. WiFiConnectionManager will check for the > WifiProfileSyncProtocol and if found will operate on the premise of a One > Click Recovery, or KVM flow with a Wifi profile provided by AMT. >=20 > Signed-off-by: Zachary Clark-Williams > --- > .../Protocol/WiFiProfileSyncProtocol.h | 83 ++++++++ > NetworkPkg/NetworkPkg.dec | 3 + > .../WifiConnectionManagerDxe.inf | 3 +- > .../WifiConnectionMgrDriver.c | 126 +++++++---- > .../WifiConnectionMgrDxe.h | 4 +- > .../WifiConnectionMgrImpl.c | 197 ++++++++++++++++-- > .../WifiConnectionMgrMisc.c | 13 ++ > 7 files changed, 370 insertions(+), 59 deletions(-) create mode 100644 > NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h >=20 > diff --git a/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > b/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > new file mode 100644 > index 0000000000..e36daceabf > --- /dev/null > +++ b/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h > @@ -0,0 +1,83 @@ > +/** @file > + WiFi profile sync protocol. Supports One Click Recovery or KVM OS > +recovery > + boot flow over WiFi. > + > + Copyright (c) 2022, Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent **/ > + > +#ifndef WIFI_PROFILE_SYNC_PROTOCOL_H_ > +#define WIFI_PROFILE_SYNC_PROTOCOL_H_ > + > +#include > + > +// > +// WiFi Profile Sync Protocol GUID variable. > +// > +extern EFI_GUID gEfiWiFiProfileSyncProtocolGuid; > + > +/** > + Used by the WiFi connection manager to get the WiFi profile that AMT > +shared > + and was stored in WiFi profile protocol. Aligns the AMT WiFi profile > +data to > + the WiFi connection manager profile structure fo connection use. > + > + @param[in, out] WcmProfile WiFi Connection Manager profile > structure > + @param[in, out] MacAddress MAC address from AMT saved to NiC > MAC address > + > + @retval EFI_SUCCESS Stored WiFi profile converted and re= turned > succefully > + @retval EFI_UNSUPPORTED Profile protocol sharing not support= ed or > enabled > + @retval EFI_NOT_FOUND No profiles to returned > + @retval Others Error Occurred > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *WIFI_PROFILE_GET)( > + IN OUT WIFI_MGR_NETWORK_PROFILE *Profile, > + IN OUT EFI_80211_MAC_ADDRESS MacAddress > + ); > + > +/** > + Saves the WiFi connection status recieved by the > +WiFiConnectionManager when > + in a KVM OR One Click Recovery WLAN recovery flow. Input as > + EFI_80211_CONNECT_NETWORK_RESULT_CODE then converted and > stored as EFI_STATUS type. > + > + @param[in] ConnectionStatus WiFi connection attempt results > +**/ > +typedef > +VOID > +(EFIAPI *WIFI_SET_CONNECT_STATE)( > + IN EFI_80211_CONNECT_NETWORK_RESULT_CODE ConnectionStatus > + ); > + > +/** > + Retrieves the stored WiFi connection status when in either KVM OR One > +Click > + Recovery WLAN recovery flow. > + > + @retval EFI_SUCCESS WiFi connection completed succesfull= y > + @retval Others Connection failure occurred > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *WIFI_GET_CONNECT_STATE)( > + VOID > + ); > + > +// > +// WiFi Profile Sync Protocol structure. > +// > +typedef struct { > + UINT32 Revision; > + WIFI_SET_CONNECT_STATE WifiProfileSyncSetConnectState; > + WIFI_GET_CONNECT_STATE WifiProfileSyncGetConnectState; > + WIFI_PROFILE_GET WifiProfileSyncGetProfile; > +} EFI_WIFI_PROFILE_SYNC_PROTOCOL; > + > +/** > + WiFi Profile Protocol revision number. > + > + Revision 1: Initial version > +**/ > +#define EFI_WIFI_PROFILE_SYNC_PROTOCOL_REVISION 1 > + > +#endif // WIFI_PROFILE_SYNC_PROTOCOL_H_ > diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec > index 5e43ebf8c5..53fb34c4a0 100644 > --- a/NetworkPkg/NetworkPkg.dec > +++ b/NetworkPkg/NetworkPkg.dec > @@ -91,6 +91,9 @@ > ## Include/Protocol/HttpCallback.h > gEdkiiHttpCallbackProtocolGuid =3D {0x611114f1, 0xa37b, 0x4468, {0xa4= , > 0x36, 0x5b, 0xdd, 0xa1, 0x6a, 0xa2, 0x40}} >=20 > + ## Include/Protocol/WiFiProfileSyncProtocol.h > + gEfiWiFiProfileSyncProtocolGuid =3D {0x399a2b8a, 0xc267, 0x44aa, {0x9a= , > + 0xb4, 0x30, 0x58, 0x8c, 0xd2, 0x2d, 0xcc}} > + > [PcdsFixedAtBuild] > ## The max attempt number will be created by iSCSI driver. > # @Prompt Max attempt number. > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > index 4394b6f4bb..7e36016cf8 100644 > --- > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > +++ > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionManagerDxe.inf > @@ -9,7 +9,7 @@ > # 2). WPA2 Personal Network > # 3). EAP Networks (EAP-TLS, EAP-TTLS/MSCHAPv2 and PEAPv0/MSCHAPv2) > # -# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2022, Intel Corporation. All rights > +reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -71,6 +71,7 @@ > gEfiAdapterInformationProtocolGuid ## SOMETIMES_CONSUMES > gEfiSupplicantProtocolGuid ## SOMETIMES_CONSUMES > gEfiEapConfigurationProtocolGuid ## SOMETIMES_CONSUMES > + gEfiWiFiProfileSyncProtocolGuid ## SOMETIMES_CONSUMES >=20 > [Guids] > gWifiConfigGuid ## PRODUCES ## GUID > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > index 67a01ca058..65df5b2c8a 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c > @@ -1,7 +1,7 @@ > /** @file > The driver binding protocol for the WiFi Connection Manager. >=20 > - Copyright (c) 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2019 - 2022, Intel Corporation. All rights > + reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -39,6 +39,11 @@ EFI_GUID mWifiConfigNetworkListRefreshGuid =3D > WIFI_CONFIG_NETWORK_LIST_REFRESH_G > EFI_GUID mWifiConfigConnectFormRefreshGuid =3D > WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID; > EFI_GUID mWifiConfigMainFormRefreshGuid =3D > WIFI_CONFIG_MAIN_FORM_REFRESH_GUID; >=20 > +// > +// Wifi connection attempt counter for retries // extern UINT8 > +WifiConnectionCount; > + > /** > Tests to see if this driver supports a given controller. If a child de= vice is > provided, > it further tests to see if this driver supports creating a handle for = the > specified child device. > @@ -167,8 +172,10 @@ WifiMgrDxeDriverBindingStart ( > EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp; > EFI_SUPPLICANT_PROTOCOL *Supplicant; > EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > + EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > - Nic =3D NULL; > + WifiConnectionCount =3D 0; > + Nic =3D NULL; >=20 > // > // Open Protocols > @@ -236,47 +243,73 @@ WifiMgrDxeDriverBindingStart ( > InitializeListHead (&Nic->ProfileList); >=20 > // > - // Record the MAC address of the incoming NIC. > + // WiFi profile sync protocol installation check for OS recovery flow. > // > - Status =3D NetLibGetMacAddress ( > - ControllerHandle, > - (EFI_MAC_ADDRESS *)&Nic->MacAddress, > - &AddressSize > - ); > - if (EFI_ERROR (Status)) { > - goto ERROR2; > - } > - > - // > - // Create and start the timer for the status check > - // > - Status =3D gBS->CreateEvent ( > - EVT_NOTIFY_SIGNAL | EVT_TIMER, > - TPL_CALLBACK, > - WifiMgrOnTimerTick, > - Nic, > - &Nic->TickTimer > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFiProfileSyncProtocolGuid, > + NULL, > + (VOID **)&WiFiProfileSyncProtocol > ); > - if (EFI_ERROR (Status)) { > - goto ERROR2; > - } > + if (!EFI_ERROR (Status)) { > + Nic->ConnectPendingNetwork =3D (WIFI_MGR_NETWORK_PROFILE > *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE)); > + if (Nic->ConnectPendingNetwork =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto ERROR1; > + } >=20 > - Status =3D gBS->SetTimer (Nic->TickTimer, TimerPeriodic, > EFI_TIMER_PERIOD_MILLISECONDS (500)); > - if (EFI_ERROR (Status)) { > - goto ERROR3; > - } > + WiFiProfileSyncProtocol->WifiProfileSyncGetProfile (Nic- > >ConnectPendingNetwork, Nic->MacAddress); > + if (Nic->ConnectPendingNetwork !=3D NULL) { > + Status =3D WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwor= k); > + if (EFI_ERROR (Status)) { > + WiFiProfileSyncProtocol->WifiProfileSyncSetConnectState (Status)= ; > + } > + } else { > + goto ERROR1; > + } > + } else { > + // > + // Record the MAC address of the incoming NIC. > + // > + Status =3D NetLibGetMacAddress ( > + ControllerHandle, > + (EFI_MAC_ADDRESS *)&Nic->MacAddress, > + &AddressSize > + ); > + if (EFI_ERROR (Status)) { > + goto ERROR2; > + } >=20 > - Nic->ConnectState =3D WifiMgrDisconnected; > - Nic->ScanState =3D WifiMgrScanFinished; > + // > + // Create and start the timer for the status check > + // > + Status =3D gBS->CreateEvent ( > + EVT_NOTIFY_SIGNAL | EVT_TIMER, > + TPL_CALLBACK, > + WifiMgrOnTimerTick, > + Nic, > + &Nic->TickTimer > + ); > + if (EFI_ERROR (Status)) { > + goto ERROR2; > + } >=20 > - OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); > - InsertTailList (&mPrivate->NicList, &Nic->Link); > - Nic->NicIndex =3D mPrivate->NicCount++; > - if (mPrivate->CurrentNic =3D=3D NULL) { > - mPrivate->CurrentNic =3D Nic; > - } > + Status =3D gBS->SetTimer (Nic->TickTimer, TimerPeriodic, > EFI_TIMER_PERIOD_MILLISECONDS (500)); > + if (EFI_ERROR (Status)) { > + goto ERROR3; > + } >=20 > - gBS->RestoreTPL (OldTpl); > + Nic->ConnectState =3D WifiMgrDisconnected; > + Nic->ScanState =3D WifiMgrScanFinished; > + > + OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); > + InsertTailList (&mPrivate->NicList, &Nic->Link); > + Nic->NicIndex =3D mPrivate->NicCount++; > + if (mPrivate->CurrentNic =3D=3D NULL) { > + mPrivate->CurrentNic =3D Nic; > + } > + > + gBS->RestoreTPL (OldTpl); > + } >=20 > Status =3D gBS->InstallProtocolInterface ( > &ControllerHandle, > @@ -385,10 +418,11 @@ WifiMgrDxeDriverBindingStop ( > IN EFI_HANDLE *ChildHandleBuffer OPTIONAL > ) > { > - EFI_STATUS Status; > - EFI_TPL OldTpl; > - WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier; > - WIFI_MGR_DEVICE_DATA *Nic; > + EFI_STATUS Status; > + EFI_TPL OldTpl; > + WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier; > + WIFI_MGR_DEVICE_DATA *Nic; > + EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > Status =3D gBS->OpenProtocol ( > ControllerHandle, > @@ -481,7 +515,15 @@ WifiMgrDxeDriverBindingStop ( > // > OldTpl =3D gBS->RaiseTPL (TPL_CALLBACK); >=20 > - RemoveEntryList (&Nic->Link); > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFiProfileSyncProtocolGuid, > + NULL, > + (VOID **)&WiFiProfileSyncProtocol > + ); > + if (EFI_ERROR (Status)) { > + RemoveEntryList (&Nic->Link); > + } > + > mPrivate->NicCount--; > if (mPrivate->CurrentNic =3D=3D Nic) { > mPrivate->CurrentNic =3D NULL; > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > index 7b2e41e155..047f85dbc2 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDxe.h > @@ -47,6 +47,7 @@ > #include > #include > #include > +#include >=20 > // > // Produced Protocols > @@ -73,7 +74,8 @@ > // > #define WIFI_MGR_DXE_VERSION 0xb >=20 > -#define OUI_IEEE_80211I 0xAC0F00 > +#define OUI_IEEE_80211I 0xAC0F00 > +#define MAX_WIFI_CONNETION_ATTEMPTS 3 >=20 > typedef enum { > Ieee80211PairwiseCipherSuiteUseGroupCipherSuite =3D 0, diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > index 59bac48c42..3a04b4ddb1 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > @@ -19,6 +19,8 @@ EFI_EAP_TYPE mEapSecondAuthMethod[] =3D { > EFI_EAP_TYPE_MSCHAPV2 > }; >=20 > +UINT8 WifiConnectionCount =3D 0; > + > /** > The callback function for scan operation. This function updates networ= ks > according to the latest scan result, and trigger UI refresh. > @@ -420,22 +422,34 @@ WifiMgrConfigPassword ( > // > // Set password to supplicant > // > + if (Profile->Password[StrLen (Profile->Password)] !=3D '\0') { > + Profile->Password[StrLen (Profile->Password)] =3D L'\0'; } > + > if (StrLen (Profile->Password) < PASSWORD_MIN_LEN) { > return EFI_NOT_FOUND; > } >=20 > - AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1) *= sizeof > (UINT8)); > + if (StrLen (Profile->Password) > PASSWORD_STORAGE_SIZE) { > + ASSERT (EFI_INVALID_PARAMETER); > + return EFI_INVALID_PARAMETER; > + } > + > + AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1) * > + sizeof (CHAR8)); > if (AsciiPassword =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPassword, > PASSWORD_STORAGE_SIZE); > - Status =3D Supplicant->SetData ( > - Supplicant, > - EfiSupplicant80211PskPassword, > - AsciiPassword, > - (StrLen (Profile->Password) + 1) * sizeof (UINT= 8) > - ); > + Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 > + *)AsciiPassword, ((StrLen (Profile->Password) + 1) * sizeof (CHAR8))); = if > (!EFI_ERROR (Status)) { > + Status =3D Supplicant->SetData ( > + Supplicant, > + EfiSupplicant80211PskPassword, > + AsciiPassword, > + (StrLen (Profile->Password) + 1) * sizeof (CH= AR8) > + ); > + } > + > ZeroMem (AsciiPassword, AsciiStrLen ((CHAR8 *)AsciiPassword) + 1); > FreePool (AsciiPassword); >=20 > @@ -466,6 +480,7 @@ WifiMgrConfigEap ( > ) > { > EFI_STATUS Status; > + EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; > EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > EFI_EAP_TYPE EapAuthMethod; > EFI_EAP_TYPE EapSecondAuthMethod; > @@ -567,7 +582,13 @@ WifiMgrConfigEap ( > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize)= ; > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NU= LL, > (VOID **)&WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + CopyMem (Identity, &Profile->EapIdentity, IdentitySize); > + } else { > + UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySiz= e); > + } > + > Status =3D EapConfig->SetData ( > EapConfig, > EFI_EAP_TYPE_IDENTITY, @@ -892,6 +913,133 @@ > WifiMgrPrepareConnection ( > return EFI_SUCCESS; > } >=20 > +/** > + Will reset NiC data, get profile from profile sync driver, and send > +for > + another connection attempt.This function should not be called more > +than > + 3 times. > + > + @param[in] WiFiProfileSyncProtocol The target network profile to > connect. > + > + @retval EFI_SUCCESS The operation is completed. > + @retval other Operation failure. > + > +**/ > +EFI_STATUS > +ConnectionRetry ( > + IN EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol > + ) > +{ > + EFI_STATUS Status; > + WIFI_MGR_DEVICE_DATA *Nic; > + EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp; > + EFI_SUPPLICANT_PROTOCOL *Supplicant; > + EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; > + > + Nic =3D NULL; > + > + Status =3D gBS->LocateProtocol ( > + &gEfiWiFi2ProtocolGuid, > + NULL, > + (VOID **)&Wmp > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiSupplicantProtocolGuid, > + NULL, > + (VOID **)&Supplicant > + ); > + if (EFI_ERROR (Status)) { > + Supplicant =3D NULL; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiEapConfigurationProtocolGuid, > + NULL, > + (VOID **)&EapConfig > + ); > + if (EFI_ERROR (Status)) { > + EapConfig =3D NULL; > + } > + > + // > + // Initialize Nic device data > + // > + Nic =3D AllocateZeroPool (sizeof (WIFI_MGR_DEVICE_DATA)); if (Nic =3D= =3D > + NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + return Status; > + } > + > + Nic->Signature =3D WIFI_MGR_DEVICE_DATA_SIGNATURE; > + Nic->Private =3D mPrivate; > + Nic->Wmp =3D Wmp; > + Nic->Supplicant =3D Supplicant; > + Nic->EapConfig =3D EapConfig; > + Nic->UserSelectedProfile =3D NULL; > + Nic->OneTimeScanRequest =3D FALSE; > + > + if (Nic->Supplicant !=3D NULL) { > + Status =3D WifiMgrGetSupportedSuites (Nic); } > + > + if (!EFI_ERROR (Status)) { > + InitializeListHead (&Nic->ProfileList); > + > + Nic->ConnectPendingNetwork =3D (WIFI_MGR_NETWORK_PROFILE > *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE)); > + if (Nic->ConnectPendingNetwork =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to allocate > memory for ConnectPendingNetwork\n")); > + goto ERROR; > + } > + > + Status =3D WiFiProfileSyncProtocol->WifiProfileSyncGetProfile (Nic- > >ConnectPendingNetwork, Nic->MacAddress); > + if (!EFI_ERROR (Status) && (Nic->ConnectPendingNetwork !=3D NULL)) { > + Status =3D WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwor= k); > + if (!EFI_ERROR (Status)) { > + return Status; > + } > + } else { > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get WiFi > profile with status %r\n", Status)); > + } > + } else { > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get > + Supported suites with status %r\n", Status)); } > + > + if (Nic->ConnectPendingNetwork !=3D NULL) { > + if (Nic->ConnectPendingNetwork->Network.AKMSuite !=3D NULL) { > + FreePool (Nic->ConnectPendingNetwork->Network.AKMSuite); > + } > + > + if (Nic->ConnectPendingNetwork->Network.CipherSuite !=3D NULL) { > + FreePool (Nic->ConnectPendingNetwork->Network.CipherSuite); > + } > + > + FreePool (Nic->ConnectPendingNetwork); } > + > +ERROR: > + if (Nic->Supplicant !=3D NULL) { > + if (Nic->SupportedSuites.SupportedAKMSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedAKMSuites); > + } > + > + if (Nic->SupportedSuites.SupportedSwCipherSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedSwCipherSuites); > + } > + > + if (Nic->SupportedSuites.SupportedHwCipherSuites !=3D NULL) { > + FreePool (Nic->SupportedSuites.SupportedHwCipherSuites); > + } > + } > + > + FreePool (Nic); > + > + return Status; > +} > + > /** > The callback function for connect operation. >=20 > @@ -908,12 +1056,13 @@ WifiMgrOnConnectFinished ( > IN VOID *Context > ) > { > - EFI_STATUS Status; > - WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken; > - WIFI_MGR_NETWORK_PROFILE *ConnectedProfile; > - UINT8 SecurityType; > - UINT8 SSIdLen; > - CHAR8 *AsciiSSId; > + EFI_STATUS Status; > + WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken; > + WIFI_MGR_NETWORK_PROFILE *ConnectedProfile; > + UINT8 SecurityType; > + UINT8 SSIdLen; > + CHAR8 *AsciiSSId; > + EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; >=20 > ASSERT (Context !=3D NULL); >=20 > @@ -925,6 +1074,24 @@ WifiMgrOnConnectFinished ( > ASSERT (ConfigToken->Type =3D=3D TokenTypeConnectNetworkToken); >=20 > ASSERT (ConfigToken->Token.ConnectNetworkToken !=3D NULL); > + > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL= , > + (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { > + WiFiProfileSyncProtocol->WifiProfileSyncSetConnectState (ConfigToken= - > >Token.ConnectNetworkToken->ResultCode); > + if ((WifiConnectionCount < MAX_WIFI_CONNETION_ATTEMPTS) && > + (ConfigToken->Token.ConnectNetworkToken->ResultCode !=3D > ConnectSuccess)) > + { > + WifiConnectionCount++; > + gBS->CloseEvent (Event); > + Status =3D ConnectionRetry (WiFiProfileSyncProtocol); > + if (!EFI_ERROR (Status)) { > + return; > + } > + > + WiFiProfileSyncProtocol->WifiProfileSyncSetConnectState (Status); > + } > + } > + > if (ConfigToken->Token.ConnectNetworkToken->Status !=3D EFI_SUCCESS) { > if (ConfigToken->Nic->OneTimeConnectRequest) { > // > diff --git > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > index 4ad5643c24..87adfc5033 100644 > --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrMisc.c > @@ -672,10 +672,23 @@ WifiMgrCleanProfileSecrets ( > IN WIFI_MGR_NETWORK_PROFILE *Profile > ) > { > + EFI_STATUS Status; > + EFI_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; > + > ZeroMem (Profile->Password, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->EapPassword, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->PrivateKeyPassword, sizeof (CHAR16) * > PASSWORD_STORAGE_SIZE); >=20 > + // > + // When EFI WiFi profile sync protocol is found the system is > + performing a recovery boot in secure // boot mode. The profile sync > + driver will manage the CA certificate, client certificate, and key // = data, > cleaning them at exit boot services. > + // > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL= , > + (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { > + return; > + } > + > if (Profile->CACertData !=3D NULL) { > ZeroMem (Profile->CACertData, Profile->CACertSize); > FreePool (Profile->CACertData); > -- > 2.26.2.windows.1 >=20 >=20 >=20 >=20 >=20