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.web11.79524.1673286232307478520 for ; Mon, 09 Jan 2023 09:43:52 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=SImFFFWK; spf=pass (domain: intel.com, ip: 192.55.52.115, 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=1673286232; x=1704822232; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=iZ4DGwEIu7tOsYjB9igP4dv5Uec2NOSXMbfnSJ8EQGc=; b=SImFFFWKUNWQQKyJK/6uWu1MvWVxMVqJEJoZrErLSA8pBKywDIb0J2o3 6G54IsTYIQc3quCbpY8fciMX1Z6MYjB3ADzK3ZRF5Od91HhG2VJOJnLbn sI+012ODFqL/RbSq7o/Fe93hpIQFKKmiOF/9aE9KTb6mox5BB7v9ugycv EQd8g5R6Pz8YetqQhphCkHSH5WZVVUqxeiF+Wv0bNcrEfr9q049i81IIK 7rBbsWdCG91koKt7blIsN5PY3UBerkDm53vSIAoed8AbUDlC5GjkpFOYE Ho/WqJdQqzB3B1KXM1DuKwuVNM/ifndb8V54XFBt7/E64w5hFWZKM6uDJ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="323009828" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="323009828" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 09:43:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="658681690" X-IronPort-AV: E=Sophos;i="5.96,311,1665471600"; d="scan'208";a="658681690" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga007.fm.intel.com with ESMTP; 09 Jan 2023 09:43:45 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.2507.16; Mon, 9 Jan 2023 09:43:44 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 9 Jan 2023 09:43:43 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 9 Jan 2023 09:43:43 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.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.2507.16; Mon, 9 Jan 2023 09:43:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NioIDtin2Ym0e8mbN3jL7tHEdJj0FVKoytUHKiicuOwZFjeOp3wIj4XdQmCNrLV+V8bgteX4AruThQzUy8wbXXgIT4F2p+P/E9mB1ajtUDEMtu398WpsT3LcxgFyMjeDO0PwRjhSHnFd7If3zhO+DGkJRjKlwQy9TVVh32sHjFsqHEEAueXF08u4JVfyxonRaVxhnLDtMF2LhKQwpWMdrER7PPf4L6D8peExbH51efVTXn9O8twlhfdZBUDNX4m4r5Y/eJ1REhJBfS+bfQUssEFXkikVi8pXSdRq2GGV7l0lMASU87AcEkXEpi9jJgh9Du4QtlZzQs3pGDlIRog/kA== 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=yO97K0yC0D4Tn5yjSyKEVBgas1lkkAtkNmOWgEykDes=; b=h3p6oQfQLmn34yw7llQGQcR3bfZ+R7RFz5D4nrbLCOSu1RoU4YmzeRWribw8dfdStynVmJzliE2PriMxBENoIjwdg4IG2sfMcdBPkqWPTxeK09N4U0rbpbVzyne91zxveTU+jUBPAisPBRbDkETVIgU5JloUBtK9JJ00nAEXE+mOCGCGShX1GzF4UIXiEaI/+UTI0oJZBauaDXNNiHYmtJvslhJXRtNdZEABFhwwJiHeZgo6lPMDXA5jTYaj07Q+5EetITa7fO8xqlbptrAPZpVXG+oYCJntq2yCeiXNRHZP3h8liewie2sFV2Zccf/3/sub4T6E2JEwP80w3yLMlQ== 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 SA2PR11MB4905.namprd11.prod.outlook.com (2603:10b6:806:117::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Mon, 9 Jan 2023 17:43:40 +0000 Received: from CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::5add:c261:a682:569e]) by CO6PR11MB5601.namprd11.prod.outlook.com ([fe80::5add:c261:a682:569e%3]) with mapi id 15.20.5986.018; Mon, 9 Jan 2023 17:43:40 +0000 From: "Clark-williams, Zachary" To: "devel@edk2.groups.io" CC: Zachary Clark-Williams , Maciej Rabeda , "Wu, Jiaxin" , "Otcheretianski, Andrei" Subject: Re: [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Topic: [PATCH] NetworkPkg: Add WiFi profile sync protocol support Thread-Index: AQHZIjfG4tx5iN20T0KKTScSOfXX/a6WXxHg Date: Mon, 9 Jan 2023 17:43:39 +0000 Message-ID: References: <20230107013110.7349-1-zachary.clark-williams@intel.com> In-Reply-To: <20230107013110.7349-1-zachary.clark-williams@intel.com> Accept-Language: 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-traffictypediagnostic: CO6PR11MB5601:EE_|SA2PR11MB4905:EE_ x-ms-office365-filtering-correlation-id: 3099df4a-903b-4a41-e91a-08daf2690b30 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: n24uiqkmxFgJLr/0IiOwjhuOzVChTCXqutVezbFvJ5oGRWfj6H7a86us0DxwHkC9JBPZdByE3i7xoPHp0cLLz0/enTFU9rez/q9b3yFmVK2YCKbF+gwHvVd5lMDt9/xVB7RdKYitCTC//PRCM2C/HB1IZdMoW53vYaUyLyB1kw5mTqikCNoAfsmE0iv2yR8YS/q8bzyNNLU6ADJZ+EgoxfdWMYtlkUtbBc3Pb8x3zMn4jCOz3JQBsHVeT7lku3yQpbCVHab3tjF8T/m81UvmjoWZMGFkkGRHKrlHydRqqpCKSVCxQ4xfCjtzescehFhdbXudx2I1kR98n0f/xYPa6q2UVuS5cDTwzcmOoFBeDpNnzndnWpZhdbNl7Ahy1m+bpR/s7k/V8dP3foT2WkRghIcSQcU2eOHV4lxc4nKeEGCqj+a6/smpi2/Ja+Pfn2KVE5Ry95RCLTU3599+EM2p+EHmc85tLWo8jb82fUs67qM6Fb6pVooU5Mvpss25+4Jw2HKe+Gy/EHMD/ZF9UvdeLsOozTuZHsRAvbHBSY2KiCr8yvPvH2EhMlmneQtTaaDCcD6l377YxGx82K2X2KpBVEhwOePDCF/uFTovkwsHlAW5E4/nRhaXBaor0nm7WbGOd5rL+rTNgZIufOJCrvEEkfywn1Y9r/CnPk0rjYMAUZwk8RybhKSXnXylTgMESeCSB/gc1wOlDNZW9BfzMGrE9qxWqJD8XCQsXtJE82k11YKqLzfzmBV+ORBrWxeA+qCt6Sp43sYVjlE4hQFSt/L1kA== 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)(136003)(346002)(366004)(396003)(376002)(39860400002)(451199015)(52536014)(66946007)(41300700001)(8936002)(30864003)(5660300002)(2906002)(8676002)(6916009)(64756008)(66446008)(66476007)(66556008)(76116006)(316002)(19627235002)(7696005)(71200400001)(54906003)(966005)(33656002)(6506007)(478600001)(53546011)(9686003)(4326008)(186003)(55016003)(26005)(86362001)(83380400001)(38100700002)(82960400001)(122000001)(38070700005)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DF9q5gk/NdPBTyfLz/u1Hvo6iAbOp6/Lk11s1BaeL5e1+M7/9UOkt39bLC6e?= =?us-ascii?Q?3pSUorCrLUi4OGzt8rUha5l/8OmI7aSYVKryzsec+J8rZOrOsZdvVTc8elYV?= =?us-ascii?Q?+2q0Y4vFpo9wh9gMcaV6NDVe1rWyEwsiUsi1naLbzBVUzl1UAly7Q1YK7WOT?= =?us-ascii?Q?ttUesA0TGWTHkeJl3rCifU1IxVZ2KXQZCXPHztxOyGBIbnDzTaoZx894JWst?= =?us-ascii?Q?TCxWIC0gYKaKxPvnCyntQxg7udyUfcY+TdCxT5pncJuJDurNzOVE7U404npD?= =?us-ascii?Q?Vwt7FF3Vkm3iJG15L6HcfWo/uEbPraH39/8kPSBijY5rBwfDtCBKczp/4lH7?= =?us-ascii?Q?hOup9SmtocBUgWhpah/SiAlx1zIERFilz7TAk8TGfonwhnbKzthdJvU+AKdZ?= =?us-ascii?Q?dx1UPnCe36bkzK0xfbV2q2015D17ejHE328aWJWs7w5HTykioPZG5493qs+H?= =?us-ascii?Q?bZdsd5wmEaRJTYLQM47sysQ1vyl3MRf6RyLj6O1BVhgDod8syqWg6of32KQe?= =?us-ascii?Q?255FvU3/BFT8UBB2vI9e7OvNqW4CGlTLLk5iDZm2wyyLi9GpNia+KON/c3qp?= =?us-ascii?Q?6H5zn94DT4UCeKGz/RfsqFE3UUk9JimlhVuMSnfTkwiozlXN3pSMG+z8pfbs?= =?us-ascii?Q?mTP3fLgtQ0B0rs7PuT21Vcru6pJJel+7G1HlzgAtk0Se5Vx2i+7x8Rp09clB?= =?us-ascii?Q?qV0GPa0cJiXuePiiDz1MZDZDszFBxbAeOZCmpjuDGqB1MCHhUUa2Cx4Ki2vx?= =?us-ascii?Q?GFuiPaPfYryEbmj8aOTsMeClM+X9lZBq5LKNYR+wI514KbhgG3mpulq+zu6b?= =?us-ascii?Q?C22kUWcbL7KDYPAD4V0OQ8dBHwrunWMN08J/Jhd57dvzWW9nW6b7mcDXkY+u?= =?us-ascii?Q?oHqS6iSX9dIFeSgCmujY6tNTPq9jtcImBQxVgNYayrPL/mO0vSCoVMvYjvVQ?= =?us-ascii?Q?m2WhImuKANJHt6wvUaAH7ocP/VnXtcuR+68UdeCCN76SDcLG8k5JZpAoyQy0?= =?us-ascii?Q?s3+yp2pPzv9jqFApMiHOW6e/6++MXkXsU5k7I3gLjjfGe0j4ahYAMbk/fKYX?= =?us-ascii?Q?kuY9seswZfxZg24WWg1GFFc1T5CoLWZMwdqap60AMqrUWOOoNpujv3Ue26er?= =?us-ascii?Q?Q2YLsh/SFeKBnog/A7EflE4gI2P1no52XYkiusf3BEA5G/QMHGgEojrRtEsr?= =?us-ascii?Q?a4bkl9CC1kG4mCwWRmTA41f7ubeODMSxEwjpn/r9IPTbj7mzZlfERXjrFJBp?= =?us-ascii?Q?dEE+/5HlLsSZKKHRi0NwoxbD261U3Cnt8erpoLM8vajjyXBjBFJoQlIsWgB6?= =?us-ascii?Q?0D4aasgy5ZBBKNq6dslpm/CT1N7vGr+MUpwGA+k3+YL6X78zbDy43CWkp4yo?= =?us-ascii?Q?QXkFbI69mDmCSg8CeXw4OHZqVzU8Y41pDAYlje+JKjc9sePBrGf+RWm7h3/9?= =?us-ascii?Q?wyodQo3kDDRq39RnUFrapzjfR3MiVeo9BIukN76B8KLORCmFpkdCG1mNjEWc?= =?us-ascii?Q?Us7gYRbL/uLC2bcRKS5F4+VqtU2JS3TgHqkrvMmV3Cg5PQI7Qhilcmy70N7U?= =?us-ascii?Q?l0zraiSUhRpwwdffocPO8jkH5dPm2JOAXxhRGU4pujihH9CHN5oUfqoMuhuQ?= =?us-ascii?Q?oRA7h34rADxalgANrpfOn1Q=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: 3099df4a-903b-4a41-e91a-08daf2690b30 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2023 17:43:39.9120 (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: W5VK9osSRfF/VPZC7wxOhsNT9WWytp1lZBAez4Y5XP9BVwdEJVutXECreotbHom073b1SLPH5v34MDY2OjuoUt+PM3NeDen/klhjLlHQKGEzNEP7HYrZQIQYAw9+zRiw X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR11MB4905 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 Hey Jiaxin, Please rind my updated patch below. Let me know when you get this reviewed = so I can get it merged as soon as possible.=20 Thank you, Zack -----Original Message----- From: Clark-williams, Zachary =20 Sent: Friday, January 6, 2023 5:31 PM To: devel@edk2.groups.io Cc: Zachary Clark-Williams ; Maciej Rabeda ; Wu, Jiaxin ; Otcheretianski, An= drei ; Clark-williams, Zachary Subject: [PATCH] NetworkPkg: Add WiFi profile sync protocol support From: Zachary Clark-Williams REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3845 Enables KVM and One Click Recovery WLAN capability with WiFi Profile Sync f= eature and protocol. Adding WiFiProfileSyncProtocol, which supports the pro= filesync driver operations for transferring WiFi profiles from AMT to the S= upplicant. WiFiConnectionManager will check for the WifiProfileSyncProtocol= and if found will operate on the premise of a One Click Recovery, or KVM f= low with a Wifi profile provided by AMT. Cc: Maciej Rabeda Cc: Wu Jiaxin Cc: Andrei Otcheretianski Signed-off-by: Zachary Clark-Williams --- .../Protocol/WiFiProfileSyncProtocol.h | 90 +++++++ NetworkPkg/NetworkPkg.dec | 3 + .../WifiConnectionManagerDxe.inf | 3 +- .../WifiConnectionMgrConfigNVDataStruct.h | 2 +- .../WifiConnectionMgrDriver.c | 125 ++++++---- .../WifiConnectionMgrDxe.h | 4 +- .../WifiConnectionMgrImpl.c | 219 +++++++++++++++--- .../WifiConnectionMgrMisc.c | 13 ++ 8 files changed, 386 insertions(+), 73 deletions(-) create mode 100644 Ne= tworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h diff --git a/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h b/Networ= kPkg/Include/Protocol/WiFiProfileSyncProtocol.h new file mode 100644 index 0000000000..90523e30fa --- /dev/null +++ b/NetworkPkg/Include/Protocol/WiFiProfileSyncProtocol.h @@ -0,0 +1,90 @@ +/** @file + WiFi profile sync protocol. Supports One Click Recovery or KVM OS=20 +recovery + boot flow over WiFi. This protocol will hold the WiFi profile=20 +provided by AMT + in its original structure, then convert the profile when the=20 +WifiConnectionManager + is attempting a connection during a system recovery reboot, OCR or=20 +KVM. These + converstion and operations are found in the WifiProfileSync driver=20 +and in + the link provided below. + + Pulbic links to speficiation document for KVM and One Click Recovery fea= ture. + =20 + https://software.intel.com/sites/manageability/AMT_Implementation_and_ + Reference_Guide/default.htm?turl=3DWordDocuments%2Foneclickrecovery.htm + + 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=20 +shared + and was stored in WiFi profile protocol. Aligns the AMT WiFi profile=20 +data to + the WiFi connection manager profile structure fo connection use. + + @param[in, out] WcmProfile WiFi Connection Manager profile struct= ure + @param[in, out] MacAddress MAC address from AMT saved to NiC MAC = address + + @retval EFI_SUCCESS Stored WiFi profile converted and retu= rned succefully + @retval EFI_UNSUPPORTED Profile protocol sharing not supported= 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_S= TATUS 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=20 +Click + Recovery WLAN recovery flow. + + @retval EFI_SUCCESS WiFi connection completed succesfully + @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 SetConnectState; + WIFI_GET_CONNECT_STATE GetConnectState; + WIFI_PROFILE_GET GetProfile; +} EDKII_WIFI_PROFILE_SYNC_PROTOCOL; + +/** + WiFi Profile Protocol revision number. + + Revision 1: Initial version +**/ +#define EDKII_WIFI_PROFILE_SYNC_PROTOCOL_REVISION 1 + +#endif // WIFI_PROFILE_SYNC_PROTOCOL_H_ diff --git a/NetworkPkg/NetworkPkg.dec b/NetworkPkg/NetworkPkg.dec index 5e= 43ebf8c5..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,= =20 + 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.i= nf 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=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/WifiConnectionMgrConfigNVD= ataStruct.h b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNV= DataStruct.h index b5518a74d8..dcc4bf7e27 100644 --- a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDataStru= ct.h +++ b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrConfigNVDataS +++ truct.h @@ -25,7 +25,7 @@ =20 #define PASSWORD_MIN_LEN 8 #define PASSWORD_MAX_LEN 63 -#define PASSWORD_STORAGE_SIZE 64 +#define PASSWORD_STORAGE_SIZE 65 =20 #define EAP_IDENTITY_LEN 63 #define EAP_IDENTITY_SIZE 64 diff --git a/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c = b/NetworkPkg/WifiConnectionManagerDxe/WifiConnectionMgrDriver.c index 67a01ca058..0af55db599 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 WIFI_CON= FIG_NETWORK_LIST_REFRESH_G EFI_GUID mWifiConfigConnectFormRefreshGuid =3D WIFI_CONFIG_CONNECT_FORM_R= EFRESH_GUID; EFI_GUID mWifiConfigMainFormRefreshGuid =3D WIFI_CONFIG_MAIN_FORM_REFR= ESH_GUID; =20 +// +// Wifi connection attempt counter for retries // extern UINT8 =20 +mWifiConnectionCount; + /** Tests to see if this driver supports a given controller. If a child devi= ce is provided, it further tests to see if this driver supports creating a handle for th= e specified child device. @@ -167,8 +172,10 @@ WifiMgrDxeDriverBindingStart ( EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp; EFI_SUPPLICANT_PROTOCOL *Supplicant; EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; =20 - Nic =3D NULL; + mWifiConnectionCount =3D 0; + Nic =3D NULL; =20 // // Open Protocols @@ -236,47 +243,72 @@ 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 *)AllocateZer= oPool (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_PERIO= D_MILLISECONDS (500)); - if (EFI_ERROR (Status)) { - goto ERROR3; - } + WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic->= MacAddress); + if (Nic->ConnectPendingNetwork !=3D NULL) { + Status =3D WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwork)= ; + if (!EFI_ERROR (Status)) { + goto ERROR1; + } + WiFiProfileSyncProtocol->SetConnectState (Status); + } + } 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_PER= IOD_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 +417,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; + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; =20 Status =3D gBS->OpenProtocol ( ControllerHandle, @@ -481,7 +514,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/N= etworkPkg/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/Netw= orkPkg/WifiConnectionManagerDxe/WifiConnectionMgrImpl.c b/NetworkPkg/WifiCo= nnectionManagerDxe/WifiConnectionMgrImpl.c index 59bac48c42..7d471e7591 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 mWifiConnectionCount =3D 0; + /** The callback function for scan operation. This function updates networks 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) * s= izeof (UINT8)); + if (StrLen (Profile->Password) >=3D 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, PASSWO= RD_STORAGE_SIZE); - Status =3D Supplicant->SetData ( - Supplicant, - EfiSupplicant80211PskPassword, - AsciiPassword, - (StrLen (Profile->Password) + 1) * sizeof (UINT8) - ); + Status =3D UnicodeStrToAsciiStrS (Profile->Password, (CHAR8=20 + *)AsciiPassword, (StrLen (Profile->Password) + 1)); if (!EFI_ERROR (Stat= us)) { + Status =3D Supplicant->SetData ( + Supplicant, + EfiSupplicant80211PskPassword, + AsciiPassword, + (StrLen (Profile->Password) + 1) * sizeof (CHAR= 8) + ); + } + ZeroMem (AsciiPassword, AsciiStrLen ((CHAR8 *)AsciiPassword) + 1); FreePool (AsciiPassword); =20 @@ -465,19 +475,20 @@ WifiMgrConfigEap ( IN WIFI_MGR_NETWORK_PROFILE *Profile ) { - EFI_STATUS Status; - EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; - EFI_EAP_TYPE EapAuthMethod; - EFI_EAP_TYPE EapSecondAuthMethod; - EFI_EAP_TYPE *AuthMethodList; - CHAR8 *Identity; - UINTN IdentitySize; - CHAR16 *Password; - UINTN PasswordSize; - UINTN EncryptPasswordLen; - CHAR8 *AsciiEncryptPassword; - UINTN AuthMethodListSize; - UINTN Index; + EFI_STATUS Status; + EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol; + EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig; + EFI_EAP_TYPE EapAuthMethod; + EFI_EAP_TYPE EapSecondAuthMethod; + EFI_EAP_TYPE *AuthMethodList; + CHAR8 *Identity; + UINTN IdentitySize; + CHAR16 *Password; + UINTN PasswordSize; + UINTN EncryptPasswordLen; + CHAR8 *AsciiEncryptPassword; + UINTN AuthMethodListSize; + UINTN Index; =20 if ((Nic =3D=3D NULL) || (Nic->EapConfig =3D=3D NULL) || (Profile =3D=3D= NULL)) { return EFI_INVALID_PARAMETER; @@ -567,7 +578,13 @@ WifiMgrConfigEap ( return EFI_OUT_OF_RESOURCES; } =20 - UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize); + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL= , (VOID **)&WiFiProfileSyncProtocol); + if (!EFI_ERROR (Status)) { + CopyMem (Identity, &Profile->EapIdentity, IdentitySize); + } else { + UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize)= ; + } + Status =3D EapConfig->SetData ( EapConfig, EFI_EAP_TYPE_IDENTITY, @@ -892,6 +909,133 @@ Wif= iMgrPrepareConnection ( 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 conne= ct. + + @retval EFI_SUCCESS The operation is completed. + @retval other Operation failure. + +**/ +EFI_STATUS +ConnectionRetry ( + IN EDKII_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=20 + 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 *)AllocateZer= oPool (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 m= emory for ConnectPendingNetwork\n")); + goto ERROR; + } + + Status =3D WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNet= work, Nic->MacAddress); + if (!EFI_ERROR (Status) && (Nic->ConnectPendingNetwork !=3D NULL)) { + Status =3D WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwork)= ; + if (!EFI_ERROR (Status)) { + return Status; + } + } else { + DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get WiFi p= rofile 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; + EDKII_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, NULL,= =20 + (VOID **)&WiFiProfileSyncProtocol); if (!EFI_ERROR (Status)) { + WiFiProfileSyncProtocol->SetConnectState (ConfigToken->Token.ConnectNe= tworkToken->ResultCode); + if ((mWifiConnectionCount < MAX_WIFI_CONNETION_ATTEMPTS) && + (ConfigToken->Token.ConnectNetworkToken->ResultCode !=3D ConnectSu= ccess)) + { + mWifiConnectionCount++; + gBS->CloseEvent (Event); + Status =3D ConnectionRetry (WiFiProfileSyncProtocol); + if (!EFI_ERROR (Status)) { + return; + } + + WiFiProfileSyncProtocol->SetConnectState (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..518572922f 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; + EDKII_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=20 + performing a recovery boot in secure // boot mode. The profile sync=20 + driver will manage the CA certificate, client certificate, and key // d= ata, cleaning them at exit boot services. + // + Status =3D gBS->LocateProtocol (&gEfiWiFiProfileSyncProtocolGuid, NULL,= =20 + (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