hostap: add pwe config for station

Add pwe config for station connect cmd.

Signed-off-by: Rex Chen <rex.chen_1@nxp.com>
This commit is contained in:
Rex Chen 2024-07-24 02:19:35 -07:00 committed by Anas Nashif
parent a08335b317
commit ff7bb3e85c
4 changed files with 29 additions and 6 deletions

View file

@ -48,6 +48,12 @@ enum wifi_security_type {
WIFI_SECURITY_TYPE_PSK_SHA256,
/** WPA3-SAE security. */
WIFI_SECURITY_TYPE_SAE,
/** WPA3-SAE security with hunting-and-pecking loop. */
WIFI_SECURITY_TYPE_SAE_HNP = WIFI_SECURITY_TYPE_SAE,
/** WPA3-SAE security with hash-to-element. */
WIFI_SECURITY_TYPE_SAE_H2E,
/** WPA3-SAE security with both hunting-and-pecking loop and hash-to-element enabled. */
WIFI_SECURITY_TYPE_SAE_AUTO,
/** GB 15629.11-2003 WAPI security. */
WIFI_SECURITY_TYPE_WAPI,
/** EAP security - Enterprise. */

View file

@ -399,7 +399,9 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
}
}
if (params->security == WIFI_SECURITY_TYPE_SAE) {
if (params->security == WIFI_SECURITY_TYPE_SAE_HNP ||
params->security == WIFI_SECURITY_TYPE_SAE_H2E ||
params->security == WIFI_SECURITY_TYPE_SAE_AUTO) {
if (params->sae_password) {
if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"",
resp.network_id, params->sae_password)) {
@ -412,6 +414,15 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
}
}
if (params->security == WIFI_SECURITY_TYPE_SAE_H2E ||
params->security == WIFI_SECURITY_TYPE_SAE_AUTO) {
params->sae_pwe =
(params->security == WIFI_SECURITY_TYPE_SAE_H2E) ? 1 : 2;
if (!wpa_cli_cmd_v("set sae_pwe %d", params->sae_pwe)) {
goto out;
}
}
if (!wpa_cli_cmd_v("set_network %d key_mgmt SAE", resp.network_id)) {
goto out;
}

View file

@ -31,8 +31,12 @@ const char *wifi_security_txt(enum wifi_security_type security)
return "WPA2-PSK";
case WIFI_SECURITY_TYPE_PSK_SHA256:
return "WPA2-PSK-SHA256";
case WIFI_SECURITY_TYPE_SAE:
return "WPA3-SAE";
case WIFI_SECURITY_TYPE_SAE_HNP:
return "WPA3-SAE-HNP";
case WIFI_SECURITY_TYPE_SAE_H2E:
return "WPA3-SAE-H2E";
case WIFI_SECURITY_TYPE_SAE_AUTO:
return "WPA3-SAE-AUTO";
case WIFI_SECURITY_TYPE_WAPI:
return "WAPI";
case WIFI_SECURITY_TYPE_EAP:
@ -280,7 +284,9 @@ static int wifi_connect(uint32_t mgmt_request, struct net_if *iface,
params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) &&
((params->psk_length < 8) || (params->psk_length > 64) ||
(params->psk_length == 0U) || !params->psk)) ||
((params->security == WIFI_SECURITY_TYPE_SAE) &&
((params->security == WIFI_SECURITY_TYPE_SAE_HNP ||
params->security == WIFI_SECURITY_TYPE_SAE_H2E ||
params->security == WIFI_SECURITY_TYPE_SAE_AUTO) &&
((params->psk_length == 0U) || !params->psk) &&
((params->sae_password_length == 0U) || !params->sae_password)) ||
((params->channel != WIFI_CHANNEL_ANY) &&

View file

@ -2500,8 +2500,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_commands,
"[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]\n"
"[-p, --psk]: Passphrase (valid only for secure SSIDs)\n"
"[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n"
"0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE, 4:WAPI, 5:EAP, 6:WEP,"
" 7: WPA-PSK, 8: WPA-Auto-Personal\n"
"0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI,"
" 7:EAP, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal\n"
"[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n"
": 0:Disable, 1:Optional, 2:Required.\n"
"[-m, --bssid]: MAC address of the AP (BSSID).\n"