12CHAR16 mVendorStorageName[] = L
"WIFI_MANAGER_IFR_NVDATA";
24 WIFI_CONNECTION_MANAGER_CONFIG_GUID
28 END_ENTIRE_DEVICE_PATH_SUBTYPE,
30 (UINT8)(END_DEVICE_PATH_LENGTH),
31 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
46CHAR16 *mSecurityType[] = {
58CHAR16 *mSignalStrengthBar[] = {
67#define RSSI_TO_SIGNAL_STRENGTH_BAR(Rssi) mSignalStrengthBar[((Rssi + 19)/20)]
69#define NET_LIST_FOR_EACH_FROM_NODE(Entry, Node, ListHead) \
70 for(Entry = Node->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
72extern EFI_GUID gWifiConfigFormSetGuid;
91 IN UINT16 StartLabelNumber,
92 OUT VOID **StartOpCodeHandle,
93 OUT VOID **EndOpCodeHandle
100 if ((StartOpCodeHandle ==
NULL) || (EndOpCodeHandle ==
NULL)) {
101 return EFI_INVALID_PARAMETER;
104 Status = EFI_OUT_OF_RESOURCES;
105 *StartOpCodeHandle =
NULL;
106 *EndOpCodeHandle =
NULL;
112 if (*StartOpCodeHandle ==
NULL) {
117 if (*EndOpCodeHandle ==
NULL) {
130 if (InternalStartLabel ==
NULL) {
135 InternalStartLabel->
Number = StartLabelNumber;
146 if (InternalEndLabel ==
NULL) {
151 InternalEndLabel->
Number = LABEL_END;
157 if (*StartOpCodeHandle !=
NULL) {
161 if (*EndOpCodeHandle !=
NULL) {
183 CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
184 CHAR16 PortString[WIFI_STR_MAX_SIZE];
185 EFI_STRING_ID PortTitleToken;
186 EFI_STRING_ID PortTitleHelpToken;
189 VOID *StartOpCodeHandle;
190 VOID *EndOpCodeHandle;
192 if (Private ==
NULL) {
193 return EFI_INVALID_PARAMETER;
201 if (EFI_ERROR (Status)) {
205 NET_LIST_FOR_EACH (Entry, &Private->NicList) {
206 Nic = NET_LIST_USER_STRUCT_S (Entry,
WIFI_MGR_DEVICE_DATA, Link, WIFI_MGR_DEVICE_DATA_SIGNATURE);
208 UnicodeSPrint (PortString,
sizeof (PortString), L
"MAC %s", MacString);
210 Private->RegisteredHandle,
215 if (PortTitleToken == 0) {
216 Status = EFI_INVALID_PARAMETER;
220 UnicodeSPrint (PortString,
sizeof (PortString), L
"MAC Address");
222 Private->RegisteredHandle,
227 if (PortTitleHelpToken == 0) {
228 Status = EFI_INVALID_PARAMETER;
234 FORMID_WIFI_MAINPAGE,
237 EFI_IFR_FLAG_CALLBACK,
238 (UINT16)(KEY_MAC_ENTRY_BASE + Nic->NicIndex)
243 Private->RegisteredHandle,
244 &gWifiConfigFormSetGuid,
245 FORMID_MAC_SELECTION,
272 UINT16 AKMSuiteCount;
273 CHAR16 *AKMListDisplay;
276 AKMListDisplay =
NULL;
277 if ((Profile ==
NULL) || (Profile->Network.AKMSuite ==
NULL)) {
281 AKMSuiteCount = Profile->Network.AKMSuite->AKMSuiteCount;
282 if (AKMSuiteCount != 0) {
286 AKMListDisplay = (CHAR16 *)
AllocateZeroPool (
sizeof (CHAR16) * (AKMSuiteCount * 3 + 1));
288 if (AKMListDisplay !=
NULL) {
289 for (Index = 0; Index < AKMSuiteCount; Index++) {
294 AKMListDisplay + Length,
297 Profile->Network.AKMSuite->AKMSuiteList[Index].SuiteType
299 Length =
StrLen (AKMListDisplay + Length) + Length;
300 if (Index == AKMSuiteCount - 1) {
301 *(AKMListDisplay + (Length - 1)) = L
'\0';
309 if (AKMListDisplay ==
NULL) {
313 return AKMListDisplay;
331 UINT16 CipherSuiteCount;
332 CHAR16 *CipherListDisplay;
334 CipherListDisplay =
NULL;
335 if ((Profile ==
NULL) || (Profile->Network.CipherSuite ==
NULL)) {
339 CipherSuiteCount = Profile->Network.CipherSuite->CipherSuiteCount;
340 if (CipherSuiteCount != 0) {
344 CipherListDisplay = (CHAR16 *)
AllocateZeroPool (
sizeof (CHAR16) * (CipherSuiteCount * 2 + 1));
345 if (CipherListDisplay !=
NULL) {
346 for (Index = 0; Index < CipherSuiteCount; Index++) {
352 CipherListDisplay + (Index * 2),
355 Profile->Network.CipherSuite->CipherSuiteList[Index].SuiteType
357 if (Index == CipherSuiteCount - 1) {
358 *(CipherListDisplay + (Index * 2 + 1)) = L
'\0';
366 if (CipherListDisplay ==
NULL) {
370 return CipherListDisplay;
393 UINT32 AvailableCount;
394 EFI_STRING_ID PortPromptToken;
395 EFI_STRING_ID PortTextToken;
396 EFI_STRING_ID PortHelpToken;
399 VOID *StartOpCodeHandle;
400 VOID *EndOpCodeHandle;
401 CHAR16 *AKMListDisplay;
402 CHAR16 *CipherListDisplay;
403 CHAR16 PortString[WIFI_STR_MAX_SIZE];
404 UINTN PortStringSize;
407 if (Private->CurrentNic ==
NULL) {
412 LABEL_NETWORK_LIST_ENTRY,
416 if (EFI_ERROR (Status)) {
420 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
422 PortStringSize =
sizeof (PortString);
423 ConnectedProfile =
NULL;
424 AKMListDisplay =
NULL;
425 CipherListDisplay =
NULL;
427 if (Private->CurrentNic->ConnectState == WifiMgrConnectedToAp) {
432 if ((Private->CurrentNic->CurrentOperateNetwork !=
NULL) &&
433 Private->CurrentNic->CurrentOperateNetwork->IsAvailable)
435 Profile = Private->CurrentNic->CurrentOperateNetwork;
439 if (AKMListDisplay ==
NULL) {
440 Status = EFI_OUT_OF_RESOURCES;
445 if (CipherListDisplay ==
NULL) {
446 Status = EFI_OUT_OF_RESOURCES;
450 UnicodeSPrint (PortString, PortStringSize, L
"%s (Connected)", Profile->SSId);
451 PortPromptToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
453 if (Profile->SecurityType == SECURITY_TYPE_NONE) {
456 UnicodeSPrint (PortString, PortStringSize, L
"AKMSuite: %s CipherSuite: %s", AKMListDisplay, CipherListDisplay);
457 PortHelpToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
462 AKMListDisplay =
NULL;
463 CipherListDisplay =
NULL;
467 FORMID_CONNECT_NETWORK,
470 EFI_IFR_FLAG_CALLBACK,
471 (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
478 (Profile->SecurityType != SECURITY_TYPE_NONE ? L
"Secured" : L
"Open "),
479 mSecurityType[Profile->SecurityType],
480 RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
482 PortTextToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
491 ConnectedProfile = Profile;
493 Private->CurrentNic->HasDisconnectPendingNetwork =
TRUE;
500 NET_LIST_FOR_EACH (Entry, &Private->CurrentNic->ProfileList) {
501 Profile = NET_LIST_USER_STRUCT_S (
505 WIFI_MGR_PROFILE_SIGNATURE
507 if (ConnectedProfile == Profile) {
511 if (Profile->IsAvailable && Profile->CipherSuiteSupported) {
515 if (AKMListDisplay ==
NULL) {
516 Status = EFI_OUT_OF_RESOURCES;
521 if (CipherListDisplay ==
NULL) {
522 Status = EFI_OUT_OF_RESOURCES;
526 PortPromptToken =
HiiSetString (Private->RegisteredHandle, 0, Profile->SSId,
NULL);
527 if (PortPromptToken == 0) {
528 Status = EFI_OUT_OF_RESOURCES;
532 if (Profile->SecurityType == SECURITY_TYPE_NONE) {
538 L
"AKMSuite: %s CipherSuite: %s",
542 PortHelpToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
543 if (PortHelpToken == 0) {
544 Status = EFI_OUT_OF_RESOURCES;
551 AKMListDisplay =
NULL;
552 CipherListDisplay =
NULL;
556 FORMID_CONNECT_NETWORK,
559 EFI_IFR_FLAG_CALLBACK,
560 (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
567 (Profile->SecurityType != SECURITY_TYPE_NONE ? L
"Secured" : L
"Open "),
568 mSecurityType[Profile->SecurityType],
569 RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
571 PortTextToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
572 if (PortTextToken == 0) {
573 Status = EFI_OUT_OF_RESOURCES;
589 NET_LIST_FOR_EACH (Entry, &Private->CurrentNic->ProfileList) {
590 Profile = NET_LIST_USER_STRUCT_S (
594 WIFI_MGR_PROFILE_SIGNATURE
596 if (ConnectedProfile == Profile) {
600 if (Profile->IsAvailable && !Profile->CipherSuiteSupported) {
604 if (AKMListDisplay ==
NULL) {
605 Status = EFI_OUT_OF_RESOURCES;
610 if (CipherListDisplay ==
NULL) {
611 Status = EFI_OUT_OF_RESOURCES;
615 PortPromptToken =
HiiSetString (Private->RegisteredHandle, 0, Profile->SSId,
NULL);
617 if (Profile->AKMSuiteSupported) {
621 L
"AKMSuite: %s CipherSuite(UnSupported): %s",
629 L
"AKMSuite(UnSupported): %s CipherSuite(UnSupported): %s",
637 AKMListDisplay =
NULL;
638 CipherListDisplay =
NULL;
640 PortHelpToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
644 FORMID_CONNECT_NETWORK,
647 EFI_IFR_FLAG_CALLBACK,
648 (UINT16)(KEY_AVAILABLE_NETWORK_ENTRY_BASE + Profile->ProfileIndex)
656 mSecurityType[Profile->SecurityType],
657 RSSI_TO_SIGNAL_STRENGTH_BAR (Profile->NetworkQuality)
659 PortTextToken =
HiiSetString (Private->RegisteredHandle, 0, PortString,
NULL);
671 Private->RegisteredHandle,
672 &gWifiConfigFormSetGuid,
680 gBS->RestoreTPL (OldTpl);
682 if (AKMListDisplay !=
NULL) {
686 if (CipherListDisplay !=
NULL) {
693 DEBUG ((DEBUG_INFO,
"[WiFi Connection Manager] Network List is Refreshed!\n"));
714 EFI_STRING_ID StringId;
715 VOID *StartOpCodeHandle;
716 VOID *EndOpCodeHandle;
720 if (Private ==
NULL) {
725 LABEL_HIDDEN_NETWORK_ENTRY,
729 if (EFI_ERROR (Status)) {
733 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
736 NET_LIST_FOR_EACH (Entry, &Private->HiddenNetworkList) {
737 HiddenNetwork = NET_LIST_USER_STRUCT_S (
741 WIFI_MGR_HIDDEN_NETWORK_SIGNATURE
743 StringId =
HiiSetString (Private->RegisteredHandle, 0, HiddenNetwork->SSId,
NULL);
747 (EFI_QUESTION_ID)(KEY_HIDDEN_NETWORK_ENTRY_BASE + Index),
749 (UINT16)(HIDDEN_NETWORK_LIST_VAR_OFFSET + Index),
760 Private->RegisteredHandle,
761 &gWifiConfigFormSetGuid,
762 FORMID_HIDDEN_NETWORK_LIST,
767 gBS->RestoreTPL (OldTpl);
786 IN EFI_QUESTION_ID KeyValue
791 CHAR16 MacString[WIFI_MGR_MAX_MAC_STRING_LEN];
793 NicIndex = KeyValue - KEY_MAC_ENTRY_BASE;
796 return EFI_NOT_FOUND;
799 Private->CurrentNic = Nic;
818 Private->SecurityType = SECURITY_TYPE_NONE;
819 Private->EapAuthMethod = EAP_AUTH_METHOD_TTLS;
820 Private->EapSecondAuthMethod = EAP_SEAUTH_METHOD_MSCHAPV2;
821 Private->FileType = FileTypeMax;
838 IN UINT32 ProfileIndex
844 Nic = Private->CurrentNic;
846 return EFI_INVALID_PARAMETER;
855 if (Profile ==
NULL) {
856 return EFI_NOT_FOUND;
859 Private->CurrentNic->UserSelectedProfile = Profile;
880 IN EFI_STRING_ID StringId,
881 IN CHAR16 *StringBuffer,
887 if ((StringId == 0) || (StringBuffer ==
NULL) || (StringBufferLen <= 0)) {
888 return EFI_INVALID_PARAMETER;
892 if (Password ==
NULL) {
893 return EFI_NOT_FOUND;
896 if (
StrLen (Password) > StringBufferLen) {
898 return EFI_NOT_FOUND;
901 StrnCpyS (StringBuffer, StringBufferLen, Password,
StrLen (Password));
902 ZeroMem (Password, (
StrLen (Password) + 1) *
sizeof (CHAR16));
927 IN BOOLEAN ConnectStateChanged,
928 IN EFI_STRING ConnectStatusMessage
931 CHAR16 ConnectStatusStr[WIFI_STR_MAX_SIZE];
934 Private = Nic->Private;
935 if ((Private ==
NULL) || (Private->CurrentNic != Nic)) {
942 if (ConnectStatusMessage !=
NULL) {
945 if (Nic->ConnectState == WifiMgrConnectedToAp) {
948 sizeof (ConnectStatusStr),
950 Nic->CurrentOperateNetwork->SSId
953 }
else if (Nic->ConnectState == WifiMgrDisconnected) {
955 }
else if (Nic->ConnectState == WifiMgrConnectingToAp) {
958 sizeof (ConnectStatusStr),
959 L
"Connecting to %s ...",
960 Nic->CurrentOperateNetwork->SSId
963 }
else if (Nic->ConnectState == WifiMgrDisconnectingToAp) {
966 sizeof (ConnectStatusStr),
967 L
"Disconnecting from %s ...",
968 Nic->CurrentOperateNetwork->SSId
979 if ((Nic->ConnectState == WifiMgrConnectedToAp) && (Nic->UserSelectedProfile == Nic->CurrentOperateNetwork)) {
981 Private->RegisteredHandle,
983 L
"Disconnect from this Network",
990 gBS->SignalEvent (Private->ConnectFormRefreshEvent);
995 if (ConnectStateChanged) {
996 if (Nic->ConnectState == WifiMgrConnectedToAp) {
999 Private->RegisteredHandle,
1001 Nic->CurrentOperateNetwork->SSId,
1009 gBS->SignalEvent (Private->NetworkListRefreshEvent);
1010 gBS->SignalEvent (Private->MainPageRefreshEvent);
1032 ASSERT (Private !=
NULL);
1034 if (Private->CurrentNic !=
NULL) {
1035 IfrNvData->ProfileCount = Private->CurrentNic->AvailableCount;
1037 IfrNvData->ProfileCount = 0;
1136 OUT EFI_STRING *Progress,
1137 OUT EFI_STRING *Results
1142 EFI_STRING ConfigRequestHdr;
1143 EFI_STRING ConfigRequest;
1145 BOOLEAN AllocatedRequest;
1149 if ((This ==
NULL) || (Progress ==
NULL) || (Results ==
NULL)) {
1150 return EFI_INVALID_PARAMETER;
1153 *Progress = Request;
1154 if ((Request !=
NULL) &&
1157 return EFI_NOT_FOUND;
1160 ConfigRequestHdr =
NULL;
1161 ConfigRequest =
NULL;
1162 AllocatedRequest =
FALSE;
1165 Private = WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);
1169 if (IfrNvData ==
NULL) {
1170 return EFI_OUT_OF_RESOURCES;
1175 ConfigRequest = Request;
1176 if ((Request ==
NULL) || (
StrStr (Request, L
"OFFSET") ==
NULL)) {
1183 &gWifiConfigFormSetGuid,
1185 Private->DriverHandle
1187 if (ConfigRequestHdr ==
NULL) {
1189 return EFI_OUT_OF_RESOURCES;
1192 Size = (
StrLen (ConfigRequestHdr) + 32 + 1) *
sizeof (CHAR16);
1194 if (ConfigRequest ==
NULL) {
1197 return EFI_OUT_OF_RESOURCES;
1200 AllocatedRequest =
TRUE;
1204 L
"%s&OFFSET=0&WIDTH=%016LX",
1227 if (AllocatedRequest) {
1229 ConfigRequest =
NULL;
1235 if (Request ==
NULL) {
1237 }
else if (
StrStr (Request, L
"OFFSET") ==
NULL) {
1238 *Progress = Request +
StrLen (Request);
1287 IN CONST EFI_STRING Configuration,
1288 OUT EFI_STRING *Progress
1296 if ((Configuration ==
NULL) || (Progress ==
NULL)) {
1297 return EFI_INVALID_PARAMETER;
1301 *Progress = Configuration;
1303 Private = WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);
1306 return EFI_NOT_FOUND;
1310 if (IfrNvData ==
NULL) {
1311 return EFI_OUT_OF_RESOURCES;
1323 if (EFI_ERROR (Status)) {
1363 IN EFI_BROWSER_ACTION Action,
1364 IN EFI_QUESTION_ID QuestionId,
1367 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1384 CHAR16 *TempPassword;
1385 CHAR16 *ErrorMessage;
1387 if ((Action != EFI_BROWSER_ACTION_FORM_OPEN) &&
1388 (Action != EFI_BROWSER_ACTION_FORM_CLOSE) &&
1389 (Action != EFI_BROWSER_ACTION_CHANGING) &&
1390 (Action != EFI_BROWSER_ACTION_CHANGED) &&
1391 (Action != EFI_BROWSER_ACTION_RETRIEVE))
1393 return EFI_UNSUPPORTED;
1396 if ((Value ==
NULL) || (ActionRequest ==
NULL)) {
1397 return EFI_INVALID_PARAMETER;
1401 Private = WIFI_MGR_PRIVATE_DATA_FROM_CONFIG_ACCESS (This);
1402 if (Private->CurrentNic ==
NULL) {
1403 return EFI_DEVICE_ERROR;
1411 if (IfrNvData ==
NULL) {
1412 return EFI_OUT_OF_RESOURCES;
1415 if (Action != EFI_BROWSER_ACTION_FORM_OPEN) {
1416 HiiGetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *)IfrNvData);
1419 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
1420 switch (QuestionId) {
1426 case KEY_REFRESH_NETWORK_LIST:
1428 if (Private->CurrentNic->UserSelectedProfile !=
NULL) {
1429 Profile = Private->CurrentNic->UserSelectedProfile;
1438 Private->CurrentNic->UserSelectedProfile =
NULL;
1443 case KEY_ENROLLED_CERT_NAME:
1445 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1449 Profile = Private->CurrentNic->UserSelectedProfile;
1455 if (Private->FileType == FileTypeCACert) {
1456 if (Profile->CACertData !=
NULL) {
1461 }
else if (Private->FileType == FileTypeClientCert) {
1462 if (Profile->ClientCertData !=
NULL) {
1471 case KEY_ENROLLED_PRIVATE_KEY_NAME:
1473 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1477 Profile = Private->CurrentNic->UserSelectedProfile;
1479 if (Profile->PrivateKeyData !=
NULL) {
1490 }
else if (Action == EFI_BROWSER_ACTION_FORM_CLOSE) {
1491 switch (QuestionId) {
1492 case KEY_EAP_ENROLL_CERT_FROM_FILE:
1493 case KEY_REFRESH_NETWORK_LIST:
1495 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1499 Profile = Private->CurrentNic->UserSelectedProfile;
1506 return EFI_OUT_OF_RESOURCES;
1509 IfrNvData->SecurityType = Profile->SecurityType;
1511 Private->RegisteredHandle,
1513 mSecurityType[IfrNvData->SecurityType],
1517 return EFI_OUT_OF_RESOURCES;
1520 if ( (IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE)
1521 || (IfrNvData->SecurityType == SECURITY_TYPE_WPA3_ENTERPRISE))
1523 IfrNvData->EapAuthMethod = Profile->EapAuthMethod;
1524 IfrNvData->EapSecondAuthMethod = Profile->EapSecondAuthMethod;
1525 StrCpyS (IfrNvData->EapIdentity, EAP_IDENTITY_SIZE, Profile->EapIdentity);
1530 case KEY_CONNECT_ACTION:
1532 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1536 Profile = Private->CurrentNic->UserSelectedProfile;
1541 if ((IfrNvData->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) ||
1542 (IfrNvData->SecurityType == SECURITY_TYPE_WPA3_ENTERPRISE))
1544 Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
1545 Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
1546 StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
1554 }
else if (Action == EFI_BROWSER_ACTION_CHANGING) {
1555 switch (QuestionId) {
1556 case KEY_NETWORK_LIST:
1561 Private->CurrentNic->OneTimeScanRequest =
TRUE;
1564 case KEY_PASSWORD_CONNECT_NETWORK:
1565 case KEY_EAP_PASSWORD_CONNECT_NETWORK:
1566 case KEY_PRIVATE_KEY_PASSWORD:
1568 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1572 Profile = Private->CurrentNic->UserSelectedProfile;
1574 if (QuestionId == KEY_PASSWORD_CONNECT_NETWORK) {
1575 TempPassword = Profile->Password;
1576 }
else if (QuestionId == KEY_EAP_PASSWORD_CONNECT_NETWORK) {
1577 TempPassword = Profile->EapPassword;
1579 TempPassword = Profile->PrivateKeyPassword;
1583 if (EFI_ERROR (Status)) {
1584 DEBUG ((DEBUG_ERROR,
"[WiFi Connection Manager] Error: Failed to input password!"));
1591 Status = EFI_NOT_FOUND;
1594 case KEY_CONNECT_ACTION:
1596 ErrorMessage =
NULL;
1597 ProfileToConnect =
NULL;
1599 if (Private->CurrentNic->UserSelectedProfile ==
NULL) {
1603 Profile = Private->CurrentNic->UserSelectedProfile;
1605 if ((Private->CurrentNic->ConnectState == WifiMgrDisconnected) ||
1606 (Profile != Private->CurrentNic->CurrentOperateNetwork))
1611 if (Profile->AKMSuiteSupported && Profile->CipherSuiteSupported) {
1612 if ((Profile->SecurityType == SECURITY_TYPE_NONE) ||
1613 (Profile->SecurityType == SECURITY_TYPE_WPA2_PERSONAL) ||
1614 (Profile->SecurityType == SECURITY_TYPE_WPA3_PERSONAL))
1619 ProfileToConnect = Profile;
1620 }
else if ((Profile->SecurityType == SECURITY_TYPE_WPA2_ENTERPRISE) ||
1621 (Profile->SecurityType == SECURITY_TYPE_WPA3_ENTERPRISE))
1627 Profile->EapAuthMethod = IfrNvData->EapAuthMethod;
1628 StrCpyS (Profile->EapIdentity, EAP_IDENTITY_SIZE, IfrNvData->EapIdentity);
1630 if ((IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TTLS) || (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_PEAP)) {
1631 Profile->EapSecondAuthMethod = IfrNvData->EapSecondAuthMethod;
1632 ProfileToConnect = Profile;
1633 }
else if (IfrNvData->EapAuthMethod == EAP_AUTH_METHOD_TLS) {
1634 ProfileToConnect = Profile;
1636 ErrorMessage = L
"ERROR: Only EAP-TLS, TTLS or PEAP is supported now!";
1639 ErrorMessage = L
"ERROR: Can't connect to this network!";
1642 ErrorMessage = L
"ERROR: This network is not supported!";
1645 if (ErrorMessage !=
NULL) {
1647 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1654 if (ProfileToConnect !=
NULL) {
1655 Private->CurrentNic->OneTimeConnectRequest =
TRUE;
1656 Private->CurrentNic->ConnectPendingNetwork = ProfileToConnect;
1658 }
else if (Private->CurrentNic->ConnectState == WifiMgrConnectedToAp) {
1662 Private->CurrentNic->OneTimeDisconnectRequest =
TRUE;
1663 Private->CurrentNic->HasDisconnectPendingNetwork =
TRUE;
1668 case KEY_ENROLL_CA_CERT_CONNECT_NETWORK:
1670 Private->FileType = FileTypeCACert;
1673 case KEY_ENROLL_CLIENT_CERT_CONNECT_NETWORK:
1675 Private->FileType = FileTypeClientCert;
1678 case KEY_EAP_ENROLL_PRIVATE_KEY_FROM_FILE:
1683 if (FilePath !=
NULL) {
1690 case KEY_EAP_ENROLL_CERT_FROM_FILE:
1698 if (FilePath !=
NULL) {
1705 case KEY_SAVE_PRIVATE_KEY_TO_MEM:
1707 if ((Private->FileContext !=
NULL) && (Private->FileContext->FHandle !=
NULL) &&
1708 (Private->CurrentNic->UserSelectedProfile !=
NULL))
1713 Profile = Private->CurrentNic->UserSelectedProfile;
1714 if (Profile->PrivateKeyData !=
NULL) {
1715 ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSize);
1716 FreePool (Profile->PrivateKeyData);
1717 Profile->PrivateKeyData =
NULL;
1721 Private->FileContext,
1725 if (EFI_ERROR (Status)) {
1727 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1729 L
"ERROR: Can't read this private key file!",
1733 ASSERT (Private->FileContext->FileName !=
NULL);
1735 Profile->PrivateKeyData = TempData;
1736 Profile->PrivateKeyDataSize = TempDataSize;
1737 StrCpyS (Profile->PrivateKeyName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
1741 "[WiFi Connection Manager] Private Key: %s has been enrolled! Size: %d\n",
1742 Profile->PrivateKeyName,
1743 Profile->PrivateKeyDataSize
1750 case KEY_SAVE_CERT_TO_MEM:
1752 if ((Private->FileContext !=
NULL) && (Private->FileContext->FHandle !=
NULL) &&
1753 (Private->CurrentNic->UserSelectedProfile !=
NULL))
1758 Profile = Private->CurrentNic->UserSelectedProfile;
1760 if (Private->FileType == FileTypeCACert) {
1761 if (Profile->CACertData !=
NULL) {
1762 ZeroMem (Profile->CACertData, Profile->CACertSize);
1764 Profile->CACertData =
NULL;
1766 }
else if (Private->FileType == FileTypeClientCert) {
1767 if (Profile->ClientCertData !=
NULL) {
1768 ZeroMem (Profile->ClientCertData, Profile->ClientCertSize);
1769 FreePool (Profile->ClientCertData);
1770 Profile->ClientCertData =
NULL;
1777 Private->FileContext,
1781 if (EFI_ERROR (Status)) {
1783 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1785 L
"ERROR: Can't read this certificate file!",
1789 ASSERT (Private->FileContext->FileName !=
NULL);
1790 if (Private->FileType == FileTypeCACert) {
1791 Profile->CACertData = TempData;
1792 Profile->CACertSize = TempDataSize;
1793 StrCpyS (Profile->CACertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
1796 "[WiFi Connection Manager] CA Cert: %s has been enrolled! Size: %d\n",
1797 Profile->CACertName,
1801 Profile->ClientCertData = TempData;
1802 Profile->ClientCertSize = TempDataSize;
1803 StrCpyS (Profile->ClientCertName, WIFI_FILENAME_STR_MAX_SIZE, Private->FileContext->FileName);
1806 "[WiFi Connection Manager] Client Cert: %s has been enrolled! Size: %d\n",
1807 Profile->ClientCertName,
1808 Profile->ClientCertSize
1816 case KEY_ADD_HIDDEN_NETWORK:
1821 if ((
StrLen (IfrNvData->SSId) < SSID_MIN_LEN) ||
1822 (Private->HiddenNetworkCount >= HIDDEN_NETWORK_LIST_COUNT_MAX))
1824 Status = EFI_ABORTED;
1830 NET_LIST_FOR_EACH (Entry, &Private->HiddenNetworkList) {
1831 HiddenNetwork = NET_LIST_USER_STRUCT_S (
1835 WIFI_MGR_HIDDEN_NETWORK_SIGNATURE
1837 if (
StrCmp (HiddenNetwork->SSId, IfrNvData->SSId) == 0) {
1838 Status = EFI_ABORTED;
1845 if (HiddenNetwork ==
NULL) {
1846 Status = EFI_OUT_OF_RESOURCES;
1850 HiddenNetwork->Signature = WIFI_MGR_HIDDEN_NETWORK_SIGNATURE;
1851 StrCpyS (HiddenNetwork->SSId, SSID_STORAGE_SIZE, IfrNvData->SSId);
1853 InsertTailList (&Private->HiddenNetworkList, &HiddenNetwork->Link);
1854 Private->HiddenNetworkCount++;
1859 case KEY_REMOVE_HIDDEN_NETWORK:
1866 for (Index = 0; Index < Private->HiddenNetworkCount; Index++) {
1867 if (IfrNvData->HiddenNetworkList[Index] != 0) {
1874 Entry =
GetNextNode (&Private->HiddenNetworkList, Entry);
1878 Private->HiddenNetworkCount -= RemoveCount;
1884 if ((QuestionId >= KEY_MAC_ENTRY_BASE) && (QuestionId < KEY_MAC_ENTRY_BASE + Private->NicCount)) {
1889 if (EFI_ERROR (Status)) {
1891 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1893 L
"ERROR: Fail to operate the wireless NIC!",
1897 }
else if (Private->CurrentNic !=
NULL) {
1898 if ((QuestionId >= KEY_AVAILABLE_NETWORK_ENTRY_BASE) &&
1899 (QuestionId <= KEY_AVAILABLE_NETWORK_ENTRY_BASE + Private->CurrentNic->MaxProfileIndex))
1902 if (!EFI_ERROR (Status)) {
1907 if (EFI_ERROR (Status)) {
1909 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
1911 L
"ERROR: Fail to operate this profile!",
1919 }
else if (Action == EFI_BROWSER_ACTION_CHANGED) {
1920 switch (QuestionId) {
1921 case KEY_SAVE_CERT_TO_MEM:
1922 case KEY_SAVE_PRIVATE_KEY_TO_MEM:
1924 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_SUBMIT_EXIT;
1927 case KEY_NO_SAVE_CERT_TO_MEM:
1928 case KEY_NO_SAVE_PRIVATE_KEY_TO_MEM:
1930 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
1935 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
1938 }
else if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
1939 switch (QuestionId) {
1940 case KEY_REFRESH_NETWORK_LIST:
1950 if (!EFI_ERROR (Status) && (Action != EFI_BROWSER_ACTION_FORM_OPEN)) {
1955 HiiSetBrowserData (&gWifiConfigFormSetGuid, mVendorStorageName, BufferSize, (UINT8 *)IfrNvData,
NULL);
1981 if (Private ==
NULL) {
1982 return EFI_INVALID_PARAMETER;
1992 Status =
gBS->InstallMultipleProtocolInterfaces (
1993 &Private->DriverHandle,
1994 &gEfiDevicePathProtocolGuid,
1995 &mWifiMgrDxeHiiVendorDevicePath,
1996 &gEfiHiiConfigAccessProtocolGuid,
1997 &Private->ConfigAccess,
2000 if (EFI_ERROR (Status)) {
2008 &gWifiConfigFormSetGuid,
2009 Private->DriverHandle,
2010 WifiConnectionManagerDxeStrings,
2011 WifiConnectionManagerDxeBin,
2014 if (Private->RegisteredHandle ==
NULL) {
2015 gBS->UninstallMultipleProtocolInterfaces (
2016 Private->DriverHandle,
2017 &gEfiDevicePathProtocolGuid,
2018 &mWifiMgrDxeHiiVendorDevicePath,
2019 &gEfiHiiConfigAccessProtocolGuid,
2020 &Private->ConfigAccess,
2023 return EFI_OUT_OF_RESOURCES;
2027 if (Private->FileContext ==
NULL) {
2028 return EFI_OUT_OF_RESOURCES;
2051 if (Private ==
NULL) {
2052 return EFI_INVALID_PARAMETER;
2055 if (Private->FileContext !=
NULL) {
2056 if (Private->FileContext->FHandle !=
NULL) {
2057 Private->FileContext->FHandle->Close (Private->FileContext->FHandle);
2060 if (Private->FileContext->FileName !=
NULL) {
2061 FreePool (Private->FileContext->FileName);
2069 Status =
gBS->UninstallMultipleProtocolInterfaces (
2070 Private->DriverHandle,
2071 &gEfiDevicePathProtocolGuid,
2072 &mWifiMgrDxeHiiVendorDevicePath,
2073 &gEfiHiiConfigAccessProtocolGuid,
2074 &Private->ConfigAccess,
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
LIST_ENTRY *EFIAPI GetNextNode(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
RETURN_STATUS EFIAPI StrnCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI ChooseFile(IN EFI_DEVICE_PATH_PROTOCOL *RootDirectory, IN CHAR16 *FileType OPTIONAL, IN CHOOSE_HANDLER ChooseHandler OPTIONAL, OUT EFI_DEVICE_PATH_PROTOCOL **File OPTIONAL)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
UINT8 *EFIAPI HiiCreateGotoOpCode(IN VOID *OpCodeHandle, IN EFI_FORM_ID FormId, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN EFI_QUESTION_ID QuestionId)
VOID *EFIAPI HiiAllocateOpCodeHandle(VOID)
VOID EFIAPI HiiFreeOpCodeHandle(VOID *OpCodeHandle)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
UINT8 *EFIAPI HiiCreateGuidOpCode(IN VOID *OpCodeHandle, IN CONST EFI_GUID *Guid, IN CONST VOID *GuidOpCode OPTIONAL, IN UINTN OpCodeSize)
UINT8 *EFIAPI HiiCreateCheckBoxOpCode(IN VOID *OpCodeHandle, IN EFI_QUESTION_ID QuestionId, IN EFI_VARSTORE_ID VarStoreId, IN UINT16 VarOffset, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN UINT8 QuestionFlags, IN UINT8 CheckBoxFlags, IN VOID *DefaultsOpCodeHandle OPTIONAL)
BOOLEAN EFIAPI HiiSetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, IN CONST UINT8 *Buffer, IN CONST CHAR16 *RequestElement OPTIONAL)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STATUS EFIAPI HiiUpdateForm(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid OPTIONAL, IN EFI_FORM_ID FormId, IN VOID *StartOpCodeHandle, IN VOID *EndOpCodeHandle OPTIONAL)
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
UINT8 *EFIAPI HiiCreateTextOpCode(IN VOID *OpCodeHandle, IN EFI_STRING_ID Prompt, IN EFI_STRING_ID Help, IN EFI_STRING_ID TextTwo)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
#define EFI_IFR_EXTEND_OP_LABEL
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define GLOBAL_REMOVE_IF_UNREFERENCED
#define DEBUG(Expression)
BOOLEAN EFIAPI UpdateCAFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
VOID EFIAPI Exit(IN EFI_STATUS Status)
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
BOOLEAN UpdatePrivateKeyFromFile(IN WIFI_MGR_PRIVATE_DATA *Private, IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
EFI_STATUS WifiMgrShowNicList(IN WIFI_MGR_PRIVATE_DATA *Private)
EFI_STATUS WifiMgrRefreshHiddenList(IN WIFI_MGR_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI WifiMgrDxeHiiConfigAccessRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS WifiMgrRecordPassword(IN WIFI_MGR_PRIVATE_DATA *Private, IN EFI_STRING_ID StringId, IN CHAR16 *StringBuffer, IN UINTN StringBufferLen)
CHAR16 * WifiMgrGetStrCipherList(IN WIFI_MGR_NETWORK_PROFILE *Profile)
VOID WifiMgrUpdateConnectMessage(IN WIFI_MGR_DEVICE_DATA *Nic, IN BOOLEAN ConnectStateChanged, IN EFI_STRING ConnectStatusMessage)
EFI_STATUS WifiMgrCreateOpCode(IN UINT16 StartLabelNumber, OUT VOID **StartOpCodeHandle, OUT VOID **EndOpCodeHandle)
CHAR16 * WifiMgrGetStrAKMList(IN WIFI_MGR_NETWORK_PROFILE *Profile)
EFI_STATUS WifiMgrDxeConfigFormInit(WIFI_MGR_PRIVATE_DATA *Private)
EFI_STATUS WifiMgrSelectNic(IN WIFI_MGR_PRIVATE_DATA *Private, IN EFI_QUESTION_ID KeyValue)
EFI_STATUS WifiMgrRefreshNetworkList(IN WIFI_MGR_PRIVATE_DATA *Private, OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData)
EFI_STATUS EFIAPI WifiMgrDxeHiiConfigAccessExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS WifiMgrDxeConfigFormUnload(WIFI_MGR_PRIVATE_DATA *Private)
VOID WifiMgrCleanUserInput(IN WIFI_MGR_PRIVATE_DATA *Private)
EFI_STATUS WifiMgrConvertIfrNvDataToConfigData(IN WIFI_MGR_PRIVATE_DATA *Private, IN OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData)
EFI_STATUS EFIAPI WifiMgrDxeHiiConfigAccessCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN OUT EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS WifiMgrConvertConfigDataToIfrNvData(IN WIFI_MGR_PRIVATE_DATA *Private, OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData)
EFI_STATUS WifiMgrUserSelectProfileToConnect(IN WIFI_MGR_PRIVATE_DATA *Private, IN UINT32 ProfileIndex)
WIFI_MGR_DEVICE_DATA * WifiMgrGetNicByIndex(IN WIFI_MGR_PRIVATE_DATA *Private, IN UINT32 NicIndex)
WIFI_MGR_NETWORK_PROFILE * WifiMgrGetProfileByProfileIndex(IN UINT32 ProfileIndex, IN LIST_ENTRY *ProfileList)
EFI_STATUS WifiMgrReadFileToBuffer(IN WIFI_MGR_FILE_CONTEXT *FileContext, OUT VOID **DataAddr, OUT UINTN *DataSize)
VOID WifiMgrMacAddrToStr(IN EFI_80211_MAC_ADDRESS *Mac, IN UINT32 StrSize, OUT CHAR16 *Str)
VOID WifiMgrCleanProfileSecrets(IN WIFI_MGR_NETWORK_PROFILE *Profile)