[PATCH 26/55] AP: Keep XXKey in the FT PMK-R0 SA
Ilan Peer
ilan.peer at intel.com
Thu Dec 3 02:44:25 PST 2026
With PMKSA caching privacy, the R0KH needs to recompute the PMKR0Name
after each successful FT association, which requires the XXKey key.
Keep the XXKey and the AKM in the PMK-R0 SA when both the AP and the
STA support PMKSA caching privacy.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/ap/wpa_auth_ft.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index 0a6bbfaf68d7..4269e3d365f9 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -1227,6 +1227,12 @@ struct wpa_ft_pmk_r0_sa {
os_time_t session_timeout; /* 0 for no expiration */
/* TODO: radius_class, EAP type */
int pmk_r1_pushed;
+
+#ifdef CONFIG_PMKSA_PRIVACY
+ u8 xxkey[PMK_LEN_MAX];
+ size_t xxkey_len;
+ int key_mgmt;
+#endif /* CONFIG_PMKSA_PRIVACY */
};
struct wpa_ft_pmk_r1_sa {
@@ -1264,6 +1270,9 @@ static void wpa_ft_free_pmk_r0(struct wpa_ft_pmk_r0_sa *r0)
eloop_cancel_timeout(wpa_ft_expire_pmk_r0, r0, NULL);
os_memset(r0->pmk_r0, 0, PMK_LEN_MAX);
+#ifdef CONFIG_PMKSA_PRIVACY
+ os_memset(r0->xxkey, 0, PMK_LEN_MAX);
+#endif /* CONFIG_PMKSA_PRIVACY */
os_free(r0->vlan);
os_free(r0->identity);
os_free(r0->radius_cui);
@@ -1471,7 +1480,9 @@ static int wpa_ft_store_pmk_r0(struct wpa_authenticator *wpa_auth,
const struct vlan_description *vlan,
int expires_in, int session_timeout,
const u8 *identity, size_t identity_len,
- const u8 *radius_cui, size_t radius_cui_len)
+ const u8 *radius_cui, size_t radius_cui_len,
+ const u8 *xxkey, size_t xxkey_len,
+ int key_mgmt)
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
struct wpa_ft_pmk_r0_sa *r0;
@@ -1516,6 +1527,14 @@ static int wpa_ft_store_pmk_r0(struct wpa_authenticator *wpa_auth,
if (session_timeout > 0)
r0->session_timeout = now.sec + session_timeout;
+#ifdef CONFIG_PMKSA_PRIVACY
+ if (xxkey && xxkey_len <= sizeof(r0->xxkey)) {
+ os_memcpy(r0->xxkey, xxkey, xxkey_len);
+ r0->xxkey_len = xxkey_len;
+ r0->key_mgmt = key_mgmt;
+ }
+#endif /* CONFIG_PMKSA_PRIVACY */
+
dl_list_add(&cache->pmk_r0, &r0->list);
if (expires_in > 0)
eloop_register_timeout(expires_in + 1, 0, wpa_ft_expire_pmk_r0,
@@ -2219,7 +2238,7 @@ int wpa_ft_store_pmk_fils(struct wpa_state_machine *sm,
return wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, pmk_r0_len,
pmk_r0_name, sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
- radius_cui, radius_cui_len);
+ radius_cui, radius_cui_len, NULL, 0, 0);
}
@@ -2286,6 +2305,8 @@ void wpa_auth_ft_store_keys(struct wpa_state_machine *sm, const u8 *pmk_r0,
const u8 *identity, *radius_cui;
size_t identity_len, radius_cui_len;
int session_timeout;
+ const u8 *xxkey = NULL;
+ size_t xxkey_len = 0;
if (psk_local && wpa_key_mgmt_ft_psk(sm->wpa_key_mgmt))
return;
@@ -2301,12 +2322,24 @@ void wpa_auth_ft_store_keys(struct wpa_state_machine *sm, const u8 *pmk_r0,
&radius_cui);
session_timeout = wpa_ft_get_session_timeout(sm->wpa_auth, sm->addr);
+#ifdef CONFIG_PMKSA_PRIVACY
+ if (wpa_auth_ap_sta_support_pmkid_privacy(sm)) {
+ if (sm->xxkey_len > 0) {
+ xxkey = sm->xxkey;
+ xxkey_len = sm->xxkey_len;
+ } else if (sm->pmksa) {
+ xxkey = sm->pmksa->pmk;
+ xxkey_len = sm->pmksa->pmk_len;
+ }
+ }
+#endif /* CONFIG_PMKSA_PRIVACY */
wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, key_len,
pmk_r0_name,
sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
- radius_cui, radius_cui_len);
+ radius_cui, radius_cui_len, xxkey, xxkey_len,
+ sm->wpa_key_mgmt);
wpa_ft_store_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1, key_len,
sm->pmk_r1_name, sm->pairwise, &vlan,
expires_in, session_timeout, identity,
--
2.55.0
More information about the Hostap
mailing list