hostapd: Support 4-way handshake offload for AP/P2P GO
Add support for offloaded 4-way handshake in AP/P2P GO mode. For drivers supporting the AP PSK offload, wpa_supplicant/hostapd passes down the PSK for the driver to handle the 4-way handshake. The driver is expected to indicate port authorized event to indicate that the 4-way handshake is completed successfully. Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
This commit is contained in:
parent
77386f51ac
commit
da364180fb
9 changed files with 88 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "common/ieee802_11_common.h"
|
||||
#include "common/hw_features_common.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
#include "crypto/sha1.h"
|
||||
#include "wps/wps_defs.h"
|
||||
#include "p2p/p2p.h"
|
||||
#include "hostapd.h"
|
||||
|
@ -2026,6 +2027,23 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
|
|||
resp = hostapd_probe_resp_offloads(hapd, &resp_len);
|
||||
#endif /* NEED_AP_MLME */
|
||||
|
||||
/* If key management offload is enabled, configure PSK to the driver. */
|
||||
if (wpa_key_mgmt_wpa_psk_no_sae(hapd->conf->wpa_key_mgmt) &&
|
||||
(hapd->iface->drv_flags2 &
|
||||
WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK)) {
|
||||
if (hapd->conf->ssid.wpa_psk && hapd->conf->ssid.wpa_psk_set) {
|
||||
os_memcpy(params->psk, hapd->conf->ssid.wpa_psk->psk,
|
||||
PMK_LEN);
|
||||
params->psk_len = PMK_LEN;
|
||||
} else if (hapd->conf->ssid.wpa_passphrase &&
|
||||
pbkdf2_sha1(hapd->conf->ssid.wpa_passphrase,
|
||||
hapd->conf->ssid.ssid,
|
||||
hapd->conf->ssid.ssid_len, 4096,
|
||||
params->psk, PMK_LEN) == 0) {
|
||||
params->psk_len = PMK_LEN;
|
||||
}
|
||||
}
|
||||
|
||||
params->head = (u8 *) head;
|
||||
params->head_len = head_len;
|
||||
params->tail = tail;
|
||||
|
|
|
@ -2186,6 +2186,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
|||
union wpa_event_data *data)
|
||||
{
|
||||
struct hostapd_data *hapd = ctx;
|
||||
struct sta_info *sta;
|
||||
#ifndef CONFIG_NO_STDOUT_DEBUG
|
||||
int level = MSG_DEBUG;
|
||||
|
||||
|
@ -2305,6 +2306,15 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
|||
data->assoc_info.link_addr,
|
||||
data->assoc_info.reassoc);
|
||||
break;
|
||||
case EVENT_PORT_AUTHORIZED:
|
||||
/* Port authorized event for an associated STA */
|
||||
sta = ap_get_sta(hapd, data->port_authorized.sta_addr);
|
||||
if (sta)
|
||||
ap_sta_set_authorized(hapd, sta, 1);
|
||||
else
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"No STA info matching port authorized event found");
|
||||
break;
|
||||
#ifdef CONFIG_OWE
|
||||
case EVENT_UPDATE_DH:
|
||||
if (!data)
|
||||
|
|
|
@ -3573,8 +3573,12 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
sta->auth_alg != WLAN_AUTH_FILS_PK &&
|
||||
!(sta->flags & (WLAN_STA_WPS | WLAN_STA_MAYBE_WPS)))
|
||||
wpa_auth_sm_event(sta->wpa_sm, WPA_REAUTH);
|
||||
} else
|
||||
} else if (!(hapd->iface->drv_flags2 &
|
||||
WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK)) {
|
||||
/* The 4-way handshake offloaded case will have this handled
|
||||
* based on the port authorized event. */
|
||||
wpa_auth_sta_associated(hapd->wpa_auth, sta->wpa_sm);
|
||||
}
|
||||
|
||||
if (hapd->iface->drv_flags & WPA_DRIVER_FLAGS_WIRED) {
|
||||
if (eloop_cancel_timeout(ap_handle_timer, hapd, sta) > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue