Skip to content

Commit 79222c9

Browse files
gangli02nashif
authored andcommitted
hostap: add WPA-Auto-Personal(WPA2/WPA3 mixed) support
Add WPA-Auto-Personal support for AP and STA. This mode uses WPA2/WPA3 SAE mixed security with PSK. Signed-off-by: Gang Li <[email protected]>
1 parent d04c3c1 commit 79222c9

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

modules/hostap/src/supp_api.c

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,32 @@ static int wpas_add_and_config_network(struct wpa_supplicant *wpa_s,
605605
goto out;
606606
}
607607
}
608+
} else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) {
609+
if (!wpa_cli_cmd_v("set_network %d psk \"%s\"", resp.network_id,
610+
psk_null_terminated)) {
611+
goto out;
612+
}
613+
614+
if (params->sae_password) {
615+
if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"",
616+
resp.network_id, sae_null_terminated)) {
617+
goto out;
618+
}
619+
} else {
620+
if (!wpa_cli_cmd_v("set_network %d sae_password \"%s\"",
621+
resp.network_id, psk_null_terminated)) {
622+
goto out;
623+
}
624+
}
625+
626+
if (!wpa_cli_cmd_v("set sae_pwe 2")) {
627+
goto out;
628+
}
629+
630+
if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-PSK SAE",
631+
resp.network_id)) {
632+
goto out;
633+
}
608634
#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE
609635
} else if (params->security == WIFI_SECURITY_TYPE_EAP_TLS) {
610636
if (!wpa_cli_cmd_v("set_network %d key_mgmt WPA-EAP",
@@ -1494,7 +1520,32 @@ int hapd_config_network(struct hostapd_iface *iface,
14941520
if (!hostapd_cli_cmd_v("set sae_pwe 2")) {
14951521
goto out;
14961522
}
1497-
iface->bss[0]->conf->sae_pwe = 2;
1523+
} else if (params->security == WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL) {
1524+
if (!hostapd_cli_cmd_v("set wpa 2")) {
1525+
goto out;
1526+
}
1527+
1528+
if (!hostapd_cli_cmd_v("set wpa_key_mgmt WPA-PSK SAE")) {
1529+
goto out;
1530+
}
1531+
1532+
if (!hostapd_cli_cmd_v("set wpa_passphrase \"%s\"", params->psk)) {
1533+
goto out;
1534+
}
1535+
1536+
if (!hostapd_cli_cmd_v("set sae_password \"%s\"",
1537+
params->sae_password ? params->sae_password
1538+
: params->psk)) {
1539+
goto out;
1540+
}
1541+
1542+
if (!hostapd_cli_cmd_v("set rsn_pairwise CCMP")) {
1543+
goto out;
1544+
}
1545+
1546+
if (!hostapd_cli_cmd_v("set sae_pwe 2")) {
1547+
goto out;
1548+
}
14981549
} else if (params->security == WIFI_SECURITY_TYPE_DPP) {
14991550
if (!hostapd_cli_cmd_v("set wpa 2")) {
15001551
goto out;

0 commit comments

Comments
 (0)