[PATCH 11/55] RSN: Add FT key hierarchy derivation for IEEE 802.1X authentication

Ilan Peer ilan.peer at intel.com
Thu Dec 3 02:44:10 PST 2026


With FT initial mobility domain association over IEEE 802.1X
authentication, the PMK-R0 and PMK-R1 are derived from XXKey and the
PTK is derived from the PMK-R1 with DHss.

Add a function for this derivation that keeps the FT key hierarchy for
the next transition, and accessors for the PMKR1Name and the FT
elements.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/rsn_supp/wpa.h    |  8 ++++++
 src/rsn_supp/wpa_ft.c | 57 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)

diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 67319f84284d..572daa2d977d 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -604,6 +604,14 @@ const u8 * wpa_sm_get_ft_md(struct wpa_sm *sm);
 int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
 			    int ft_action, const u8 *target_ap,
 			    const u8 *ric_ies, size_t ric_ies_len);
+int wpa_sm_802_1x_ft_pmk_to_ptk(struct wpa_sm *sm, const u8 *xxkey,
+				size_t xxkey_len, const u8 *snonce,
+				const u8 *anonce, const u8 *aa,
+				int akmp, int cipher,
+				const u8 *dhss, size_t dhss_len,
+				struct wpa_ptk *ptk, size_t kdk_len);
+const u8 * wpa_sm_get_pmk_r1_name(struct wpa_sm *sm);
+const u8 * wpa_sm_get_ft_ies(struct wpa_sm *sm, size_t *len);
 int wpa_ft_is_completed(struct wpa_sm *sm);
 void wpa_reset_ft_completed(struct wpa_sm *sm);
 int wpa_ft_validate_reassoc_resp(struct wpa_sm *sm, const u8 *ies,
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index b684939aeb29..8b6956bdc0f0 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -101,6 +101,63 @@ int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
 	return ret;
 }
 
+#ifdef CONFIG_IEEE8021X_AUTH
+
+int wpa_sm_802_1x_ft_pmk_to_ptk(struct wpa_sm *sm, const u8 *xxkey,
+				size_t xxkey_len, const u8 *snonce,
+				const u8 *anonce, const u8 *aa,
+				int akmp, int cipher,
+				const u8 *dhss, size_t dhss_len,
+				struct wpa_ptk *ptk, size_t kdk_len)
+{
+	u8 ptk_name[WPA_PMK_NAME_LEN];
+
+	if (xxkey_len > sizeof(sm->xxkey))
+		return -1;
+
+	os_memcpy(sm->xxkey, xxkey, xxkey_len);
+	sm->xxkey_len = xxkey_len;
+	sm->pmk_r0_len = wpa_key_mgmt_sha384(akmp) ? SHA384_MAC_LEN : PMK_LEN;
+	if (wpa_derive_pmk_r0(xxkey, xxkey_len, sm->ssid, sm->ssid_len,
+			      sm->mobility_domain, sm->r0kh_id,
+			      sm->r0kh_id_len, sm->own_addr,
+			      sm->pmk_r0, sm->pmk_r0_name, akmp) < 0)
+		return -1;
+
+	sm->pmk_r1_len = sm->pmk_r0_len;
+	if (wpa_derive_pmk_r1(sm->pmk_r0, sm->pmk_r0_len, sm->pmk_r0_name,
+			      sm->r1kh_id, sm->own_addr, sm->pmk_r1,
+			      sm->pmk_r1_name) < 0)
+		return -1;
+
+	if (wpa_pmk_r1_to_ptk(sm->pmk_r1, sm->pmk_r1_len, snonce, anonce,
+			      sm->own_addr, aa, sm->pmk_r1_name,
+			      dhss, dhss_len, ptk, ptk_name, akmp, cipher,
+			      kdk_len) < 0)
+		return -1;
+
+	os_memcpy(sm->snonce, snonce, WPA_NONCE_LEN);
+	os_memcpy(sm->anonce, anonce, WPA_NONCE_LEN);
+	os_memcpy(sm->key_mobility_domain, sm->mobility_domain,
+		  MOBILITY_DOMAIN_ID_LEN);
+
+	return 0;
+}
+
+
+const u8 * wpa_sm_get_pmk_r1_name(struct wpa_sm *sm)
+{
+	return sm->pmk_r1_name;
+}
+
+
+const u8 * wpa_sm_get_ft_ies(struct wpa_sm *sm, size_t *len)
+{
+	*len = sm->assoc_resp_ies_len;
+	return sm->assoc_resp_ies;
+}
+
+#endif /* CONFIG_IEEE8021X_AUTH */
 
 /**
  * wpa_sm_set_ft_params - Set FT (IEEE 802.11r) parameters
-- 
2.55.0




More information about the Hostap mailing list