From d984c7b2980153c846a927aef10e5ba479c02d50 Mon Sep 17 00:00:00 2001 From: Vinayak Yadawad Date: Thu, 9 Nov 2023 10:32:23 +0530 Subject: [PATCH] hostapd: Add support for OWE offload for STA/AP interface The driver advertising OWE offload support would take care of Diffie-Hellman Parameter element generation and processing part. The driver would be responsible for OWE PMK generation in this case. Avoid the Diffie-Hellman Parameter element handling in wpa_supplicant/hostapd for drivers advertising OWE offload support. This change is applicable only for drivers supporting 4-way handshake offload. Signed-off-by: Vinayak Yadawad --- src/ap/drv_callbacks.c | 4 ++++ src/drivers/driver.h | 4 ++++ src/drivers/driver_nl80211_capa.c | 8 ++++++++ wpa_supplicant/events.c | 1 + wpa_supplicant/wpa_supplicant.c | 3 ++- 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index be76ec2b1..e58cb9f52 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -260,6 +260,9 @@ int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr, u16 reason = WLAN_REASON_UNSPECIFIED; int status = WLAN_STATUS_SUCCESS; const u8 *p2p_dev_addr = NULL; +#ifdef CONFIG_OWE + struct hostapd_iface *iface = hapd->iface; +#endif /* CONFIG_OWE */ if (addr == NULL) { /* @@ -772,6 +775,7 @@ skip_wpa_check: #ifdef CONFIG_OWE if ((hapd->conf->wpa_key_mgmt & WPA_KEY_MGMT_OWE) && + !(iface->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP) && wpa_auth_sta_key_mgmt(sta->wpa_sm) == WPA_KEY_MGMT_OWE && elems.owe_dh) { u8 *npos; diff --git a/src/drivers/driver.h b/src/drivers/driver.h index f0e690d01..d75cf100e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2296,6 +2296,10 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS2_SAE_OFFLOAD_STA 0x0000000000010000ULL /** Driver support AP_PSK authentication offload */ #define WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK 0x0000000000020000ULL +/** Driver supports OWE STA offload */ +#define WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA 0x0000000000040000ULL +/** Driver supports OWE AP offload */ +#define WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP 0x0000000000080000ULL u64 flags2; #define FULL_AP_CLIENT_STATE_SUPP(drv_flags) \ diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c index 2e7ce5dc8..aa5c33fc7 100644 --- a/src/drivers/driver_nl80211_capa.c +++ b/src/drivers/driver_nl80211_capa.c @@ -709,6 +709,14 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info, if (ext_feature_isset(ext_features, len, NL80211_EXT_FEATURE_4WAY_HANDSHAKE_AP_PSK)) capa->flags2 |= WPA_DRIVER_FLAGS2_4WAY_HANDSHAKE_AP_PSK; + + if (ext_feature_isset(ext_features, len, + NL80211_EXT_FEATURE_OWE_OFFLOAD)) + capa->flags2 |= WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA; + + if (ext_feature_isset(ext_features, len, + NL80211_EXT_FEATURE_OWE_OFFLOAD_AP)) + capa->flags2 |= WPA_DRIVER_FLAGS2_OWE_OFFLOAD_AP; } diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 2e0570f32..0e5b6c6a8 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3376,6 +3376,7 @@ static int wpa_supplicant_event_associnfo(struct wpa_supplicant *wpa_s, #ifdef CONFIG_OWE if (wpa_s->key_mgmt == WPA_KEY_MGMT_OWE && + !(wpa_s->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA) && (!bssid_known || owe_process_assoc_resp(wpa_s->wpa, wpa_s->valid_links ? diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 972f54fcb..a292f05da 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3616,7 +3616,8 @@ static u8 * wpas_populate_assoc_ies( } else #endif /* CONFIG_TESTING_OPTIONS */ if (algs == WPA_AUTH_ALG_OPEN && - ssid->key_mgmt == WPA_KEY_MGMT_OWE) { + ssid->key_mgmt == WPA_KEY_MGMT_OWE && + !(wpa_s->drv_flags & WPA_DRIVER_FLAGS2_OWE_OFFLOAD_STA)) { struct wpabuf *owe_ie; u16 group;