NetworkPkg: Apply uncrustify changes

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the NetworkPkg package

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
This commit is contained in:
Michael Kubacki
2021-12-05 14:54:07 -08:00
committed by mergify[bot]
parent 2f88bd3a12
commit d1050b9dff
294 changed files with 29888 additions and 30440 deletions

View File

@@ -11,12 +11,10 @@
#define __EFI_WIFI_EAP_CONTEXT_H__
typedef struct {
BOOLEAN IsEncrypted;
CHAR16 EncryptPassword[PASSWORD_STORAGE_SIZE];
UINTN KeySize;
UINT8 KeyData[1];
BOOLEAN IsEncrypted;
CHAR16 EncryptPassword[PASSWORD_STORAGE_SIZE];
UINTN KeySize;
UINT8 KeyData[1];
} EFI_EAP_PRIVATE_KEY;
#endif

View File

@@ -9,15 +9,15 @@
#include "WifiConnectionMgrDxe.h"
extern EFI_GUID mEfiWifiMgrPrivateGuid;
extern EFI_GUID mEfiWifiMgrPrivateGuid;
///
/// Component Name Protocol instance
///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName = {
(EFI_COMPONENT_NAME_GET_DRIVER_NAME) WifiMgrDxeComponentNameGetDriverName,
(EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) WifiMgrDxeComponentNameGetControllerName,
(EFI_COMPONENT_NAME_GET_DRIVER_NAME)WifiMgrDxeComponentNameGetDriverName,
(EFI_COMPONENT_NAME_GET_CONTROLLER_NAME)WifiMgrDxeComponentNameGetControllerName,
"eng"
};
@@ -35,7 +35,7 @@ EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2 = {
/// Table of driver names
///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {
EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {
{
"eng;en",
L"UEFI WiFi Connection Manager"
@@ -50,7 +50,7 @@ EFI_UNICODE_STRING_TABLE mWifiMgrDxeDriverNameTable[] = {
/// Table of controller names
///
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable[] = {
EFI_UNICODE_STRING_TABLE mWifiMgrDxeControllerNameTable[] = {
{
"eng;en",
L"UEFI WiFi Connection Manager Controller"
@@ -150,13 +150,13 @@ WifiMgrDxeComponentNameGetControllerName (
OUT CHAR16 **ControllerName
)
{
EFI_STATUS Status;
WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrPrivate;
EFI_STATUS Status;
WIFI_MGR_PRIVATE_PROTOCOL *WifiMgrPrivate;
//
// ChildHandle must be NULL for a Device Driver
//
if (ControllerHandle == NULL || ChildHandle != NULL) {
if ((ControllerHandle == NULL) || (ChildHandle != NULL)) {
return EFI_UNSUPPORTED;
}
@@ -166,7 +166,7 @@ WifiMgrDxeComponentNameGetControllerName (
Status = gBS->OpenProtocol (
ControllerHandle,
&mEfiWifiMgrPrivateGuid,
(VOID **) &WifiMgrPrivate,
(VOID **)&WifiMgrPrivate,
NULL,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL

View File

@@ -12,8 +12,8 @@
#include "WifiConnectionMgrConfigNVDataStruct.h"
extern UINT8 WifiConnectionManagerDxeBin[];
extern UINT8 WifiConnectionManagerDxeStrings[];
extern UINT8 WifiConnectionManagerDxeBin[];
extern UINT8 WifiConnectionManagerDxeStrings[];
typedef struct {
UINT32 Signature;
@@ -40,7 +40,7 @@ typedef struct {
CHAR16 PrivateKeyName[WIFI_FILENAME_STR_MAX_SIZE];
VOID *PrivateKeyData;
UINTN PrivateKeyDataSize;
CHAR16 PrivateKeyPassword[PASSWORD_STORAGE_SIZE]; //Password to protect private key file
CHAR16 PrivateKeyPassword[PASSWORD_STORAGE_SIZE]; // Password to protect private key file
CHAR16 EapIdentity[EAP_IDENTITY_SIZE];
CHAR16 EapPassword[PASSWORD_STORAGE_SIZE];
UINT8 EapSecondAuthMethod;
@@ -60,8 +60,8 @@ typedef struct {
/// HII specific Vendor Device Path definition.
///
typedef struct {
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
#pragma pack()

View File

@@ -13,139 +13,137 @@
#include <Guid/WifiConnectionManagerConfigHii.h>
#include "WifiConnectionMgrConfigHii.h"
#define MANAGER_VARSTORE_ID 0x0802
#define MANAGER_VARSTORE_ID 0x0802
#define WIFI_STR_MAX_SIZE 224
#define WIFI_FILENAME_STR_MAX_SIZE 224
#define WIFI_MGR_MAX_MAC_STRING_LEN 96
#define WIFI_STR_MAX_SIZE 224
#define WIFI_FILENAME_STR_MAX_SIZE 224
#define WIFI_MGR_MAX_MAC_STRING_LEN 96
#define SSID_MIN_LEN 1
#define SSID_MAX_LEN 32
#define SSID_STORAGE_SIZE 33
#define SSID_MIN_LEN 1
#define SSID_MAX_LEN 32
#define SSID_STORAGE_SIZE 33
#define PASSWORD_MIN_LEN 8
#define PASSWORD_MAX_LEN 63
#define PASSWORD_STORAGE_SIZE 64
#define PASSWORD_MIN_LEN 8
#define PASSWORD_MAX_LEN 63
#define PASSWORD_STORAGE_SIZE 64
#define EAP_IDENTITY_LEN 63
#define EAP_IDENTITY_SIZE 64
#define EAP_IDENTITY_LEN 63
#define EAP_IDENTITY_SIZE 64
#define FORMID_NONE_FORM 0
#define FORMID_MAC_SELECTION 1
#define FORMID_WIFI_MAINPAGE 2
#define FORMID_NETWORK_LIST 3
#define FORMID_CONNECT_NETWORK 4
#define FORMID_ENROLL_CERT 5
#define FORMID_CA_LIST 6
#define FORMID_ENROLL_PRIVATE_KEY 7
#define FORMID_PRIVATE_KEY_LIST 8
#define FORMID_WIFI_SETTINGS 9
#define FORMID_HIDDEN_NETWORK_LIST 10
#define FORMID_NONE_FORM 0
#define FORMID_MAC_SELECTION 1
#define FORMID_WIFI_MAINPAGE 2
#define FORMID_NETWORK_LIST 3
#define FORMID_CONNECT_NETWORK 4
#define FORMID_ENROLL_CERT 5
#define FORMID_CA_LIST 6
#define FORMID_ENROLL_PRIVATE_KEY 7
#define FORMID_PRIVATE_KEY_LIST 8
#define FORMID_WIFI_SETTINGS 9
#define FORMID_HIDDEN_NETWORK_LIST 10
//
// Mac List Form Key
//
#define KEY_MAC_LIST 0x100
#define KEY_MAC_LIST 0x100
//
// Main Form Key
//
#define KEY_REFRESH_TITLE_CONNECTION_STATUS 0x101
#define KEY_REFRESH_TITLE_CONNECTION_STATUS 0x101
//
// Network List Form Key
//
#define KEY_NETWORK_LIST 0x102
#define KEY_REFRESH_NETWORK_LIST 0x103
#define KEY_WIFI_SETTINGS 0x104
#define KEY_NETWORK_LIST 0x102
#define KEY_REFRESH_NETWORK_LIST 0x103
#define KEY_WIFI_SETTINGS 0x104
//
// Connect Network Form Key
//
#define KEY_PASSWORD_CONNECT_NETWORK 0x201
#define KEY_CONNECT_ACTION 0x202
#define KEY_REFRESH_CONNECT_CONFIGURATION 0x203
#define KEY_EAP_AUTH_METHOD_CONNECT_NETWORK 0x204
#define KEY_EAP_SEAUTH_METHOD_CONNECT_NETWORK 0x205
#define KEY_ENROLL_CA_CERT_CONNECT_NETWORK 0x206
#define KEY_ENROLL_CLIENT_CERT_CONNECT_NETWORK 0x207
#define KEY_ENROLL_PRIVATE_KEY_CONNECT_NETWORK 0x208
#define KEY_EAP_IDENTITY_CONNECT_NETWORK 0x209
#define KEY_EAP_PASSWORD_CONNECT_NETWORK 0x210
#define KEY_PASSWORD_CONNECT_NETWORK 0x201
#define KEY_CONNECT_ACTION 0x202
#define KEY_REFRESH_CONNECT_CONFIGURATION 0x203
#define KEY_EAP_AUTH_METHOD_CONNECT_NETWORK 0x204
#define KEY_EAP_SEAUTH_METHOD_CONNECT_NETWORK 0x205
#define KEY_ENROLL_CA_CERT_CONNECT_NETWORK 0x206
#define KEY_ENROLL_CLIENT_CERT_CONNECT_NETWORK 0x207
#define KEY_ENROLL_PRIVATE_KEY_CONNECT_NETWORK 0x208
#define KEY_EAP_IDENTITY_CONNECT_NETWORK 0x209
#define KEY_EAP_PASSWORD_CONNECT_NETWORK 0x210
//
//Cert Form And Private Key Form
// Cert Form And Private Key Form
//
#define KEY_EAP_ENROLL_CERT_FROM_FILE 0x301
#define KEY_EAP_ENROLL_PRIVATE_KEY_FROM_FILE 0x302
#define KEY_SAVE_CERT_TO_MEM 0x303
#define KEY_NO_SAVE_CERT_TO_MEM 0x304
#define KEY_SAVE_PRIVATE_KEY_TO_MEM 0x305
#define KEY_NO_SAVE_PRIVATE_KEY_TO_MEM 0x306
#define KEY_PRIVATE_KEY_PASSWORD 0x307
#define KEY_ENROLLED_CERT_NAME 0x308
#define KEY_ENROLLED_PRIVATE_KEY_NAME 0x309
#define KEY_EAP_ENROLL_CERT_FROM_FILE 0x301
#define KEY_EAP_ENROLL_PRIVATE_KEY_FROM_FILE 0x302
#define KEY_SAVE_CERT_TO_MEM 0x303
#define KEY_NO_SAVE_CERT_TO_MEM 0x304
#define KEY_SAVE_PRIVATE_KEY_TO_MEM 0x305
#define KEY_NO_SAVE_PRIVATE_KEY_TO_MEM 0x306
#define KEY_PRIVATE_KEY_PASSWORD 0x307
#define KEY_ENROLLED_CERT_NAME 0x308
#define KEY_ENROLLED_PRIVATE_KEY_NAME 0x309
//
// Hidden Network Configuration Form
//
#define KEY_HIDDEN_NETWORK 0x401
#define KEY_ADD_HIDDEN_NETWORK 0x402
#define KEY_REMOVE_HIDDEN_NETWORK 0x403
#define KEY_HIDDEN_NETWORK 0x401
#define KEY_ADD_HIDDEN_NETWORK 0x402
#define KEY_REMOVE_HIDDEN_NETWORK 0x403
//
// Dynamic Lists
//
#define MAC_LIST_COUNT_MAX 255
#define LABEL_MAC_ENTRY 0x1000
#define KEY_MAC_ENTRY_BASE 0x1100
#define MAC_LIST_COUNT_MAX 255
#define LABEL_MAC_ENTRY 0x1000
#define KEY_MAC_ENTRY_BASE 0x1100
#define NETWORK_LIST_COUNT_MAX 4095
#define LABEL_NETWORK_LIST_ENTRY 0x2000
#define KEY_AVAILABLE_NETWORK_ENTRY_BASE 0x3000
#define NETWORK_LIST_COUNT_MAX 4095
#define LABEL_NETWORK_LIST_ENTRY 0x2000
#define KEY_AVAILABLE_NETWORK_ENTRY_BASE 0x3000
#define HIDDEN_NETWORK_LIST_COUNT_MAX 255
#define LABEL_HIDDEN_NETWORK_ENTRY 0x4000
#define KEY_HIDDEN_NETWORK_ENTRY_BASE 0x4100
#define HIDDEN_NETWORK_LIST_COUNT_MAX 255
#define LABEL_HIDDEN_NETWORK_ENTRY 0x4000
#define KEY_HIDDEN_NETWORK_ENTRY_BASE 0x4100
#define LABEL_END 0xffff
#define LABEL_END 0xffff
//
// Network Security Type
//
#define SECURITY_TYPE_NONE 0
#define SECURITY_TYPE_WPA_ENTERPRISE 1
#define SECURITY_TYPE_WPA2_ENTERPRISE 2
#define SECURITY_TYPE_WPA_PERSONAL 3
#define SECURITY_TYPE_WPA2_PERSONAL 4
#define SECURITY_TYPE_WEP 5
#define SECURITY_TYPE_UNKNOWN 6
#define SECURITY_TYPE_MAX 7
#define SECURITY_TYPE_NONE 0
#define SECURITY_TYPE_WPA_ENTERPRISE 1
#define SECURITY_TYPE_WPA2_ENTERPRISE 2
#define SECURITY_TYPE_WPA_PERSONAL 3
#define SECURITY_TYPE_WPA2_PERSONAL 4
#define SECURITY_TYPE_WEP 5
#define SECURITY_TYPE_UNKNOWN 6
#define SECURITY_TYPE_MAX 7
#define EAP_AUTH_METHOD_TTLS 0
#define EAP_AUTH_METHOD_PEAP 1
#define EAP_AUTH_METHOD_TLS 2
#define EAP_AUTH_METHOD_MAX 3
#define EAP_AUTH_METHOD_TTLS 0
#define EAP_AUTH_METHOD_PEAP 1
#define EAP_AUTH_METHOD_TLS 2
#define EAP_AUTH_METHOD_MAX 3
#define EAP_SEAUTH_METHOD_MSCHAPV2 0
#define EAP_SEAUTH_METHOD_MAX 1
#define EAP_SEAUTH_METHOD_MSCHAPV2 0
#define EAP_SEAUTH_METHOD_MAX 1
#define HIDDEN_NETWORK_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (WIFI_MANAGER_IFR_NVDATA, HiddenNetworkList))
#define HIDDEN_NETWORK_LIST_VAR_OFFSET ((UINT16) OFFSET_OF (WIFI_MANAGER_IFR_NVDATA, HiddenNetworkList))
#pragma pack(1)
typedef struct _WIFI_MANAGER_IFR_NVDATA {
UINT32 ProfileCount;
CHAR16 SSId[SSID_STORAGE_SIZE];
CHAR16 Password[PASSWORD_STORAGE_SIZE];
CHAR16 PrivateKeyPassword[PASSWORD_STORAGE_SIZE];
CHAR16 EapIdentity[EAP_IDENTITY_SIZE];
CHAR16 EapPassword[PASSWORD_STORAGE_SIZE];
UINT8 SecurityType;
UINT8 EapAuthMethod;
UINT8 EapSecondAuthMethod;
UINT8 HiddenNetworkList[HIDDEN_NETWORK_LIST_COUNT_MAX];
UINT32 ProfileCount;
CHAR16 SSId[SSID_STORAGE_SIZE];
CHAR16 Password[PASSWORD_STORAGE_SIZE];
CHAR16 PrivateKeyPassword[PASSWORD_STORAGE_SIZE];
CHAR16 EapIdentity[EAP_IDENTITY_SIZE];
CHAR16 EapPassword[PASSWORD_STORAGE_SIZE];
UINT8 SecurityType;
UINT8 EapAuthMethod;
UINT8 EapSecondAuthMethod;
UINT8 HiddenNetworkList[HIDDEN_NETWORK_LIST_COUNT_MAX];
} WIFI_MANAGER_IFR_NVDATA;
#pragma pack()

View File

@@ -12,7 +12,7 @@
///
/// Driver Binding Protocol instance
///
EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding = {
EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding = {
WifiMgrDxeDriverBindingSupported,
WifiMgrDxeDriverBindingStart,
WifiMgrDxeDriverBindingStop,
@@ -22,22 +22,22 @@ EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding = {
};
//
//The private global data for WiFi Connection Manager
// The private global data for WiFi Connection Manager
//
WIFI_MGR_PRIVATE_DATA *mPrivate = NULL;
WIFI_MGR_PRIVATE_DATA *mPrivate = NULL;
//
//The private guid to identify WiFi Connection Manager
// The private guid to identify WiFi Connection Manager
//
EFI_GUID mEfiWifiMgrPrivateGuid = EFI_WIFIMGR_PRIVATE_GUID;
EFI_GUID mEfiWifiMgrPrivateGuid = EFI_WIFIMGR_PRIVATE_GUID;
//
//The Hii config guids
// The Hii config guids
//
EFI_GUID gWifiConfigFormSetGuid = WIFI_CONNECTION_MANAGER_CONFIG_GUID;
EFI_GUID mWifiConfigNetworkListRefreshGuid = WIFI_CONFIG_NETWORK_LIST_REFRESH_GUID;
EFI_GUID mWifiConfigConnectFormRefreshGuid = WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID;
EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;
EFI_GUID gWifiConfigFormSetGuid = WIFI_CONNECTION_MANAGER_CONFIG_GUID;
EFI_GUID mWifiConfigNetworkListRefreshGuid = WIFI_CONFIG_NETWORK_LIST_REFRESH_GUID;
EFI_GUID mWifiConfigConnectFormRefreshGuid = WIFI_CONFIG_CONNECT_FORM_REFRESH_GUID;
EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;
/**
Tests to see if this driver supports a given controller. If a child device is provided,
@@ -85,12 +85,12 @@ EFI_GUID mWifiConfigMainFormRefreshGuid = WIFI_CONFIG_MAIN_FORM_REFRESH_GUID;
EFI_STATUS
EFIAPI
WifiMgrDxeDriverBindingSupported (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = gBS->OpenProtocol (
ControllerHandle,
@@ -155,28 +155,28 @@ WifiMgrDxeDriverBindingSupported (
EFI_STATUS
EFIAPI
WifiMgrDxeDriverBindingStart (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL
)
{
EFI_STATUS Status;
EFI_TPL OldTpl;
UINTN AddressSize;
WIFI_MGR_DEVICE_DATA *Nic;
EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp;
EFI_SUPPLICANT_PROTOCOL *Supplicant;
EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;
EFI_STATUS Status;
EFI_TPL OldTpl;
UINTN AddressSize;
WIFI_MGR_DEVICE_DATA *Nic;
EFI_WIRELESS_MAC_CONNECTION_II_PROTOCOL *Wmp;
EFI_SUPPLICANT_PROTOCOL *Supplicant;
EFI_EAP_CONFIGURATION_PROTOCOL *EapConfig;
Nic = NULL;
//
//Open Protocols
// Open Protocols
//
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiWiFi2ProtocolGuid,
(VOID**) &Wmp,
(VOID **)&Wmp,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -188,7 +188,7 @@ WifiMgrDxeDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiSupplicantProtocolGuid,
(VOID**) &Supplicant,
(VOID **)&Supplicant,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -200,7 +200,7 @@ WifiMgrDxeDriverBindingStart (
Status = gBS->OpenProtocol (
ControllerHandle,
&gEfiEapConfigurationProtocolGuid,
(VOID**) &EapConfig,
(VOID **)&EapConfig,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -210,26 +210,27 @@ WifiMgrDxeDriverBindingStart (
}
//
//Initialize Nic device data
// Initialize Nic device data
//
Nic = AllocateZeroPool (sizeof (WIFI_MGR_DEVICE_DATA));
if (Nic == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto ERROR1;
}
Nic->Signature = WIFI_MGR_DEVICE_DATA_SIGNATURE;
Nic->DriverHandle = This->DriverBindingHandle;
Nic->ControllerHandle = ControllerHandle;
Nic->Private = mPrivate;
Nic->Wmp = Wmp;
Nic->Supplicant = Supplicant;
Nic->EapConfig = EapConfig;
Nic->UserSelectedProfile = NULL;
Nic->OneTimeScanRequest = FALSE;
Nic->ScanTickTime = WIFI_SCAN_FREQUENCY; //Initialize the first scan
Nic->Signature = WIFI_MGR_DEVICE_DATA_SIGNATURE;
Nic->DriverHandle = This->DriverBindingHandle;
Nic->ControllerHandle = ControllerHandle;
Nic->Private = mPrivate;
Nic->Wmp = Wmp;
Nic->Supplicant = Supplicant;
Nic->EapConfig = EapConfig;
Nic->UserSelectedProfile = NULL;
Nic->OneTimeScanRequest = FALSE;
Nic->ScanTickTime = WIFI_SCAN_FREQUENCY; // Initialize the first scan
if (Nic->Supplicant != NULL) {
WifiMgrGetSupportedSuites(Nic);
WifiMgrGetSupportedSuites (Nic);
}
InitializeListHead (&Nic->ProfileList);
@@ -239,7 +240,7 @@ WifiMgrDxeDriverBindingStart (
//
Status = NetLibGetMacAddress (
ControllerHandle,
(EFI_MAC_ADDRESS*) &Nic->MacAddress,
(EFI_MAC_ADDRESS *)&Nic->MacAddress,
&AddressSize
);
if (EFI_ERROR (Status)) {
@@ -260,7 +261,7 @@ WifiMgrDxeDriverBindingStart (
goto ERROR2;
}
Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS(500));
Status = gBS->SetTimer (Nic->TickTimer, TimerPeriodic, EFI_TIMER_PERIOD_MILLISECONDS (500));
if (EFI_ERROR (Status)) {
goto ERROR3;
}
@@ -270,10 +271,11 @@ WifiMgrDxeDriverBindingStart (
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);
InsertTailList (&mPrivate->NicList, &Nic->Link);
Nic->NicIndex = mPrivate->NicCount ++;
Nic->NicIndex = mPrivate->NicCount++;
if (mPrivate->CurrentNic == NULL) {
mPrivate->CurrentNic = Nic;
}
gBS->RestoreTPL (OldTpl);
Status = gBS->InstallProtocolInterface (
@@ -306,13 +308,16 @@ ERROR2:
if (Nic->SupportedSuites.SupportedAKMSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedAKMSuites);
}
if (Nic->SupportedSuites.SupportedSwCipherSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);
}
if (Nic->SupportedSuites.SupportedHwCipherSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);
}
}
FreePool (Nic);
ERROR1:
@@ -374,21 +379,21 @@ ERROR1:
EFI_STATUS
EFIAPI
WifiMgrDxeDriverBindingStop (
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
IN EFI_HANDLE *ChildHandleBuffer OPTIONAL
IN EFI_DRIVER_BINDING_PROTOCOL *This,
IN EFI_HANDLE ControllerHandle,
IN UINTN NumberOfChildren,
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;
Status = gBS->OpenProtocol (
ControllerHandle,
&mEfiWifiMgrPrivateGuid,
(VOID **) &WifiMgrIdentifier,
(VOID **)&WifiMgrIdentifier,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
@@ -415,9 +420,11 @@ WifiMgrDxeDriverBindingStop (
if (Nic->SupportedSuites.SupportedAKMSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedAKMSuites);
}
if (Nic->SupportedSuites.SupportedSwCipherSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedSwCipherSuites);
}
if (Nic->SupportedSuites.SupportedHwCipherSuites != NULL) {
FreePool (Nic->SupportedSuites.SupportedHwCipherSuites);
}
@@ -427,31 +434,31 @@ WifiMgrDxeDriverBindingStop (
// Close Protocols
//
Status = gBS->UninstallProtocolInterface (
ControllerHandle,
&mEfiWifiMgrPrivateGuid,
&Nic->WifiMgrIdentifier
);
ControllerHandle,
&mEfiWifiMgrPrivateGuid,
&Nic->WifiMgrIdentifier
);
if (EFI_ERROR (Status)) {
return Status;
}
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiWiFi2ProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
ControllerHandle,
&gEfiWiFi2ProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
if (Nic->Supplicant != NULL) {
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiSupplicantProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
ControllerHandle,
&gEfiSupplicantProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -459,11 +466,11 @@ WifiMgrDxeDriverBindingStop (
if (Nic->EapConfig != NULL) {
Status = gBS->CloseProtocol (
ControllerHandle,
&gEfiEapConfigurationProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
ControllerHandle,
&gEfiEapConfigurationProtocolGuid,
Nic->DriverHandle,
Nic->ControllerHandle
);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -505,11 +512,11 @@ WifiMgrDxeDriverBindingStop (
EFI_STATUS
EFIAPI
WifiMgrDxeDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
@@ -531,16 +538,17 @@ WifiMgrDxeDriverEntryPoint (
Status = EFI_OUT_OF_RESOURCES;
goto ERROR1;
}
mPrivate->Signature = WIFI_MGR_PRIVATE_DATA_SIGNATURE;
mPrivate->DriverHandle = ImageHandle;
InitializeListHead (&mPrivate->NicList);
mPrivate->NicCount = 0;
mPrivate->NicCount = 0;
mPrivate->CurrentNic = NULL;
InitializeListHead (&mPrivate->HiddenNetworkList);
mPrivate->HiddenNetworkCount = 0;
//
//Create events for page refresh
// Create events for page refresh
//
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,

View File

@@ -73,31 +73,31 @@
//
#define WIFI_MGR_DXE_VERSION 0xb
#define OUI_IEEE_80211I 0xAC0F00
#define OUI_IEEE_80211I 0xAC0F00
typedef enum {
Ieee80211PairwiseCipherSuiteUseGroupCipherSuite = 0,
Ieee80211PairwiseCipherSuiteWEP40 = 1,
Ieee80211PairwiseCipherSuiteTKIP = 2,
Ieee80211PairwiseCipherSuiteCCMP = 4,
Ieee80211PairwiseCipherSuiteWEP104 = 5,
Ieee80211PairwiseCipherSuiteBIP = 6,
//...
Ieee80211PairwiseCipherSuiteWEP40 = 1,
Ieee80211PairwiseCipherSuiteTKIP = 2,
Ieee80211PairwiseCipherSuiteCCMP = 4,
Ieee80211PairwiseCipherSuiteWEP104 = 5,
Ieee80211PairwiseCipherSuiteBIP = 6,
// ...
} IEEE_80211_PAIRWISE_CIPHER_SUITE;
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_USE_GROUP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteUseGroupCipherSuite << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP40 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP40 << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_TKIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteTKIP << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_CCMP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteCCMP << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP104 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP104 << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_BIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteBIP << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_USE_GROUP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteUseGroupCipherSuite << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP40 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP40 << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_TKIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteTKIP << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_CCMP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteCCMP << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP104 (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteWEP104 << 24))
#define IEEE_80211_PAIRWISE_CIPHER_SUITE_BIP (OUI_IEEE_80211I | (Ieee80211PairwiseCipherSuiteBIP << 24))
typedef enum {
Ieee80211AkmSuite8021XOrPMKSA = 1,
Ieee80211AkmSuitePSK = 2,
Ieee80211AkmSuite8021XOrPMKSASHA256 = 5,
Ieee80211AkmSuitePSKSHA256 = 6
//...
// ...
} IEEE_80211_AKM_SUITE;
#define IEEE_80211_AKM_SUITE_8021X_OR_PMKSA (OUI_IEEE_80211I | (Ieee80211AkmSuite8021XOrPMKSA << 24))
@@ -108,10 +108,10 @@ typedef enum {
//
// Protocol instances
//
extern EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding;
extern EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName;
extern EFI_HII_CONFIG_ACCESS_PROTOCOL gWifiMgrDxeHiiConfigAccess;
extern EFI_DRIVER_BINDING_PROTOCOL gWifiMgrDxeDriverBinding;
extern EFI_COMPONENT_NAME2_PROTOCOL gWifiMgrDxeComponentName2;
extern EFI_COMPONENT_NAME_PROTOCOL gWifiMgrDxeComponentName;
extern EFI_HII_CONFIG_ACCESS_PROTOCOL gWifiMgrDxeHiiConfigAccess;
//
// Private Context Data Structure
@@ -130,12 +130,12 @@ typedef enum {
WifiMgrScanStateMaximum
} WIFI_MGR_SCAN_STATE;
#define WIFI_SCAN_FREQUENCY 30
#define WIFI_SCAN_FREQUENCY 30
typedef struct _WIFI_MGR_SUPPORTED_SUITES {
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
} WIFI_MGR_SUPPORTED_SUITES;
#define EFI_WIFIMGR_PRIVATE_GUID \
@@ -143,15 +143,15 @@ typedef struct _WIFI_MGR_SUPPORTED_SUITES {
0x99b7c019, 0x4789, 0x4829, { 0xa7, 0xbd, 0x0d, 0x4b, 0xaa, 0x62, 0x28, 0x72 } \
}
typedef struct _WIFI_MGR_PRIVATE_DATA WIFI_MGR_PRIVATE_DATA;
typedef struct _WIFI_MGR_PRIVATE_DATA WIFI_MGR_PRIVATE_DATA;
typedef struct _WIFI_MGR_PRIVATE_PROTOCOL {
UINT32 Reserved;
UINT32 Reserved;
} WIFI_MGR_PRIVATE_PROTOCOL;
typedef struct _WIFI_MGR_FILE_CONTEXT {
EFI_FILE_HANDLE FHandle;
UINT16 *FileName;
EFI_FILE_HANDLE FHandle;
UINT16 *FileName;
} WIFI_MGR_FILE_CONTEXT;
typedef enum {
@@ -177,43 +177,43 @@ typedef struct {
//
// Produced protocols
//
WIFI_MGR_PRIVATE_PROTOCOL WifiMgrIdentifier;
WIFI_MGR_PRIVATE_PROTOCOL WifiMgrIdentifier;
//
// Private functions and data fields
//
LIST_ENTRY Link; // Link to the NicList in global private data structure.
UINT32 NicIndex;
EFI_80211_MAC_ADDRESS MacAddress;
WIFI_MGR_SUPPORTED_SUITES SupportedSuites;
EFI_ADAPTER_INFO_MEDIA_STATE LastLinkState;
LIST_ENTRY Link; // Link to the NicList in global private data structure.
UINT32 NicIndex;
EFI_80211_MAC_ADDRESS MacAddress;
WIFI_MGR_SUPPORTED_SUITES SupportedSuites;
EFI_ADAPTER_INFO_MEDIA_STATE LastLinkState;
//
// The network is currently connected, connecting or disconnecting.
// Only one network can be operated at one time.
//
WIFI_MGR_NETWORK_PROFILE *CurrentOperateNetwork;
WIFI_MGR_NETWORK_PROFILE *ConnectPendingNetwork;
BOOLEAN HasDisconnectPendingNetwork;
WIFI_MGR_NETWORK_PROFILE *CurrentOperateNetwork;
WIFI_MGR_NETWORK_PROFILE *ConnectPendingNetwork;
BOOLEAN HasDisconnectPendingNetwork;
//
//Profile related data fields
// Profile related data fields
//
LIST_ENTRY ProfileList; // List of WIFI_MGR_NETWORK_PROFILE
UINT32 AvailableCount;
UINT32 MaxProfileIndex;
WIFI_MGR_NETWORK_PROFILE *UserSelectedProfile;
LIST_ENTRY ProfileList; // List of WIFI_MGR_NETWORK_PROFILE
UINT32 AvailableCount;
UINT32 MaxProfileIndex;
WIFI_MGR_NETWORK_PROFILE *UserSelectedProfile;
//
// Data fields for Hii functionlity
//
BOOLEAN OneTimeScanRequest;
BOOLEAN OneTimeConnectRequest;
BOOLEAN OneTimeDisconnectRequest;
WIFI_MGR_SCAN_STATE ScanState;
UINTN ScanTickTime;
WIFI_MGR_CONNECT_STATE ConnectState;
BOOLEAN ConnectStateChanged;
BOOLEAN OneTimeScanRequest;
BOOLEAN OneTimeConnectRequest;
BOOLEAN OneTimeDisconnectRequest;
WIFI_MGR_SCAN_STATE ScanState;
UINTN ScanTickTime;
WIFI_MGR_CONNECT_STATE ConnectState;
BOOLEAN ConnectStateChanged;
} WIFI_MGR_DEVICE_DATA;
#define WIFI_MGR_DEVICE_DATA_SIGNATURE SIGNATURE_32 ('W','M','D','D')
@@ -227,9 +227,9 @@ typedef struct {
)
typedef struct {
UINT32 Signature;
LIST_ENTRY Link;
CHAR16 SSId[SSID_STORAGE_SIZE];
UINT32 Signature;
LIST_ENTRY Link;
CHAR16 SSId[SSID_STORAGE_SIZE];
} WIFI_HIDDEN_NETWORK_DATA;
#define WIFI_MGR_HIDDEN_NETWORK_SIGNATURE SIGNATURE_32 ('W','M','H','N')
@@ -246,7 +246,6 @@ typedef struct {
// Global private data struct
//
struct _WIFI_MGR_PRIVATE_DATA {
UINT32 Signature;
EFI_HANDLE DriverHandle;
EFI_HII_HANDLE RegisteredHandle;
@@ -264,7 +263,7 @@ struct _WIFI_MGR_PRIVATE_DATA {
EFI_EVENT MainPageRefreshEvent; // Event to refresh the main page
//
//User Input Record
// User Input Record
//
UINT8 SecurityType;
UINT8 EapAuthMethod;
@@ -287,7 +286,7 @@ struct _WIFI_MGR_PRIVATE_DATA {
ConfigAccess, \
WIFI_MGR_PRIVATE_DATA_SIGNATURE \
)
extern WIFI_MGR_PRIVATE_DATA *mPrivate;
extern WIFI_MGR_PRIVATE_DATA *mPrivate;
typedef enum {
TokenTypeGetNetworksToken,
@@ -297,15 +296,15 @@ typedef enum {
} WIFI_MGR_MAC_CONFIG_TOKEN_TYPE;
typedef union {
EFI_80211_GET_NETWORKS_TOKEN *GetNetworksToken;
EFI_80211_CONNECT_NETWORK_TOKEN *ConnectNetworkToken;
EFI_80211_DISCONNECT_NETWORK_TOKEN *DisconnectNetworkToken;
EFI_80211_GET_NETWORKS_TOKEN *GetNetworksToken;
EFI_80211_CONNECT_NETWORK_TOKEN *ConnectNetworkToken;
EFI_80211_DISCONNECT_NETWORK_TOKEN *DisconnectNetworkToken;
} MAC_CONNECTION2_ADAPTER_TOKEN;
typedef struct {
WIFI_MGR_DEVICE_DATA *Nic;
WIFI_MGR_MAC_CONFIG_TOKEN_TYPE Type;
MAC_CONNECTION2_ADAPTER_TOKEN Token;
WIFI_MGR_DEVICE_DATA *Nic;
WIFI_MGR_MAC_CONFIG_TOKEN_TYPE Type;
MAC_CONNECTION2_ADAPTER_TOKEN Token;
} WIFI_MGR_MAC_CONFIG_TOKEN;
//

View File

@@ -9,7 +9,7 @@
#include "WifiConnectionMgrFileUtil.h"
CHAR16* mDerPemEncodedSuffix[] = {
CHAR16 *mDerPemEncodedSuffix[] = {
L".cer",
L".der",
L".crt",
@@ -28,15 +28,17 @@ CHAR16* mDerPemEncodedSuffix[] = {
**/
BOOLEAN
IsDerPemEncodeCertificate (
IN CONST CHAR16 *FileSuffix
)
IN CONST CHAR16 *FileSuffix
)
{
UINTN Index;
UINTN Index;
for (Index = 0; mDerPemEncodedSuffix[Index] != NULL; Index++) {
if (StrCmp (FileSuffix, mDerPemEncodedSuffix[Index]) == 0) {
return TRUE;
}
}
return FALSE;
}
@@ -58,16 +60,16 @@ IsDerPemEncodeCertificate (
**/
EFI_STATUS
ReadFileContent (
IN EFI_FILE_HANDLE FileHandle,
IN OUT VOID **BufferPtr,
OUT UINTN *FileSize,
IN UINTN AddtionAllocateSize
IN EFI_FILE_HANDLE FileHandle,
IN OUT VOID **BufferPtr,
OUT UINTN *FileSize,
IN UINTN AddtionAllocateSize
)
{
UINTN BufferSize;
UINT64 SourceFileSize;
VOID *Buffer;
EFI_STATUS Status;
UINTN BufferSize;
UINT64 SourceFileSize;
VOID *Buffer;
EFI_STATUS Status;
if ((FileHandle == NULL) || (FileSize == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -78,7 +80,7 @@ ReadFileContent (
//
// Get the file size
//
Status = FileHandle->SetPosition (FileHandle, (UINT64) -1);
Status = FileHandle->SetPosition (FileHandle, (UINT64)-1);
if (EFI_ERROR (Status)) {
goto ON_EXIT;
}
@@ -93,20 +95,20 @@ ReadFileContent (
goto ON_EXIT;
}
BufferSize = (UINTN) SourceFileSize + AddtionAllocateSize;
Buffer = AllocateZeroPool(BufferSize);
BufferSize = (UINTN)SourceFileSize + AddtionAllocateSize;
Buffer = AllocateZeroPool (BufferSize);
if (Buffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
BufferSize = (UINTN) SourceFileSize;
BufferSize = (UINTN)SourceFileSize;
*FileSize = BufferSize;
Status = FileHandle->Read (FileHandle, &BufferSize, Buffer);
if (EFI_ERROR (Status) || BufferSize != *FileSize) {
if (EFI_ERROR (Status) || (BufferSize != *FileSize)) {
FreePool (Buffer);
Buffer = NULL;
Status = EFI_BAD_BUFFER_SIZE;
Status = EFI_BAD_BUFFER_SIZE;
goto ON_EXIT;
}
@@ -127,7 +129,7 @@ ON_EXIT:
CHAR16 *
EFIAPI
DevicePathToStr (
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
)
{
return ConvertDevicePathToText (
@@ -150,37 +152,38 @@ DevicePathToStr (
**/
CHAR16 *
ExtractFileNameFromDevicePath (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
CHAR16 *String;
CHAR16 *MatchString;
CHAR16 *LastMatch;
CHAR16 *FileName;
UINTN Length;
CHAR16 *String;
CHAR16 *MatchString;
CHAR16 *LastMatch;
CHAR16 *FileName;
UINTN Length;
ASSERT(DevicePath != NULL);
ASSERT (DevicePath != NULL);
String = DevicePathToStr(DevicePath);
String = DevicePathToStr (DevicePath);
if (String == NULL) {
return NULL;
}
MatchString = String;
LastMatch = String;
FileName = NULL;
while(MatchString != NULL){
while (MatchString != NULL) {
LastMatch = MatchString + 1;
MatchString = StrStr(LastMatch,L"\\");
MatchString = StrStr (LastMatch, L"\\");
}
Length = StrLen(LastMatch);
FileName = AllocateCopyPool ((Length + 1) * sizeof(CHAR16), LastMatch);
Length = StrLen (LastMatch);
FileName = AllocateCopyPool ((Length + 1) * sizeof (CHAR16), LastMatch);
if (FileName != NULL) {
*(FileName + Length) = 0;
}
FreePool(String);
FreePool (String);
return FileName;
}
@@ -197,20 +200,21 @@ ExtractFileNameFromDevicePath (
**/
BOOLEAN
UpdatePage(
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN EFI_FORM_ID FormId
UpdatePage (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
IN EFI_FORM_ID FormId
)
{
CHAR16 *FileName;
EFI_STATUS Status;
CHAR16 *FileName;
EFI_STATUS Status;
FileName = NULL;
if (FilePath != NULL) {
FileName = ExtractFileNameFromDevicePath(FilePath);
FileName = ExtractFileNameFromDevicePath (FilePath);
}
if (FileName == NULL) {
//
// FileName = NULL has two cases:
@@ -227,6 +231,7 @@ UpdatePage(
if (Private->FileContext->FHandle != NULL) {
Private->FileContext->FHandle->Close (Private->FileContext->FHandle);
}
Private->FileContext->FHandle = NULL;
Status = EfiOpenFileByDevicePath (
@@ -237,26 +242,42 @@ UpdatePage(
);
if (EFI_ERROR (Status)) {
if (FormId == FORMID_ENROLL_CERT) {
HiiSetString (Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), L"", NULL);
} else if (FormId == FORMID_ENROLL_PRIVATE_KEY){
HiiSetString (Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), L"", NULL);
HiiSetString (
Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME),
L"",
NULL
);
} else if (FormId == FORMID_ENROLL_PRIVATE_KEY) {
HiiSetString (
Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME),
L"",
NULL
);
}
} else {
if (Private->FileContext->FileName != NULL) {
FreePool (Private->FileContext->FileName);
Private->FileContext->FileName = NULL;
}
Private->FileContext->FileName = FileName;
if (FormId == FORMID_ENROLL_CERT) {
HiiSetString (Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME), FileName, NULL);
} else if (FormId == FORMID_ENROLL_PRIVATE_KEY){
HiiSetString (Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME), FileName, NULL);
HiiSetString (
Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_CERT_NAME),
FileName,
NULL
);
} else if (FormId == FORMID_ENROLL_PRIVATE_KEY) {
HiiSetString (
Private->RegisteredHandle,
STRING_TOKEN (STR_EAP_ENROLLED_PRIVATE_KEY_NAME),
FileName,
NULL
);
}
}
@@ -275,11 +296,11 @@ UpdatePage(
**/
BOOLEAN
UpdateCAFromFile (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
return UpdatePage(Private, FilePath, FORMID_ENROLL_CERT);
return UpdatePage (Private, FilePath, FORMID_ENROLL_CERT);
}
/**
@@ -294,10 +315,9 @@ UpdateCAFromFile (
**/
BOOLEAN
UpdatePrivateKeyFromFile (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
)
{
return UpdatePage(Private, FilePath, FORMID_ENROLL_PRIVATE_KEY);
return UpdatePage (Private, FilePath, FORMID_ENROLL_PRIVATE_KEY);
}

View File

@@ -30,10 +30,10 @@
**/
EFI_STATUS
ReadFileContent (
IN EFI_FILE_HANDLE FileHandle,
IN OUT VOID **BufferPtr,
OUT UINTN *FileSize,
IN UINTN AddtionAllocateSize
IN EFI_FILE_HANDLE FileHandle,
IN OUT VOID **BufferPtr,
OUT UINTN *FileSize,
IN UINTN AddtionAllocateSize
);
/**
@@ -48,8 +48,8 @@ ReadFileContent (
**/
BOOLEAN
UpdateCAFromFile (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
);
/**
@@ -64,8 +64,8 @@ UpdateCAFromFile (
**/
BOOLEAN
UpdatePrivateKeyFromFile (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
IN WIFI_MGR_PRIVATE_DATA *Private,
IN EFI_DEVICE_PATH_PROTOCOL *FilePath
);
#endif

View File

@@ -24,9 +24,9 @@
**/
VOID
WifiMgrUpdateConnectMessage (
IN WIFI_MGR_DEVICE_DATA *Nic,
IN BOOLEAN ConnectStateChanged,
IN EFI_STRING ConnectStatusMessage
IN WIFI_MGR_DEVICE_DATA *Nic,
IN BOOLEAN ConnectStateChanged,
IN EFI_STRING ConnectStatusMessage
);
/**
@@ -183,12 +183,12 @@ WifiMgrDxeHiiConfigAccessRouteConfig (
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
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
);
/**
@@ -203,7 +203,7 @@ WifiMgrDxeHiiConfigAccessCallback (
**/
EFI_STATUS
WifiMgrDxeConfigFormInit (
WIFI_MGR_PRIVATE_DATA *Private
WIFI_MGR_PRIVATE_DATA *Private
);
/**
@@ -217,7 +217,7 @@ WifiMgrDxeConfigFormInit (
**/
EFI_STATUS
WifiMgrDxeConfigFormUnload (
WIFI_MGR_PRIVATE_DATA *Private
WIFI_MGR_PRIVATE_DATA *Private
);
/**
@@ -234,8 +234,8 @@ WifiMgrDxeConfigFormUnload (
**/
EFI_STATUS
WifiMgrRefreshNetworkList (
IN WIFI_MGR_PRIVATE_DATA *Private,
OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
IN WIFI_MGR_PRIVATE_DATA *Private,
OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData
);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
**/
EFI_STATUS
WifiMgrStartScan (
IN WIFI_MGR_DEVICE_DATA *Nic
IN WIFI_MGR_DEVICE_DATA *Nic
);
/**
@@ -61,8 +61,8 @@ WifiMgrGetLinkState (
**/
EFI_STATUS
WifiMgrConnectToNetwork (
IN WIFI_MGR_DEVICE_DATA *Nic,
IN WIFI_MGR_NETWORK_PROFILE *Profile
IN WIFI_MGR_DEVICE_DATA *Nic,
IN WIFI_MGR_NETWORK_PROFILE *Profile
);
/**
@@ -78,7 +78,7 @@ WifiMgrConnectToNetwork (
**/
EFI_STATUS
WifiMgrDisconnectToNetwork (
IN WIFI_MGR_DEVICE_DATA *Nic
IN WIFI_MGR_DEVICE_DATA *Nic
);
/**
@@ -92,8 +92,8 @@ WifiMgrDisconnectToNetwork (
VOID
EFIAPI
WifiMgrOnTimerTick (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
#endif

View File

@@ -19,8 +19,8 @@
VOID
EFIAPI
WifiMgrInternalEmptyFunction (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
)
{
return;
@@ -41,7 +41,7 @@ WifiMgrMacAddrToStr (
OUT CHAR16 *Str
)
{
if (Mac == NULL || Str == NULL) {
if ((Mac == NULL) || (Str == NULL)) {
return;
}
@@ -49,8 +49,12 @@ WifiMgrMacAddrToStr (
Str,
StrSize,
L"%02X:%02X:%02X:%02X:%02X:%02X",
Mac->Addr[0], Mac->Addr[1], Mac->Addr[2],
Mac->Addr[3], Mac->Addr[4], Mac->Addr[5]
Mac->Addr[0],
Mac->Addr[1],
Mac->Addr[2],
Mac->Addr[3],
Mac->Addr[4],
Mac->Addr[5]
);
}
@@ -68,15 +72,14 @@ WifiMgrMacAddrToStr (
**/
EFI_STATUS
WifiMgrReadFileToBuffer (
IN WIFI_MGR_FILE_CONTEXT *FileContext,
OUT VOID **DataAddr,
OUT UINTN *DataSize
IN WIFI_MGR_FILE_CONTEXT *FileContext,
OUT VOID **DataAddr,
OUT UINTN *DataSize
)
{
EFI_STATUS Status;
if (FileContext != NULL && FileContext->FHandle != NULL) {
EFI_STATUS Status;
if ((FileContext != NULL) && (FileContext->FHandle != NULL)) {
Status = ReadFileContent (
FileContext->FHandle,
DataAddr,
@@ -87,6 +90,7 @@ WifiMgrReadFileToBuffer (
if (FileContext->FHandle != NULL) {
FileContext->FHandle->Close (FileContext->FHandle);
}
FileContext->FHandle = NULL;
return Status;
}
@@ -105,20 +109,24 @@ WifiMgrReadFileToBuffer (
**/
WIFI_MGR_DEVICE_DATA *
WifiMgrGetNicByIndex (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN UINT32 NicIndex
IN WIFI_MGR_PRIVATE_DATA *Private,
IN UINT32 NicIndex
)
{
LIST_ENTRY *Entry;
WIFI_MGR_DEVICE_DATA *Nic;
LIST_ENTRY *Entry;
WIFI_MGR_DEVICE_DATA *Nic;
if (Private == NULL) {
return NULL;
}
NET_LIST_FOR_EACH (Entry, &Private->NicList) {
Nic = NET_LIST_USER_STRUCT_S (Entry, WIFI_MGR_DEVICE_DATA,
Link, WIFI_MGR_DEVICE_DATA_SIGNATURE);
Nic = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_DEVICE_DATA,
Link,
WIFI_MGR_DEVICE_DATA_SIGNATURE
);
if (Nic->NicIndex == NicIndex) {
return Nic;
}
@@ -139,22 +147,26 @@ WifiMgrGetNicByIndex (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByUnicodeSSId (
IN CHAR16 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
IN CHAR16 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
)
{
LIST_ENTRY *Entry;
WIFI_MGR_NETWORK_PROFILE *Profile;
LIST_ENTRY *Entry;
WIFI_MGR_NETWORK_PROFILE *Profile;
if (SSId == NULL || ProfileList == NULL) {
if ((SSId == NULL) || (ProfileList == NULL)) {
return NULL;
}
NET_LIST_FOR_EACH (Entry, ProfileList) {
Profile = NET_LIST_USER_STRUCT_S (Entry, WIFI_MGR_NETWORK_PROFILE,
Link, WIFI_MGR_PROFILE_SIGNATURE);
if (StrCmp (SSId, Profile->SSId) == 0 && SecurityType == Profile->SecurityType) {
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
Link,
WIFI_MGR_PROFILE_SIGNATURE
);
if ((StrCmp (SSId, Profile->SSId) == 0) && (SecurityType == Profile->SecurityType)) {
return Profile;
}
}
@@ -174,16 +186,17 @@ WifiMgrGetProfileByUnicodeSSId (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByAsciiSSId (
IN CHAR8 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
IN CHAR8 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
)
{
CHAR16 SSIdUniCode[SSID_STORAGE_SIZE];
CHAR16 SSIdUniCode[SSID_STORAGE_SIZE];
if (SSId == NULL) {
return NULL;
}
if (AsciiStrToUnicodeStrS (SSId, SSIdUniCode, SSID_STORAGE_SIZE) != RETURN_SUCCESS) {
return NULL;
}
@@ -202,19 +215,24 @@ WifiMgrGetProfileByAsciiSSId (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByProfileIndex (
IN UINT32 ProfileIndex,
IN LIST_ENTRY *ProfileList
IN UINT32 ProfileIndex,
IN LIST_ENTRY *ProfileList
)
{
WIFI_MGR_NETWORK_PROFILE *Profile;
LIST_ENTRY *Entry;
WIFI_MGR_NETWORK_PROFILE *Profile;
LIST_ENTRY *Entry;
if (ProfileList == NULL) {
return NULL;
}
NET_LIST_FOR_EACH (Entry, ProfileList) {
Profile = NET_LIST_USER_STRUCT_S (Entry, WIFI_MGR_NETWORK_PROFILE,
Link, WIFI_MGR_PROFILE_SIGNATURE);
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
Link,
WIFI_MGR_PROFILE_SIGNATURE
);
if (Profile->ProfileIndex == ProfileIndex) {
return Profile;
}
@@ -234,19 +252,20 @@ WifiMgrGetProfileByProfileIndex (
**/
BOOLEAN
WifiMgrSupportAKMSuite (
IN UINT16 SupportedAKMSuiteCount,
IN UINT32 *SupportedAKMSuiteList,
IN UINT32 *AKMSuite
IN UINT16 SupportedAKMSuiteCount,
IN UINT32 *SupportedAKMSuiteList,
IN UINT32 *AKMSuite
)
{
UINT16 Index;
UINT16 Index;
if (AKMSuite == NULL || SupportedAKMSuiteList == NULL ||
SupportedAKMSuiteCount == 0) {
if ((AKMSuite == NULL) || (SupportedAKMSuiteList == NULL) ||
(SupportedAKMSuiteCount == 0))
{
return FALSE;
}
for (Index = 0; Index < SupportedAKMSuiteCount; Index ++) {
for (Index = 0; Index < SupportedAKMSuiteCount; Index++) {
if (SupportedAKMSuiteList[Index] == *AKMSuite) {
return TRUE;
}
@@ -267,19 +286,20 @@ WifiMgrSupportAKMSuite (
**/
BOOLEAN
WifiMgrSupportCipherSuite (
IN UINT16 SupportedCipherSuiteCount,
IN UINT32 *SupportedCipherSuiteList,
IN UINT32 *CipherSuite
IN UINT16 SupportedCipherSuiteCount,
IN UINT32 *SupportedCipherSuiteList,
IN UINT32 *CipherSuite
)
{
UINT16 Index;
if (CipherSuite == NULL || SupportedCipherSuiteCount == 0 ||
SupportedCipherSuiteList == NULL) {
if ((CipherSuite == NULL) || (SupportedCipherSuiteCount == 0) ||
(SupportedCipherSuiteList == NULL))
{
return FALSE;
}
for (Index = 0; Index < SupportedCipherSuiteCount; Index ++) {
for (Index = 0; Index < SupportedCipherSuiteCount; Index++) {
if (SupportedCipherSuiteList[Index] == *CipherSuite) {
return TRUE;
}
@@ -309,23 +329,23 @@ WifiMgrSupportCipherSuite (
**/
EFI_STATUS
WifiMgrCheckRSN (
IN EFI_80211_AKM_SUITE_SELECTOR *AKMList,
IN EFI_80211_CIPHER_SUITE_SELECTOR *CipherList,
IN WIFI_MGR_DEVICE_DATA *Nic,
OUT UINT8 *SecurityType,
OUT BOOLEAN *AKMSuiteSupported,
OUT BOOLEAN *CipherSuiteSupported
IN EFI_80211_AKM_SUITE_SELECTOR *AKMList,
IN EFI_80211_CIPHER_SUITE_SELECTOR *CipherList,
IN WIFI_MGR_DEVICE_DATA *Nic,
OUT UINT8 *SecurityType,
OUT BOOLEAN *AKMSuiteSupported,
OUT BOOLEAN *CipherSuiteSupported
)
{
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
EFI_80211_SUITE_SELECTOR *AKMSuite;
EFI_80211_SUITE_SELECTOR *CipherSuite;
UINT16 AKMIndex;
UINT16 CipherIndex;
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
EFI_80211_SUITE_SELECTOR *AKMSuite;
EFI_80211_SUITE_SELECTOR *CipherSuite;
UINT16 AKMIndex;
UINT16 CipherIndex;
if (Nic == NULL || AKMList == NULL || CipherList == NULL|| SecurityType == NULL) {
if ((Nic == NULL) || (AKMList == NULL) || (CipherList == NULL) || (SecurityType == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -334,7 +354,7 @@ WifiMgrCheckRSN (
SupportedHwCipherSuites = Nic->SupportedSuites.SupportedHwCipherSuites;
*SecurityType = SECURITY_TYPE_UNKNOWN;
if (AKMSuiteSupported != NULL && CipherSuiteSupported != NULL) {
if ((AKMSuiteSupported != NULL) && (CipherSuiteSupported != NULL)) {
*AKMSuiteSupported = FALSE;
*CipherSuiteSupported = FALSE;
}
@@ -342,7 +362,7 @@ WifiMgrCheckRSN (
if (AKMList->AKMSuiteCount == 0) {
if (CipherList->CipherSuiteCount == 0) {
*SecurityType = SECURITY_TYPE_NONE;
if (AKMSuiteSupported != NULL && CipherSuiteSupported != NULL) {
if ((AKMSuiteSupported != NULL) && (CipherSuiteSupported != NULL)) {
*AKMSuiteSupported = TRUE;
*CipherSuiteSupported = TRUE;
}
@@ -351,48 +371,54 @@ WifiMgrCheckRSN (
return EFI_SUCCESS;
}
for (AKMIndex = 0; AKMIndex < AKMList->AKMSuiteCount; AKMIndex ++) {
for (AKMIndex = 0; AKMIndex < AKMList->AKMSuiteCount; AKMIndex++) {
AKMSuite = AKMList->AKMSuiteList + AKMIndex;
if (WifiMgrSupportAKMSuite(SupportedAKMSuites->AKMSuiteCount,
(UINT32*) SupportedAKMSuites->AKMSuiteList, (UINT32*) AKMSuite)) {
if (AKMSuiteSupported != NULL && CipherSuiteSupported != NULL) {
if (WifiMgrSupportAKMSuite (
SupportedAKMSuites->AKMSuiteCount,
(UINT32 *)SupportedAKMSuites->AKMSuiteList,
(UINT32 *)AKMSuite
))
{
if ((AKMSuiteSupported != NULL) && (CipherSuiteSupported != NULL)) {
*AKMSuiteSupported = TRUE;
}
for (CipherIndex = 0; CipherIndex < CipherList->CipherSuiteCount; CipherIndex ++) {
for (CipherIndex = 0; CipherIndex < CipherList->CipherSuiteCount; CipherIndex++) {
CipherSuite = CipherList->CipherSuiteList + CipherIndex;
if (SupportedSwCipherSuites != NULL) {
if (WifiMgrSupportCipherSuite(SupportedSwCipherSuites->CipherSuiteCount,
(UINT32*) SupportedSwCipherSuites->CipherSuiteList, (UINT32*) CipherSuite)) {
*SecurityType = WifiMgrGetSecurityType ((UINT32*) AKMSuite, (UINT32*) CipherSuite);
if (WifiMgrSupportCipherSuite (
SupportedSwCipherSuites->CipherSuiteCount,
(UINT32 *)SupportedSwCipherSuites->CipherSuiteList,
(UINT32 *)CipherSuite
))
{
*SecurityType = WifiMgrGetSecurityType ((UINT32 *)AKMSuite, (UINT32 *)CipherSuite);
if (*SecurityType != SECURITY_TYPE_UNKNOWN) {
if (AKMSuiteSupported != NULL && CipherSuiteSupported != NULL) {
if ((AKMSuiteSupported != NULL) && (CipherSuiteSupported != NULL)) {
*CipherSuiteSupported = TRUE;
}
return EFI_SUCCESS;
}
}
}
if (SupportedHwCipherSuites != NULL) {
if (WifiMgrSupportCipherSuite(SupportedHwCipherSuites->CipherSuiteCount,
(UINT32*) SupportedHwCipherSuites->CipherSuiteList, (UINT32*) CipherSuite)) {
*SecurityType = WifiMgrGetSecurityType ((UINT32*) AKMSuite, (UINT32*) CipherSuite);
if (WifiMgrSupportCipherSuite (
SupportedHwCipherSuites->CipherSuiteCount,
(UINT32 *)SupportedHwCipherSuites->CipherSuiteList,
(UINT32 *)CipherSuite
))
{
*SecurityType = WifiMgrGetSecurityType ((UINT32 *)AKMSuite, (UINT32 *)CipherSuite);
if (*SecurityType != SECURITY_TYPE_UNKNOWN) {
if (AKMSuiteSupported != NULL && CipherSuiteSupported != NULL) {
if ((AKMSuiteSupported != NULL) && (CipherSuiteSupported != NULL)) {
*CipherSuiteSupported = TRUE;
}
return EFI_SUCCESS;
}
}
@@ -401,8 +427,10 @@ WifiMgrCheckRSN (
}
}
*SecurityType = WifiMgrGetSecurityType ((UINT32*) AKMList->AKMSuiteList,
(UINT32*) CipherList->CipherSuiteList);
*SecurityType = WifiMgrGetSecurityType (
(UINT32 *)AKMList->AKMSuiteList,
(UINT32 *)CipherList->CipherSuiteList
);
return EFI_SUCCESS;
}
@@ -418,60 +446,56 @@ WifiMgrCheckRSN (
**/
UINT8
WifiMgrGetSecurityType (
IN UINT32 *AKMSuite,
IN UINT32 *CipherSuite
IN UINT32 *AKMSuite,
IN UINT32 *CipherSuite
)
{
if (CipherSuite == NULL) {
if (AKMSuite == NULL) {
return SECURITY_TYPE_NONE;
} else {
return SECURITY_TYPE_UNKNOWN;
}
} else if (*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_USE_GROUP) {
if (AKMSuite == NULL) {
return SECURITY_TYPE_NONE;
} else {
return SECURITY_TYPE_UNKNOWN;
}
} else if (*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP40 ||
*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP104) {
} else if ((*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP40) ||
(*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_WEP104))
{
return SECURITY_TYPE_WEP;
} else if (*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_CCMP) {
if (AKMSuite == NULL) {
return SECURITY_TYPE_UNKNOWN;
}
if (*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA ||
*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA_SHA256) {
if ((*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA) ||
(*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA_SHA256))
{
return SECURITY_TYPE_WPA2_ENTERPRISE;
} else if (*AKMSuite == IEEE_80211_AKM_SUITE_PSK ||
*AKMSuite == IEEE_80211_AKM_SUITE_PSK_SHA256){
} else if ((*AKMSuite == IEEE_80211_AKM_SUITE_PSK) ||
(*AKMSuite == IEEE_80211_AKM_SUITE_PSK_SHA256))
{
return SECURITY_TYPE_WPA2_PERSONAL;
}else {
} else {
return SECURITY_TYPE_UNKNOWN;
}
} else if (*CipherSuite == IEEE_80211_PAIRWISE_CIPHER_SUITE_TKIP) {
if (AKMSuite == NULL) {
return SECURITY_TYPE_UNKNOWN;
}
if (*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA ||
*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA_SHA256) {
if ((*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA) ||
(*AKMSuite == IEEE_80211_AKM_SUITE_8021X_OR_PMKSA_SHA256))
{
return SECURITY_TYPE_WPA_ENTERPRISE;
} else if (*AKMSuite == IEEE_80211_AKM_SUITE_PSK ||
*AKMSuite == IEEE_80211_AKM_SUITE_PSK_SHA256){
} else if ((*AKMSuite == IEEE_80211_AKM_SUITE_PSK) ||
(*AKMSuite == IEEE_80211_AKM_SUITE_PSK_SHA256))
{
return SECURITY_TYPE_WPA_PERSONAL;
}else {
} else {
return SECURITY_TYPE_UNKNOWN;
}
} else {
@@ -490,36 +514,40 @@ WifiMgrGetSecurityType (
**/
EFI_STATUS
WifiMgrGetSupportedSuites (
IN WIFI_MGR_DEVICE_DATA *Nic
IN WIFI_MGR_DEVICE_DATA *Nic
)
{
EFI_STATUS Status;
EFI_SUPPLICANT_PROTOCOL *Supplicant;
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
UINTN DataSize;
EFI_STATUS Status;
EFI_SUPPLICANT_PROTOCOL *Supplicant;
EFI_80211_AKM_SUITE_SELECTOR *SupportedAKMSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedSwCipherSuites;
EFI_80211_CIPHER_SUITE_SELECTOR *SupportedHwCipherSuites;
UINTN DataSize;
SupportedAKMSuites = NULL;
SupportedSwCipherSuites = NULL;
SupportedHwCipherSuites = NULL;
if (Nic == NULL || Nic->Supplicant == NULL) {
if ((Nic == NULL) || (Nic->Supplicant == NULL)) {
return EFI_INVALID_PARAMETER;
}
Supplicant = Nic->Supplicant;
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedAKMSuites, NULL, &DataSize);
if (Status == EFI_BUFFER_TOO_SMALL && DataSize > 0) {
SupportedAKMSuites = AllocateZeroPool(DataSize);
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedAKMSuites, NULL, &DataSize);
if ((Status == EFI_BUFFER_TOO_SMALL) && (DataSize > 0)) {
SupportedAKMSuites = AllocateZeroPool (DataSize);
if (SupportedAKMSuites == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedAKMSuites,
(UINT8 *) SupportedAKMSuites, &DataSize);
Status = Supplicant->GetData (
Supplicant,
EfiSupplicant80211SupportedAKMSuites,
(UINT8 *)SupportedAKMSuites,
&DataSize
);
if (!EFI_ERROR (Status)) {
Nic->SupportedSuites.SupportedAKMSuites = SupportedAKMSuites;
} else {
@@ -529,17 +557,20 @@ WifiMgrGetSupportedSuites (
SupportedAKMSuites = NULL;
}
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedSoftwareCipherSuites, NULL, &DataSize);
if (Status == EFI_BUFFER_TOO_SMALL && DataSize > 0) {
SupportedSwCipherSuites = AllocateZeroPool(DataSize);
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedSoftwareCipherSuites, NULL, &DataSize);
if ((Status == EFI_BUFFER_TOO_SMALL) && (DataSize > 0)) {
SupportedSwCipherSuites = AllocateZeroPool (DataSize);
if (SupportedSwCipherSuites == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedSoftwareCipherSuites,
(UINT8 *) SupportedSwCipherSuites, &DataSize);
Status = Supplicant->GetData (
Supplicant,
EfiSupplicant80211SupportedSoftwareCipherSuites,
(UINT8 *)SupportedSwCipherSuites,
&DataSize
);
if (!EFI_ERROR (Status)) {
Nic->SupportedSuites.SupportedSwCipherSuites = SupportedSwCipherSuites;
} else {
@@ -549,16 +580,20 @@ WifiMgrGetSupportedSuites (
SupportedSwCipherSuites = NULL;
}
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedHardwareCipherSuites, NULL, &DataSize);
if (Status == EFI_BUFFER_TOO_SMALL && DataSize > 0) {
SupportedHwCipherSuites = AllocateZeroPool(DataSize);
DataSize = 0;
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedHardwareCipherSuites, NULL, &DataSize);
if ((Status == EFI_BUFFER_TOO_SMALL) && (DataSize > 0)) {
SupportedHwCipherSuites = AllocateZeroPool (DataSize);
if (SupportedHwCipherSuites == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Status = Supplicant->GetData (Supplicant, EfiSupplicant80211SupportedHardwareCipherSuites,
(UINT8 *) SupportedHwCipherSuites, &DataSize);
Status = Supplicant->GetData (
Supplicant,
EfiSupplicant80211SupportedHardwareCipherSuites,
(UINT8 *)SupportedHwCipherSuites,
&DataSize
);
if (!EFI_ERROR (Status)) {
Nic->SupportedSuites.SupportedHwCipherSuites = SupportedHwCipherSuites;
} else {
@@ -579,7 +614,7 @@ WifiMgrGetSupportedSuites (
**/
VOID
WifiMgrCleanProfileSecrets (
IN WIFI_MGR_NETWORK_PROFILE *Profile
IN WIFI_MGR_NETWORK_PROFILE *Profile
)
{
ZeroMem (Profile->Password, sizeof (CHAR16) * PASSWORD_STORAGE_SIZE);
@@ -587,26 +622,26 @@ WifiMgrCleanProfileSecrets (
ZeroMem (Profile->PrivateKeyPassword, sizeof (CHAR16) * PASSWORD_STORAGE_SIZE);
if (Profile->CACertData != NULL) {
ZeroMem (Profile->CACertData, Profile->CACertSize);
FreePool (Profile->CACertData);
}
Profile->CACertData = NULL;
Profile->CACertSize = 0;
if (Profile->ClientCertData != NULL) {
ZeroMem (Profile->ClientCertData, Profile->ClientCertSize);
FreePool (Profile->ClientCertData);
}
Profile->ClientCertData = NULL;
Profile->ClientCertSize = 0;
if (Profile->PrivateKeyData != NULL) {
ZeroMem (Profile->PrivateKeyData, Profile->PrivateKeyDataSize);
FreePool (Profile->PrivateKeyData);
}
Profile->PrivateKeyData = NULL;
Profile->PrivateKeyDataSize = 0;
}
@@ -619,30 +654,33 @@ WifiMgrCleanProfileSecrets (
**/
VOID
WifiMgrFreeProfileList (
IN LIST_ENTRY *ProfileList
IN LIST_ENTRY *ProfileList
)
{
WIFI_MGR_NETWORK_PROFILE *Profile;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
WIFI_MGR_NETWORK_PROFILE *Profile;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
if (ProfileList == NULL) {
return;
}
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, ProfileList) {
Profile = NET_LIST_USER_STRUCT_S (Entry, WIFI_MGR_NETWORK_PROFILE,
Link, WIFI_MGR_PROFILE_SIGNATURE);
Profile = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_MGR_NETWORK_PROFILE,
Link,
WIFI_MGR_PROFILE_SIGNATURE
);
WifiMgrCleanProfileSecrets (Profile);
if (Profile->Network.AKMSuite != NULL) {
FreePool(Profile->Network.AKMSuite);
FreePool (Profile->Network.AKMSuite);
}
if (Profile->Network.CipherSuite != NULL) {
FreePool(Profile->Network.CipherSuite);
FreePool (Profile->Network.CipherSuite);
}
FreePool (Profile);
@@ -657,26 +695,28 @@ WifiMgrFreeProfileList (
**/
VOID
WifiMgrFreeHiddenList (
IN LIST_ENTRY *HiddenList
IN LIST_ENTRY *HiddenList
)
{
WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
WIFI_HIDDEN_NETWORK_DATA *HiddenNetwork;
LIST_ENTRY *Entry;
LIST_ENTRY *NextEntry;
if (HiddenList == NULL) {
return;
}
NET_LIST_FOR_EACH_SAFE (Entry, NextEntry, HiddenList) {
HiddenNetwork = NET_LIST_USER_STRUCT_S (Entry, WIFI_HIDDEN_NETWORK_DATA,
Link, WIFI_MGR_HIDDEN_NETWORK_SIGNATURE);
HiddenNetwork = NET_LIST_USER_STRUCT_S (
Entry,
WIFI_HIDDEN_NETWORK_DATA,
Link,
WIFI_MGR_HIDDEN_NETWORK_SIGNATURE
);
FreePool (HiddenNetwork);
}
}
/**
Free the resources of a config token.
@@ -684,24 +724,22 @@ WifiMgrFreeHiddenList (
**/
VOID
WifiMgrFreeToken (
IN WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken
IN WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken
)
{
EFI_80211_GET_NETWORKS_RESULT *Result;
EFI_80211_GET_NETWORKS_RESULT *Result;
if (ConfigToken == NULL) {
return;
}
switch (ConfigToken->Type) {
case TokenTypeGetNetworksToken:
if (ConfigToken->Token.GetNetworksToken != NULL) {
gBS->CloseEvent (ConfigToken->Token.GetNetworksToken->Event);
if (ConfigToken->Token.GetNetworksToken->Data != NULL) {
FreePool(ConfigToken->Token.GetNetworksToken->Data);
FreePool (ConfigToken->Token.GetNetworksToken->Data);
}
Result = ConfigToken->Token.GetNetworksToken->Result;
@@ -709,7 +747,7 @@ WifiMgrFreeToken (
FreePool (Result);
}
FreePool(ConfigToken->Token.GetNetworksToken);
FreePool (ConfigToken->Token.GetNetworksToken);
}
FreePool (ConfigToken);
@@ -718,27 +756,27 @@ WifiMgrFreeToken (
case TokenTypeConnectNetworkToken:
if (ConfigToken->Token.ConnectNetworkToken != NULL) {
gBS->CloseEvent (ConfigToken->Token.ConnectNetworkToken->Event);
if (ConfigToken->Token.ConnectNetworkToken->Data != NULL) {
FreePool(ConfigToken->Token.ConnectNetworkToken->Data);
FreePool (ConfigToken->Token.ConnectNetworkToken->Data);
}
FreePool(ConfigToken->Token.ConnectNetworkToken);
FreePool (ConfigToken->Token.ConnectNetworkToken);
}
FreePool (ConfigToken);
break;
case TokenTypeDisconnectNetworkToken:
if (ConfigToken->Token.DisconnectNetworkToken != NULL) {
FreePool(ConfigToken->Token.DisconnectNetworkToken);
FreePool (ConfigToken->Token.DisconnectNetworkToken);
}
FreePool (ConfigToken);
break;
default :
default:
break;
}
}

View File

@@ -20,8 +20,8 @@
VOID
EFIAPI
WifiMgrInternalEmptyFunction (
IN EFI_EVENT Event,
IN VOID *Context
IN EFI_EVENT Event,
IN VOID *Context
);
/**
@@ -34,9 +34,9 @@ WifiMgrInternalEmptyFunction (
**/
VOID
WifiMgrMacAddrToStr (
IN EFI_80211_MAC_ADDRESS *Mac,
IN UINT32 StrSize,
OUT CHAR16 *Str
IN EFI_80211_MAC_ADDRESS *Mac,
IN UINT32 StrSize,
OUT CHAR16 *Str
);
/**
@@ -53,12 +53,11 @@ WifiMgrMacAddrToStr (
**/
EFI_STATUS
WifiMgrReadFileToBuffer (
IN WIFI_MGR_FILE_CONTEXT *FileContext,
OUT VOID **PrivateKeyDataAddr,
OUT UINTN *PrivateKeyDataSize
IN WIFI_MGR_FILE_CONTEXT *FileContext,
OUT VOID **PrivateKeyDataAddr,
OUT UINTN *PrivateKeyDataSize
);
/**
Get the Nic data by the NicIndex.
@@ -70,8 +69,8 @@ WifiMgrReadFileToBuffer (
**/
WIFI_MGR_DEVICE_DATA *
WifiMgrGetNicByIndex (
IN WIFI_MGR_PRIVATE_DATA *Private,
IN UINT32 NicIndex
IN WIFI_MGR_PRIVATE_DATA *Private,
IN UINT32 NicIndex
);
/**
@@ -86,9 +85,9 @@ WifiMgrGetNicByIndex (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByUnicodeSSId (
IN CHAR16 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
IN CHAR16 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
);
/**
@@ -103,9 +102,9 @@ WifiMgrGetProfileByUnicodeSSId (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByAsciiSSId (
IN CHAR8 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
IN CHAR8 *SSId,
IN UINT8 SecurityType,
IN LIST_ENTRY *ProfileList
);
/**
@@ -119,8 +118,8 @@ WifiMgrGetProfileByAsciiSSId (
**/
WIFI_MGR_NETWORK_PROFILE *
WifiMgrGetProfileByProfileIndex (
IN UINT32 ProfileIndex,
IN LIST_ENTRY *ProfileList
IN UINT32 ProfileIndex,
IN LIST_ENTRY *ProfileList
);
/**
@@ -135,9 +134,9 @@ WifiMgrGetProfileByProfileIndex (
**/
BOOLEAN
WifiMgrSupportAKMSuite (
IN UINT16 SupportedAKMSuiteCount,
IN UINT32 *SupportedAKMSuiteList,
IN UINT32 *AKMSuite
IN UINT16 SupportedAKMSuiteCount,
IN UINT32 *SupportedAKMSuiteList,
IN UINT32 *AKMSuite
);
/**
@@ -152,9 +151,9 @@ WifiMgrSupportAKMSuite (
**/
BOOLEAN
WifiMgrSupportCipherSuite (
IN UINT16 SupportedCipherSuiteCount,
IN UINT32 *SupportedCipherSuiteList,
IN UINT32 *CipherSuite
IN UINT16 SupportedCipherSuiteCount,
IN UINT32 *SupportedCipherSuiteList,
IN UINT32 *CipherSuite
);
/**
@@ -178,12 +177,12 @@ WifiMgrSupportCipherSuite (
**/
EFI_STATUS
WifiMgrCheckRSN (
IN EFI_80211_AKM_SUITE_SELECTOR *AKMList,
IN EFI_80211_CIPHER_SUITE_SELECTOR *CipherList,
IN WIFI_MGR_DEVICE_DATA *Nic,
OUT UINT8 *SecurityType,
OUT BOOLEAN *AKMSuiteSupported,
OUT BOOLEAN *CipherSuiteSupported
IN EFI_80211_AKM_SUITE_SELECTOR *AKMList,
IN EFI_80211_CIPHER_SUITE_SELECTOR *CipherList,
IN WIFI_MGR_DEVICE_DATA *Nic,
OUT UINT8 *SecurityType,
OUT BOOLEAN *AKMSuiteSupported,
OUT BOOLEAN *CipherSuiteSupported
);
/**
@@ -197,8 +196,8 @@ WifiMgrCheckRSN (
**/
UINT8
WifiMgrGetSecurityType (
IN UINT32 *AKMSuite,
IN UINT32 *CipherSuite
IN UINT32 *AKMSuite,
IN UINT32 *CipherSuite
);
/**
@@ -212,7 +211,7 @@ WifiMgrGetSecurityType (
**/
EFI_STATUS
WifiMgrGetSupportedSuites (
IN WIFI_MGR_DEVICE_DATA *Nic
IN WIFI_MGR_DEVICE_DATA *Nic
);
/**
@@ -223,7 +222,7 @@ WifiMgrGetSupportedSuites (
**/
VOID
WifiMgrCleanProfileSecrets (
IN WIFI_MGR_NETWORK_PROFILE *Profile
IN WIFI_MGR_NETWORK_PROFILE *Profile
);
/**
@@ -234,7 +233,7 @@ WifiMgrCleanProfileSecrets (
**/
VOID
WifiMgrFreeProfileList (
IN LIST_ENTRY *ProfileList
IN LIST_ENTRY *ProfileList
);
/**
@@ -245,7 +244,7 @@ WifiMgrFreeProfileList (
**/
VOID
WifiMgrFreeHiddenList (
IN LIST_ENTRY *HiddenList
IN LIST_ENTRY *HiddenList
);
/**
@@ -256,7 +255,7 @@ WifiMgrFreeHiddenList (
**/
VOID
WifiMgrFreeToken (
IN WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken
IN WIFI_MGR_MAC_CONFIG_TOKEN *ConfigToken
);
#endif