--- /dev/null
+/** @file\r
+ WiFi profile sync protocol. Supports One Click Recovery or KVM OS recovery\r
+ boot flow over WiFi. This protocol will hold the WiFi profile provided by AMT\r
+ in its original structure, then convert the profile when the WifiConnectionManager\r
+ is attempting a connection during a system recovery reboot, OCR or KVM. These\r
+ converstion and operations are found in the WifiProfileSync driver and in\r
+ the link provided below.\r
+\r
+ This protocol facilitates the reporting and storing of the connection state\r
+ incase of failure, to which a connection attempt will rety a maximum of 3 times.\r
+\r
+ Pulbic links to speficiation document for KVM and One Click Recovery feature.\r
+ https://software.intel.com/sites/manageability/AMT_Implementation_and_Reference_Guide/default.htm?turl=WordDocuments%2Foneclickrecovery.htm\r
+\r
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#ifndef WIFI_PROFILE_SYNC_PROTOCOL_H_\r
+#define WIFI_PROFILE_SYNC_PROTOCOL_H_\r
+\r
+#include <WifiConnectionManagerDxe/WifiConnectionMgrConfig.h>\r
+\r
+//\r
+// WiFi Profile Sync Protocol GUID variable.\r
+//\r
+extern EFI_GUID gEdkiiWiFiProfileSyncProtocolGuid;\r
+\r
+/**\r
+ Used by the WiFi connection manager to get the WiFi profile that AMT shared\r
+ and was stored in WiFi profile protocol. Aligns the AMT WiFi profile data to\r
+ the WiFi connection manager profile structure fo connection use.\r
+\r
+ @param[in, out] WcmProfile WiFi Connection Manager profile structure\r
+ @param[in, out] MacAddress MAC address from AMT saved to NiC MAC address\r
+\r
+ @retval EFI_SUCCESS Stored WiFi profile converted and returned succefully\r
+ @retval EFI_UNSUPPORTED Profile protocol sharing not supported or enabled\r
+ @retval EFI_NOT_FOUND No profiles to returned\r
+ @retval Others Error Occurred\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *WIFI_PROFILE_GET)(\r
+ IN OUT WIFI_MGR_NETWORK_PROFILE *Profile,\r
+ IN OUT EFI_80211_MAC_ADDRESS MacAddress\r
+ );\r
+\r
+/**\r
+ Saves the WiFi connection status recieved by the WiFiConnectionManager when\r
+ in a KVM OR One Click Recovery WLAN recovery flow. Input as\r
+ EFI_80211_CONNECT_NETWORK_RESULT_CODE then converted and stored as EFI_STATUS type.\r
+\r
+ @param[in] ConnectionStatus WiFi connection attempt results\r
+**/\r
+typedef\r
+VOID\r
+(EFIAPI *WIFI_SET_CONNECT_STATE)(\r
+ IN EFI_80211_CONNECT_NETWORK_RESULT_CODE ConnectionStatus\r
+ );\r
+\r
+/**\r
+ Retrieves the stored WiFi connection status when in either KVM OR One Click\r
+ Recovery WLAN recovery flow.\r
+\r
+ @retval EFI_SUCCESS WiFi connection completed succesfully\r
+ @retval Others Connection failure occurred\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *WIFI_GET_CONNECT_STATE)(\r
+ VOID\r
+ );\r
+\r
+//\r
+// WiFi Profile Sync Protocol structure.\r
+//\r
+typedef struct {\r
+ UINT32 Revision;\r
+ WIFI_SET_CONNECT_STATE SetConnectState;\r
+ WIFI_GET_CONNECT_STATE GetConnectState;\r
+ WIFI_PROFILE_GET GetProfile;\r
+} EDKII_WIFI_PROFILE_SYNC_PROTOCOL;\r
+\r
+/**\r
+ WiFi Profile Protocol revision number.\r
+\r
+ Revision 1: Initial version\r
+**/\r
+#define EDKII_WIFI_PROFILE_SYNC_PROTOCOL_REVISION 1\r
+\r
+#endif // WIFI_PROFILE_SYNC_PROTOCOL_H_\r
## Include/Protocol/HttpCallback.h\r
gEdkiiHttpCallbackProtocolGuid = {0x611114f1, 0xa37b, 0x4468, {0xa4, 0x36, 0x5b, 0xdd, 0xa1, 0x6a, 0xa2, 0x40}}\r
\r
+ ## Include/Protocol/WiFiProfileSyncProtocol.h\r
+ gEdkiiWiFiProfileSyncProtocolGuid = {0x399a2b8a, 0xc267, 0x44aa, {0x9a, 0xb4, 0x30, 0x58, 0x8c, 0xd2, 0x2d, 0xcc}}\r
+\r
[PcdsFixedAtBuild]\r
## The max attempt number will be created by iSCSI driver.\r
# @Prompt Max attempt number.\r
# 2). WPA2 Personal Network\r
# 3). EAP Networks (EAP-TLS, EAP-TTLS/MSCHAPv2 and PEAPv0/MSCHAPv2)\r
#\r
-# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
#\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
#\r
gEfiAdapterInformationProtocolGuid ## SOMETIMES_CONSUMES\r
gEfiSupplicantProtocolGuid ## SOMETIMES_CONSUMES\r
gEfiEapConfigurationProtocolGuid ## SOMETIMES_CONSUMES\r
+ gEdkiiWiFiProfileSyncProtocolGuid ## SOMETIMES_CONSUMES\r
\r
[Guids]\r
gWifiConfigGuid ## PRODUCES ## GUID\r
\r
#define PASSWORD_MIN_LEN 8\r
#define PASSWORD_MAX_LEN 63\r
-#define PASSWORD_STORAGE_SIZE 64\r
+#define PASSWORD_STORAGE_SIZE 65\r
\r
#define EAP_IDENTITY_LEN 63\r
#define EAP_IDENTITY_SIZE 64\r
/** @file\r
The driver binding protocol for the WiFi Connection Manager.\r
\r
- Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
EFI_GUID mWifiConfigConnectFormRefreshGuid = WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID;\r
EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;\r
\r
+//\r
+// Wifi connection attempt counter for retries\r
+//\r
+extern UINT8 mWifiConnectionCount;\r
+\r
/**\r
Tests to see if this driver supports a given controller. If a child device is provided,\r
it further tests to see if this driver supports creating a handle for the specified child device.\r
EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp;\r
EFI_SUPPLICANT_PROTOCOL *Supplicant;\r
EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;\r
+ EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol;\r
\r
- Nic = NULL;\r
+ mWifiConnectionCount = 0;\r
+ Nic = NULL;\r
\r
//\r
// Open Protocols\r
InitializeListHead (&Nic->ProfileList);\r
\r
//\r
- // Record the MAC address of the incoming NIC.\r
+ // WiFi profile sync protocol installation check for OS recovery flow.\r
//\r
- Status = NetLibGetMacAddress (\r
- ControllerHandle,\r
- (EFI_MAC_ADDRESS *)&Nic->MacAddress,\r
- &AddressSize\r
- );\r
- if (EFI_ERROR (Status)) {\r
- goto ERROR2;\r
- }\r
-\r
- //\r
- // Create and start the timer for the status check\r
- //\r
- Status = gBS->CreateEvent (\r
- EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
- TPL_CALLBACK,\r
- WifiMgrOnTimerTick,\r
- Nic,\r
- &Nic->TickTimer\r
+ Status = gBS->LocateProtocol (\r
+ &gEdkiiWiFiProfileSyncProtocolGuid,\r
+ NULL,\r
+ (VOID **)&WiFiProfileSyncProtocol\r
);\r
- if (EFI_ERROR (Status)) {\r
- goto ERROR2;\r
- }\r
+ if (!EFI_ERROR (Status)) {\r
+ Nic->ConnectPendingNetwork = (WIFI_MGR_NETWORK_PROFILE *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE));\r
+ if (Nic->ConnectPendingNetwork == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ goto ERROR1;\r
+ }\r
\r
- Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));\r
- if (EFI_ERROR (Status)) {\r
- goto ERROR3;\r
- }\r
+ WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic->MacAddress);\r
+ if (Nic->ConnectPendingNetwork != NULL) {\r
+ Status = WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwork);\r
+ if (!EFI_ERROR (Status)) {\r
+ goto ERROR1;\r
+ }\r
+\r
+ WiFiProfileSyncProtocol->SetConnectState (Status);\r
+ }\r
+ } else {\r
+ //\r
+ // Record the MAC address of the incoming NIC.\r
+ //\r
+ Status = NetLibGetMacAddress (\r
+ ControllerHandle,\r
+ (EFI_MAC_ADDRESS *)&Nic->MacAddress,\r
+ &AddressSize\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ERROR2;\r
+ }\r
\r
- Nic->ConnectState = WifiMgrDisconnected;\r
- Nic->ScanState = WifiMgrScanFinished;\r
+ //\r
+ // Create and start the timer for the status check\r
+ //\r
+ Status = gBS->CreateEvent (\r
+ EVT_NOTIFY_SIGNAL | EVT_TIMER,\r
+ TPL_CALLBACK,\r
+ WifiMgrOnTimerTick,\r
+ Nic,\r
+ &Nic->TickTimer\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto ERROR2;\r
+ }\r
\r
- OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
- InsertTailList (&mPrivate->NicList, &Nic->Link);\r
- Nic->NicIndex = mPrivate->NicCount++;\r
- if (mPrivate->CurrentNic == NULL) {\r
- mPrivate->CurrentNic = Nic;\r
- }\r
+ Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));\r
+ if (EFI_ERROR (Status)) {\r
+ goto ERROR3;\r
+ }\r
\r
- gBS->RestoreTPL (OldTpl);\r
+ Nic->ConnectState = WifiMgrDisconnected;\r
+ Nic->ScanState = WifiMgrScanFinished;\r
+\r
+ OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
+ InsertTailList (&mPrivate->NicList, &Nic->Link);\r
+ Nic->NicIndex = mPrivate->NicCount++;\r
+ if (mPrivate->CurrentNic == NULL) {\r
+ mPrivate->CurrentNic = Nic;\r
+ }\r
+\r
+ gBS->RestoreTPL (OldTpl);\r
+ }\r
\r
Status = gBS->InstallProtocolInterface (\r
&ControllerHandle,\r
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_TPL OldTpl;\r
- WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier;\r
- WIFI_MGR_DEVICE_DATA *Nic;\r
+ EFI_STATUS Status;\r
+ EFI_TPL OldTpl;\r
+ WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrIdentifier;\r
+ WIFI_MGR_DEVICE_DATA *Nic;\r
+ EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol;\r
\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
//\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
- RemoveEntryList (&Nic->Link);\r
+ Status = gBS->LocateProtocol (\r
+ &gEdkiiWiFiProfileSyncProtocolGuid,\r
+ NULL,\r
+ (VOID **)&WiFiProfileSyncProtocol\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ RemoveEntryList (&Nic->Link);\r
+ }\r
+\r
mPrivate->NicCount--;\r
if (mPrivate->CurrentNic == Nic) {\r
mPrivate->CurrentNic = NULL;\r
#include <Protocol/SimpleNetwork.h>\r
#include <Protocol/SimpleFileSystem.h>\r
#include <Protocol/EapConfiguration.h>\r
+#include <Protocol/WiFiProfileSyncProtocol.h>\r
\r
//\r
// Produced Protocols\r
//\r
#define WIFI_MGR_DXE_VERSION 0xb\r
\r
-#define OUI_IEEE_80211I 0xAC0F00\r
+#define OUI_IEEE_80211I 0xAC0F00\r
+#define MAX_WIFI_CONNETION_ATTEMPTS 3\r
\r
typedef enum {\r
Ieee80211PairwiseCipherSuiteUseGroupCipherSuite = 0,\r
EFI_EAP_TYPE_MSCHAPV2\r
};\r
\r
+UINT8 mWifiConnectionCount = 0;\r
+\r
/**\r
The callback function for scan operation. This function updates networks\r
according to the latest scan result, and trigger UI refresh.\r
return EFI_NOT_FOUND;\r
}\r
\r
- AsciiPassword = AllocateZeroPool ((StrLen (Profile->Password) + 1) * sizeof (UINT8));\r
+ if (StrLen (Profile->Password) >= PASSWORD_STORAGE_SIZE) {\r
+ ASSERT (EFI_INVALID_PARAMETER);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ AsciiPassword = AllocateZeroPool ((StrLen (Profile->Password) + 1) * sizeof (CHAR8));\r
if (AsciiPassword == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPassword, PASSWORD_STORAGE_SIZE);\r
- Status = Supplicant->SetData (\r
- Supplicant,\r
- EfiSupplicant80211PskPassword,\r
- AsciiPassword,\r
- (StrLen (Profile->Password) + 1) * sizeof (UINT8)\r
- );\r
+ Status = UnicodeStrToAsciiStrS (Profile->Password, (CHAR8 *)AsciiPassword, (StrLen (Profile->Password) + 1));\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = Supplicant->SetData (\r
+ Supplicant,\r
+ EfiSupplicant80211PskPassword,\r
+ AsciiPassword,\r
+ (StrLen (Profile->Password) + 1) * sizeof (CHAR8)\r
+ );\r
+ }\r
+\r
ZeroMem (AsciiPassword, AsciiStrLen ((CHAR8 *)AsciiPassword) + 1);\r
FreePool (AsciiPassword);\r
\r
IN WIFI_MGR_NETWORK_PROFILE *Profile\r
)\r
{\r
- EFI_STATUS Status;\r
- EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;\r
- EFI_EAP_TYPE EapAuthMethod;\r
- EFI_EAP_TYPE EapSecondAuthMethod;\r
- EFI_EAP_TYPE *AuthMethodList;\r
- CHAR8 *Identity;\r
- UINTN IdentitySize;\r
- CHAR16 *Password;\r
- UINTN PasswordSize;\r
- UINTN EncryptPasswordLen;\r
- CHAR8 *AsciiEncryptPassword;\r
- UINTN AuthMethodListSize;\r
- UINTN Index;\r
+ EFI_STATUS Status;\r
+ EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol;\r
+ EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;\r
+ EFI_EAP_TYPE EapAuthMethod;\r
+ EFI_EAP_TYPE EapSecondAuthMethod;\r
+ EFI_EAP_TYPE *AuthMethodList;\r
+ CHAR8 *Identity;\r
+ UINTN IdentitySize;\r
+ CHAR16 *Password;\r
+ UINTN PasswordSize;\r
+ UINTN EncryptPasswordLen;\r
+ CHAR8 *AsciiEncryptPassword;\r
+ UINTN AuthMethodListSize;\r
+ UINTN Index;\r
\r
if ((Nic == NULL) || (Nic->EapConfig == NULL) || (Profile == NULL)) {\r
return EFI_INVALID_PARAMETER;\r
return EFI_OUT_OF_RESOURCES;\r
}\r
\r
- UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize);\r
+ Status = gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, NULL, (VOID **)&WiFiProfileSyncProtocol);\r
+ if (!EFI_ERROR (Status)) {\r
+ CopyMem (Identity, &Profile->EapIdentity, IdentitySize);\r
+ } else {\r
+ UnicodeStrToAsciiStrS (Profile->EapIdentity, Identity, IdentitySize);\r
+ }\r
+\r
Status = EapConfig->SetData (\r
EapConfig,\r
EFI_EAP_TYPE_IDENTITY,\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Will reset NiC data, get profile from profile sync driver, and send for\r
+ another connection attempt.This function should not be called more than\r
+ 3 times.\r
+\r
+ @param[in] WiFiProfileSyncProtocol The target network profile to connect.\r
+\r
+ @retval EFI_SUCCESS The operation is completed.\r
+ @retval other Operation failure.\r
+\r
+**/\r
+EFI_STATUS\r
+ConnectionRetry (\r
+ IN EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ WIFI_MGR_DEVICE_DATA *Nic;\r
+ EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp;\r
+ EFI_SUPPLICANT_PROTOCOL *Supplicant;\r
+ EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;\r
+\r
+ Nic = NULL;\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiWiFi2ProtocolGuid,\r
+ NULL,\r
+ (VOID **)&Wmp\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiSupplicantProtocolGuid,\r
+ NULL,\r
+ (VOID **)&Supplicant\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ Supplicant = NULL;\r
+ }\r
+\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiEapConfigurationProtocolGuid,\r
+ NULL,\r
+ (VOID **)&EapConfig\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ EapConfig = NULL;\r
+ }\r
+\r
+ //\r
+ // Initialize Nic device data\r
+ //\r
+ Nic = AllocateZeroPool (sizeof (WIFI_MGR_DEVICE_DATA));\r
+ if (Nic == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ return Status;\r
+ }\r
+\r
+ Nic->Signature = WIFI_MGR_DEVICE_DATA_SIGNATURE;\r
+ Nic->Private = mPrivate;\r
+ Nic->Wmp = Wmp;\r
+ Nic->Supplicant = Supplicant;\r
+ Nic->EapConfig = EapConfig;\r
+ Nic->UserSelectedProfile = NULL;\r
+ Nic->OneTimeScanRequest = FALSE;\r
+\r
+ if (Nic->Supplicant != NULL) {\r
+ Status = WifiMgrGetSupportedSuites (Nic);\r
+ }\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ InitializeListHead (&Nic->ProfileList);\r
+\r
+ Nic->ConnectPendingNetwork = (WIFI_MGR_NETWORK_PROFILE *)AllocateZeroPool (sizeof (WIFI_MGR_NETWORK_PROFILE));\r
+ if (Nic->ConnectPendingNetwork == NULL) {\r
+ Status = EFI_OUT_OF_RESOURCES;\r
+ DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to allocate memory for ConnectPendingNetwork\n"));\r
+ goto ERROR;\r
+ }\r
+\r
+ Status = WiFiProfileSyncProtocol->GetProfile (Nic->ConnectPendingNetwork, Nic->MacAddress);\r
+ if (!EFI_ERROR (Status) && (Nic->ConnectPendingNetwork != NULL)) {\r
+ Status = WifiMgrConnectToNetwork (Nic, Nic->ConnectPendingNetwork);\r
+ if (!EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get WiFi profile with status %r\n", Status));\r
+ }\r
+ } else {\r
+ DEBUG ((DEBUG_ERROR, "[WiFi Connection Manager] Failed to get Supported suites with status %r\n", Status));\r
+ }\r
+\r
+ if (Nic->ConnectPendingNetwork != NULL) {\r
+ if (Nic->ConnectPendingNetwork->Network.AKMSuite != NULL) {\r
+ FreePool (Nic->ConnectPendingNetwork->Network.AKMSuite);\r
+ }\r
+\r
+ if (Nic->ConnectPendingNetwork->Network.CipherSuite != NULL) {\r
+ FreePool (Nic->ConnectPendingNetwork->Network.CipherSuite);\r
+ }\r
+\r
+ FreePool (Nic->ConnectPendingNetwork);\r
+ }\r
+\r
+ERROR:\r
+ if (Nic->Supplicant != NULL) {\r
+ if (Nic->SupportedSuites.SupportedAKMSuites != NULL) {\r
+ FreePool (Nic->SupportedSuites.SupportedAKMSuites);\r
+ }\r
+\r
+ if (Nic->SupportedSuites.SupportedSwCipherSuites != NULL) {\r
+ FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);\r
+ }\r
+\r
+ if (Nic->SupportedSuites.SupportedHwCipherSuites != NULL) {\r
+ FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);\r
+ }\r
+ }\r
+\r
+ FreePool (Nic);\r
+\r
+ return Status;\r
+}\r
+\r
/**\r
The callback function for connect operation.\r
\r
IN VOID *Context\r
)\r
{\r
- EFI_STATUS Status;\r
- WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken;\r
- WIFI_MGR_NETWORK_PROFILE *ConnectedProfile;\r
- UINT8 SecurityType;\r
- UINT8 SSIdLen;\r
- CHAR8 *AsciiSSId;\r
+ EFI_STATUS Status;\r
+ WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken;\r
+ WIFI_MGR_NETWORK_PROFILE *ConnectedProfile;\r
+ UINT8 SecurityType;\r
+ UINT8 SSIdLen;\r
+ CHAR8 *AsciiSSId;\r
+ EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol;\r
\r
ASSERT (Context != NULL);\r
\r
ASSERT (ConfigToken->Type == TokenTypeConnectNetworkToken);\r
\r
ASSERT (ConfigToken->Token.ConnectNetworkToken != NULL);\r
+\r
+ Status = gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, NULL, (VOID **)&WiFiProfileSyncProtocol);\r
+ if (!EFI_ERROR (Status)) {\r
+ WiFiProfileSyncProtocol->SetConnectState (ConfigToken->Token.ConnectNetworkToken->ResultCode);\r
+ if ((mWifiConnectionCount < MAX_WIFI_CONNETION_ATTEMPTS) &&\r
+ (ConfigToken->Token.ConnectNetworkToken->ResultCode != ConnectSuccess))\r
+ {\r
+ mWifiConnectionCount++;\r
+ gBS->CloseEvent (Event);\r
+ Status = ConnectionRetry (WiFiProfileSyncProtocol);\r
+ if (!EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
+ WiFiProfileSyncProtocol->SetConnectState (Status);\r
+ }\r
+ }\r
+\r
if (ConfigToken->Token.ConnectNetworkToken->Status != EFI_SUCCESS) {\r
if (ConfigToken->Nic->OneTimeConnectRequest) {\r
//\r
IN WIFI_MGR_NETWORK_PROFILE *Profile\r
)\r
{\r
+ EFI_STATUS Status;\r
+ EDKII_WIFI_PROFILE_SYNC_PROTOCOL *WiFiProfileSyncProtocol;\r
+\r
ZeroMem (Profile->Password, sizeof (CHAR16) * PASSWORD_STORAGE_SIZE);\r
ZeroMem (Profile->EapPassword, sizeof (CHAR16) * PASSWORD_STORAGE_SIZE);\r
ZeroMem (Profile->PrivateKeyPassword, sizeof (CHAR16) * PASSWORD_STORAGE_SIZE);\r
\r
+ //\r
+ // When EFI WiFi profile sync protocol is found the system is performing a recovery boot in secure\r
+ // boot mode. The profile sync driver will manage the CA certificate, client certificate, and key\r
+ // data, cleaning them at exit boot services.\r
+ //\r
+ Status = gBS->LocateProtocol (&gEdkiiWiFiProfileSyncProtocolGuid, NULL, (VOID **)&WiFiProfileSyncProtocol);\r
+ if (!EFI_ERROR (Status)) {\r
+ return;\r
+ }\r
+\r
if (Profile->CACertData != NULL) {\r
ZeroMem (Profile->CACertData, Profile->CACertSize);\r
FreePool (Profile->CACertData);\r