From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.346.1664384899409710152 for ; Wed, 28 Sep 2022 10:08:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=BP+nFnJh; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: zachary.clark-williams@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664384899; x=1695920899; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=sVNoBBauVb4+W9Evhj16Xv2+vUZPBedhXh7f5JdCJWU=; b=BP+nFnJhsjNDXAs2YWCidYj0OqQgSlx3SGZ7mG7tukzJiUzu8G4p/WeP PUbHS2YqnOExS4/MqsFmae6KxQfJ+CAiaBgGOuYpa4Kspp8RXTKtPizqu i2w7/rqffBOCAme1R9zgZo23C3/8aAnLdwehiPMtC5ftPW7CswL3dE1A8 5MVuTotyrTx5gjLhYTNxaqqQYMjh7w3LKKakuSJ5CRG3Qs+NmgA2HfKgp vOwQLmxRIXcr1nsc9lWvJg1QMGE4rmY+NsrBI3aMwDXW8QJXdMdoJHlPp Ead6p8w0cbGt9wmHcbar4ICQV6D2w66P0gvKRkoAbq7FOOerZGDriJUhw w==; X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="281376539" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="281376539" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 10:07:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10484"; a="764365049" X-IronPort-AV: E=Sophos;i="5.93,352,1654585200"; d="scan'208";a="764365049" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by fmsmga001.fm.intel.com with ESMTP; 28 Sep 2022 10:07:53 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) 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; Wed, 28 Sep 2022 10:07:52 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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 via Frontend Transport; Wed, 28 Sep 2022 10:07:52 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.173) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Wed, 28 Sep 2022 10:07:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RPxnPKoTLyPpZ6BVgey56dh5XDX5JtXCkhoU32WYIP3Fe4HOpTSn8yUWz2XcN1+GS7uaSxb/mMl7L37rXmm7UWshEtaOertF5yxRMcJo0bfsf/pT/RkeZeL6+tpPU91bFAAsIuyT1IXCJXLluXzcVlhzgdoO33FW8IJMIAWgIWzzlZtadaR3m0tKxq5ULo9Xwj97NnohIi2Pio4wLO0xPvgIZCiopQg9S5LPdpciU+Crr/vSg6E/9nEkWiAAlAx1kvtFxIajStN30udStUvGDKDkA8y4ueMgieQg7gA7QsxRJ/DnZfrvbUsDC1R52RZUeMIDI5xs9JGi+sPe2knUHQ== 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=I1Q56OLneZWAQwUHUR5c2GDAmLBeJz+RqCGHrKWC1rU=; b=hm6K8yaPLuwOnyJoywEG8KqXUa6wDTuL9q5aUxDcZUq5hrnXALm9TTyEr35Zs+dhZbTC7CUp0mFn6J38tSjVZJ3IeCHS3wvs9T4Y2qf+Zw70tU0lT76lmmTVvYlkAXN3nYzRn7QWJIcXcdUUvS2FrPn7ZR8U7UEQMew+q/MHkptW81PNQrPKsXheJn/g7hcgqvtOuC2XiwRBZMYsXOxbiH9qaCRD+ON7uyKjIZ9rLWxwP/DaqZBPvWPCvNC2XxkvmPUy3CcvjTFbd8mQnQrSF5CyeRZMtnl0mP9HiO2gW/k0muTHq5wYcJm/pmDA3HybeFL5eDsdehbSpB6suXW4jQ== 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 CO6PR11MB5601.namprd11.prod.outlook.com (2603:10b6:303:13d::7) by PH7PR11MB6698.namprd11.prod.outlook.com (2603:10b6:510:1ac::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.25; Wed, 28 Sep 2022 17:07:50 +0000 Received: from CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::994:9a2e:61fb:9918]) by CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::994:9a2e:61fb:9918%4]) with mapi id 15.20.5676.017; Wed, 28 Sep 2022 17:07:49 +0000 From: "Clark-williams, Zachary" To: "Luo, Heng" , "devel@edk2.groups.io" CC: "Clark-williams, Zachary" Subject: Re: [edk2-devel] [PATCH V2 2/2] NetworkPkg: Add WiFi profile sync protocol support Thread-Topic: [edk2-devel] [PATCH V2 2/2] NetworkPkg: Add WiFi profile sync protocol support Thread-Index: AQHY0dRuZ38WBcaUUEWnUxGMhjotMq3y4oMAgAIk3GA= Date: Wed, 28 Sep 2022 17:07:49 +0000 Message-ID: References: <8fdb4de628120a8736ee47522d1941e3ad3bdf8a.1664216197.git.zachary.clark-williams@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.500.17 dlp-product: dlpe-windows 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: CO6PR11MB5601:EE_|PH7PR11MB6698:EE_ x-ms-office365-filtering-correlation-id: f1c285ef-e641-47ea-ab4d-08daa173f918 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: b06wPYW5oxzSefq1DG6El94cQvebtlOjo6a5GSKEkWMAcL7C3jidtCsYuVdrc2T/DyzIRKiJVtlbjA92vhaR8gYIOF5m+E+h3FY5DNxLYDmMwzTM1oJjSfXo3gkIgu5OH3412HF4yYOm51dkVY7Fsdf+oW8aCPkWLmAOpMv58Mvd+Yhlt2WHL4hbuSiX3yB/NcBMPkazALbR/9Ky4+eAPsGMRDIvmbGo+tFvlmhscBsHaDh4V+9aaJ5bW9cA37Ex4NzuC5+jCW84Dh/pKnvebuZi2GBBXykHyeHdAlxFTIEKMvY6uv9OgzjdDm75eMsyeGYUYUt+773eIMU4vmHnBTz5t7qCSota9z/K5LtCs0+SjPDUJXtd/XQmfagPBY3Lbgaj2VB/OnuU/Y5tZBgN/1u9k3zXI5h1x6mYtMMIvn1lCV6ZfABu4y05OFfORA4DFAYoMbz1DJ8vwpl/proDrD+WOYor4m8paLnCVnKYQ5GU88Jk9PWxvcg1k7u31q+RAlpNJNRQD6nt/MNshpdQ5pArgJG1+RCAeNfMW5LcyH2AHf0xcbDf9K4wODsfdFiCAhGq20Cu3IQCCdPZFRMtSjn74+A+n4sLzsNabqtzw3n//k7+AJ5vfG2rKf97S1ntQf0dpjbblL2fdst7T4xZYyfV/ijUxSgJsLLZYHQU2zE3kGmOQoeuzRXBrAONyWTfUYI0CizaUqkewbe8l2pI0+JBpzmPCSARiCX4lYxOnCY2wkZuZnD6rEelsP8UkYkZFTyYugYIZRDNKDSfmLXApau8QckBZM6YZOz8Axs3NFvwcEdokrg/60Yt2Ex2WjMbehrIMoMsWar7+dCT9yphb5KB4jdOvDgtk1ApUSTOoa8= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO6PR11MB5601.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(6029001)(396003)(39860400002)(136003)(346002)(366004)(376002)(451199015)(53546011)(66556008)(38070700005)(7696005)(5660300002)(6506007)(30864003)(66946007)(8936002)(33656002)(9686003)(52536014)(2906002)(26005)(41300700001)(66476007)(66446008)(4326008)(122000001)(76116006)(8676002)(64756008)(38100700002)(55016003)(86362001)(107886003)(66899015)(186003)(82960400001)(83380400001)(110136005)(966005)(71200400001)(478600001)(19627235002)(316002)(559001)(579004)(44824005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?75279K7mJX00mR+7KH3cAo8YMbERXPX7NCJap0dR6umMFQcZ+clWbE5wgfl+?= =?us-ascii?Q?vrWu/nGLXuDDGLuJ+v5yrkyvWC269aoa0BLbwmdvFeyUOnns3qQMrr6c8i3T?= =?us-ascii?Q?hE3Eq4wpkQG8N4g7p4LR12XEsu/lWu9OLkeKSY4Lm19Hj3s+WPxh3EgOBY1Y?= =?us-ascii?Q?nTTLDQRgbonzUJKP9XSV6v4jlAAPvrA8FQKw4qhI9oPppL7JcIpIKl9YLKs0?= =?us-ascii?Q?xl5xSURb47O/t4+day6lioXQkXV2jHKwpBnAMHg0YnkjPzIOqobWHk3ekQ/R?= =?us-ascii?Q?4C2HZKjfgeJw7m7wBznazMc4PrHeza3DU+AUCwsTInXLuwZULqDmxnUDfGKk?= =?us-ascii?Q?e7bNoOkroCucuodnl2wnVFl/DWiE/TG+VAr5nGbyl+b+r6pAqolru86x8aUg?= =?us-ascii?Q?QiezGFcq6uG+ALhDafi7jUKDDEDSEk27eBo1dJ6uR7wCZxqgfFHuUngcHTDT?= =?us-ascii?Q?3n9wgWZ0TcuNjoEvLW0PzIUbOK915bJeIHgZaH1E/he5OnYhRzxR1K/6UjXg?= =?us-ascii?Q?TQN0tEUfJq25WYgW1yL2c4p/MguwiFsIuQOWBDrRqJOea9UGZee8P5Pe7+9+?= =?us-ascii?Q?A5JESu4H1nIy6H4wsfj9xuELjD30h8NZLH9jOkddd5erqzDdPpo7M4SDFWqp?= =?us-ascii?Q?ytIGTEWPb0SgEjrEJSgZtz7ALpup8VnaMk18Z9LBmupUHFUY1FsRr+lai0PQ?= =?us-ascii?Q?lqx5qTvBzfB7CmDeFg9V7hvotC7Q3lkKgimANB1ehn//Hhk8YULKiqHfRbkw?= =?us-ascii?Q?oc/tKV47zco2eUr2TX+in3F4IkZBLBhqUML1jvFBWxhFhDl1BLO6rUh3zXWm?= =?us-ascii?Q?sAqFhha6u1Dxf967HFkMrxIO5B3+xscHrjvF1TZwGR1Hz8/1fgY18pr78E6j?= =?us-ascii?Q?iknJ1QrfO9PFjzqdQSnozmnszGTlP230HYo6cgCqhsxmfxiy0idH8hGHXdWs?= =?us-ascii?Q?/jc8OeMj+y0LBU8NK+iakfl1jFozlBYw79P3f0kU/VWNA1YKsHOsdnAYFQVD?= =?us-ascii?Q?Y3NoKOogAbjgX31AlfGqkYZbu4yk2A0t9pKJHwplzidCbcGJbO3JMBtJU5qN?= =?us-ascii?Q?AIr839JHiUznEMVZ0krE9xLBvGy1UaSvHnrmfn84aRQmH9s53nYZv2k0aiql?= =?us-ascii?Q?penlURqhyYCD92QgipeMdXp2IJqpo0tDgkraGsH/BLAEv+izDtmEnihO6G3O?= =?us-ascii?Q?C3A5nT//RxhLwW/F4iXw5DtKbwBnwqLxwUPmeMq9wwGcRWymy7nVQa47Y2my?= =?us-ascii?Q?YpRgpBKq0WhKIFNIhio0sV5KcYZwenGy7itOVxshSKA50NeC9cXqoNM1VI0l?= =?us-ascii?Q?Oy2eCG1ZMJJA7Qu1NAncYssxR4CqXHXIGzrkhW1Y0ChGsuCZ3EqOHS+UVUOD?= =?us-ascii?Q?wvKW3/ojmRNVNz2XVMzcxirAZeDFEzlT4sOxxWKtpGVBfiCk88fEskBdN1X4?= =?us-ascii?Q?4YcHe4YkmbqG7dygKEoJGqJkoV2qH+Jd2qxn0gphMYk1THiJaZtS/UE21h43?= =?us-ascii?Q?UN7Z3LQbMwMqdvmqNaWE6ujWdLEGZ94MVwCKnaVy9PIZrnrZIDuds4BWAzR7?= =?us-ascii?Q?4puaoxlsLcbn8xZeaMZOPyiuakUZuIqEUBfIPe6ye0RPkPOAQ9LiyB+xEne6?= =?us-ascii?Q?Ua7EMQd7kp+sOaX2w0kLBrc=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO6PR11MB5601.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1c285ef-e641-47ea-ab4d-08daa173f918 X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Sep 2022 17:07:49.8176 (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: mAGe6ncHdrMXvEnW4MoyPf9cKY49msLw8Y32+75e8qjLgn9XZ3O2I46X4sn3ZxRCdizJp511zxaZY5itj3njenrbT/YLDjzKjBpBGkply2t35Y3a8IfRa5PY/KvwfA6G X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB6698 Return-Path: zachary.clark-williams@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thank you Heng and all, My responses: 1. Fixed. 2. Fixed, it was a missed change now added to the new patch. 3. Added CC.=20 Sending an updated patch file for reviewal.=20 Thanks, Zack=20 -----Original Message----- From: Luo, Heng =20 Sent: Tuesday, September 27, 2022 12:31 AM To: devel@edk2.groups.io; Clark-williams, Zachary Cc: Zachary Clark-Williams Subject: RE: [edk2-devel] [PATCH V2 2/2] NetworkPkg: Add WiFi profile sync = protocol support Hi Zack, 1. > + Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8=20 > + *)AsciiPassword, ((StrLen (Profile->Password) + 1) * sizeof=20 > + (CHAR8))); I think we should remove '* sizeof (CHAR8)' because the third parameter is = the length of string but not size of the memory: Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPasswor= d, ((StrLen (Profile->Password) + 1))); =20 2.=20 > + if (StrLen (Profile->Password) > PASSWORD_STORAGE_SIZE) { > + ASSERT (EFI_INVALID_PARAMETER); > + return EFI_INVALID_PARAMETER; > + } Need null terminator at end of password, so I think the conditional should = be: if (StrLen (Profile->Password) >=3D PASSWORD_STORAGE_SIZE) in order to sup= port 32 bytes PSK passwords with null terminator. Maybe need to change PASS= WORD_STORAGE_SIZE to 65? But PASSWORD_MAX_LEN should still be 63, because = according to the 802.11i specification: A pass-phrase is a sequence of between 8 and 63 ASCII-encoded characters. T= he limit of 63 comes from the desire to distinguish between a pass-phrase a= nd a PSK displayed as 64 hexadecimal characters. 3.=20 Suggest to add maintainers in Cc of the commit msg to speed up review. Fox example: 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 Cc: Maciej Rabeda Cc: Fu Siyuan Cc: Wu Jiaxin Signed-off-by: Zachary Clark-Williams Thanks, Heng > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Clark-=20 > williams, Zachary > Sent: Tuesday, September 27, 2022 2:20 AM > To: devel@edk2.groups.io > Cc: Zachary Clark-Williams ; Clark-williams,=20 > Zachary > Subject: [edk2-devel] [PATCH V2 2/2] NetworkPkg: Add WiFi profile sync=20 > 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=20 > Sync feature and protocol. Adding WiFiProfileSyncProtocol, which=20 > supports the profilesync driver operations for transferring WiFi=20 > profiles from AMT to the Supplicant. WiFiConnectionManager will check=20 > for the WifiProfileSyncProtocol and if found will operate on the=20 > premise of a One Click Recovery, or KVM flow with a Wifi profile provided= by AMT. >=20 > Signed-off-by: Zachary Clark-Williams=20 > > --- > .../Protocol/WiFiProfileSyncProtocol.h | 83 ++++++++ > NetworkPkg/NetworkPkg.dec | 3 + > .../WifiConnectionManagerDxe.inf | 3 +- > .../WifiConnectionMgrDriver.c | 126 ++++++++---- > .../WifiConnectionMgrDxe.h | 4 +- > .../WifiConnectionMgrImpl.c | 193 ++++++++++++++++-- > .../WifiConnectionMgrMisc.c | 13 ++ > 7 files changed, 366 insertions(+), 59 deletions(-) create mode=20 > 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=20 > +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=20 > +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=20 > +AMT shared > + and was stored in WiFi profile protocol. Aligns the AMT WiFi=20 > +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=20 > +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=20 > +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=20 > 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,=20 > {0xa4, 0x36, 0x5b, 0xdd, 0xa1, 0x6a, 0xa2, 0x40}} >=20 > + ## Include/Protocol/WiFiProfileSyncProtocol.h > + gEfiWiFiProfileSyncProtocolGuid =3D {0x399a2b8a, 0xc267, 0x44aa,=20 > + {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)=20 > # -# Copyright (c) 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2019 - 2022, Intel Corporation. All rights=20 > +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=20 > + reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -39,6 +39,11 @@ EFI_GUID mWifiConfigNetworkListRefreshGuid =3D=20 > WIFI_CONFIG_NETWORK_LIST_REFRESH_G > EFI_GUID mWifiConfigConnectFormRefreshGuid =3D=20 > 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=20 > +WifiConnectionCount; > + > /** > Tests to see if this driver supports a given controller. If a child=20 > device is provided, > it further tests to see if this driver supports creating a handle=20 > 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,=20 > 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=20 > > +#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=20 > a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c > index 59bac48c42..936fe3e721 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. > @@ -424,18 +426,26 @@ WifiMgrConfigPassword ( > return EFI_NOT_FOUND; > } >=20 > - AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1)= =20 > * sizeof (UINT8)); > + if (StrLen (Profile->Password) > PASSWORD_STORAGE_SIZE) { > + ASSERT (EFI_INVALID_PARAMETER); > + return EFI_INVALID_PARAMETER; > + } > + > + AsciiPassword =3D AllocateZeroPool ((StrLen (Profile->Password) + 1)= =20 > + * sizeof (CHAR8)); > if (AsciiPassword =3D=3D NULL) { > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPassword,=20 > PASSWORD_STORAGE_SIZE); > - Status =3D Supplicant->SetData ( > - Supplicant, > - EfiSupplicant80211PskPassword, > - AsciiPassword, > - (StrLen (Profile->Password) + 1) * sizeof (UINT= 8) > - ); > + Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8=20 > + *)AsciiPassword, ((StrLen (Profile->Password) + 1) * sizeof=20 > + (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 +476,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 +578,13 @@ WifiMgrConfigEap ( > return EFI_OUT_OF_RESOURCES; > } >=20 > - UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize)= ; > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid,=20 > + NULL, > (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 +909,133=20 > @@ WifiMgrPrepareConnection ( > return EFI_SUCCESS; > } >=20 > +/** > + Will reset NiC data, get profile from profile sync driver, and send=20 > +for > + another connection attempt.This function should not be called more=20 > +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=20 > + 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=20 > + WiFi > profile with status %r\n", Status)); > + } > + } else { > + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get=20 > + 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 +1052,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 +1070,24 @@ WifiMgrOnConnectFinished ( > ASSERT (ConfigToken->Type =3D=3D TokenTypeConnectNetworkToken); >=20 > ASSERT (ConfigToken->Token.ConnectNetworkToken !=3D NULL); > + > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid,=20 > + NULL, (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { > + WiFiProfileSyncProtocol->WifiProfileSyncSetConnectState=20 > + (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) *=20 > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->EapPassword, sizeof (CHAR16) *=20 > PASSWORD_STORAGE_SIZE); > ZeroMem (Profile->PrivateKeyPassword, sizeof (CHAR16) *=20 > PASSWORD_STORAGE_SIZE); >=20 > + // > + // When EFI WiFi profile sync protocol is found the system is=20 > + performing a recovery boot in secure // boot mode. The profile=20 > + sync driver will manage the CA certificate, client certificate, and=20 > + key // data, > cleaning them at exit boot services. > + // > + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid,=20 > + NULL, (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { > + return; > + } > + > if (Profile->CACertData !=3D NULL) { > ZeroMem (Profile->CACertData, Profile->CACertSize); > FreePool (Profile->CACertData); > -- > 2.37.3.windows.1 >=20 >=20 >=20 >=20 >=20