From d0d585c481157c5456c36edaf8991279cb924125 Mon Sep 17 00:00:00 2001 From: Vinay Gannevaram Date: Sun, 20 Mar 2022 19:26:02 +0530 Subject: [PATCH] Store secure ranging driver capabilities in WPA state machine Signed-off-by: Jouni Malinen --- src/rsn_supp/wpa.c | 13 +++++++++++++ src/rsn_supp/wpa.h | 1 + wpa_supplicant/wpa_supplicant.c | 3 +++ 3 files changed, 17 insertions(+) diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c index cf9b21039..3e39947a5 100644 --- a/src/rsn_supp/wpa.c +++ b/src/rsn_supp/wpa.c @@ -5281,6 +5281,7 @@ void wpa_sm_set_dpp_z(struct wpa_sm *sm, const struct wpabuf *z) #ifdef CONFIG_PASN + void wpa_pasn_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len, const u8 *pmkid, const u8 *bssid, int key_mgmt) { @@ -5288,6 +5289,18 @@ void wpa_pasn_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len, bssid, sm->own_addr, NULL, key_mgmt, 0); } + + +void wpa_pasn_sm_set_caps(struct wpa_sm *sm, unsigned int flags2) +{ + if (flags2 & WPA_DRIVER_FLAGS2_SEC_LTF_STA) + sm->secure_ltf = 1; + if (flags2 & WPA_DRIVER_FLAGS2_SEC_RTT_STA) + sm->secure_rtt = 1; + if (flags2 & WPA_DRIVER_FLAGS2_PROT_RANGE_NEG_STA) + sm->prot_range_neg = 1; +} + #endif /* CONFIG_PASN */ diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h index be70f4156..df32240c6 100644 --- a/src/rsn_supp/wpa.h +++ b/src/rsn_supp/wpa.h @@ -562,5 +562,6 @@ void wpa_sm_set_fils_cache_id(struct wpa_sm *sm, const u8 *fils_cache_id); void wpa_sm_set_dpp_z(struct wpa_sm *sm, const struct wpabuf *z); void wpa_pasn_pmksa_cache_add(struct wpa_sm *sm, const u8 *pmk, size_t pmk_len, const u8 *pmkid, const u8 *bssid, int key_mgmt); +void wpa_pasn_sm_set_caps(struct wpa_sm *sm, unsigned int flags2); #endif /* WPA_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 09ba7cda9..deb51a721 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -6900,6 +6900,9 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->extended_capa[2] & 0x40) wpa_s->multi_bss_support = 1; } +#ifdef CONFIG_PASN + wpa_pasn_sm_set_caps(wpa_s->wpa, wpa_s->drv_flags2); +#endif /* CONFIG_PASN */ if (wpa_s->max_remain_on_chan == 0) wpa_s->max_remain_on_chan = 1000;