[PATCH 41/55] FT: Support PQC AKM in FT initial mobility domain association
Ilan Peer
ilan.peer at intel.com
Thu Dec 3 02:44:40 PST 2026
With AKM 00-0F-AC:32 and IEEE 802.1X authentication over
authentication frames, XXKey is the first Q bits of the MSK and the PTK
is derived using the PQC PTK derivation with the PMK-R1 as the input
keying material. Align the code accordingly.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/ap/ieee802_11.c | 41 +++++++++++++++++++++++++++++++++++++++--
src/ap/wpa_auth.h | 1 +
src/ap/wpa_auth_ft.c | 26 +++++++++++++++++++++-----
src/common/wpa_common.h | 7 +++++++
src/rsn_supp/wpa.h | 1 +
src/rsn_supp/wpa_ft.c | 24 ++++++++++++++++++++----
wpa_supplicant/sme.c | 29 +++++++++++++++++++++++++++--
7 files changed, 116 insertions(+), 13 deletions(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index d3e35bc11103..ab4e45f9d5c9 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -3694,6 +3694,42 @@ static int ieee80211_802_1x_derive_ptk(struct hostapd_data *hapd,
dhss_len = wpabuf_len(sta->eap_auth_data.dhss);
}
+#ifdef CONFIG_IEEE80211R_AP
+ if (sta->eap_auth_data.ft) {
+ struct wpa_ft_pqc_params pqc;
+
+ pqc.hash = sta->eap_auth_data.pqc_profile->hash;
+ pqc.ml_kem_ss =
+ wpabuf_head_u8(sta->eap_auth_data.ml_kem_ss);
+ pqc.transcript = t;
+ pqc.transcript_len = t_len;
+ if (!sta->wpa_sm)
+ sta->wpa_sm = wpa_auth_sta_init(hapd->wpa_auth,
+ sta->addr,
+ NULL);
+ if (!sta->wpa_sm ||
+ wpa_auth_802_1x_ft_pmk_to_ptk(
+ sta->wpa_sm, pmk,
+ sta->eap_auth_data.pmk_len,
+ sta->eap_auth_data.snonce,
+ sta->eap_auth_data.anonce,
+ sta->eap_auth_data.akm,
+ sta->eap_auth_data.cipher,
+ sta->eap_auth_data.rsnxe,
+ sta->eap_auth_data.rsnxe_len,
+ dhss, dhss_len, &pqc,
+ &sta->eap_auth_data.ptk, kdk_len)) {
+ wpa_printf(MSG_INFO,
+ "FT: Failed to derive the PQC PTK");
+ return -1;
+ }
+
+ wpabuf_clear_free(sta->eap_auth_data.ml_kem_ss);
+ sta->eap_auth_data.ml_kem_ss = NULL;
+ goto ptk_done;
+ }
+#endif /* CONFIG_IEEE80211R_AP */
+
if (pqc_pmk_to_ptk(pmk, sta->eap_auth_data.pmk_len,
sta->addr, aa,
sta->eap_auth_data.pqc_profile->hash,
@@ -3729,7 +3765,7 @@ static int ieee80211_802_1x_derive_ptk(struct hostapd_data *hapd,
sta->eap_auth_data.rsnxe,
sta->eap_auth_data.rsnxe_len,
wpabuf_head_u8(sta->eap_auth_data.dhss),
- wpabuf_len(sta->eap_auth_data.dhss),
+ wpabuf_len(sta->eap_auth_data.dhss), NULL,
&sta->eap_auth_data.ptk, kdk_len)) {
wpa_printf(MSG_INFO, "FT: Failed to derive the PTK");
return -1;
@@ -3880,7 +3916,8 @@ void ieee80211_send_eap_req(struct hostapd_data *hapd, struct sta_info *sta,
#ifdef CONFIG_IEEE80211R_AP
/* XXKey is the second 256 bits of the MSK for FT-EAP */
if (sta->eap_auth_data.ft &&
- !wpa_key_mgmt_sha384(sta->eap_auth_data.akm)) {
+ !wpa_key_mgmt_sha384(sta->eap_auth_data.akm) &&
+ !wpa_key_mgmt_pqc(sta->eap_auth_data.akm)) {
if (_len < 2 * PMK_LEN) {
wpa_printf(MSG_INFO,
"FT: MSK too short (%zu) for XXKey",
diff --git a/src/ap/wpa_auth.h b/src/ap/wpa_auth.h
index 0091cfb453fc..55c2a8950722 100644
--- a/src/ap/wpa_auth.h
+++ b/src/ap/wpa_auth.h
@@ -792,6 +792,7 @@ int wpa_auth_802_1x_ft_pmk_to_ptk(struct wpa_state_machine *sm,
int akmp, int cipher,
const u8 *rsnxe, size_t rsnxe_len,
const u8 *dhss, size_t dhss_len,
+ const struct wpa_ft_pqc_params *pqc,
struct wpa_ptk *ptk, size_t kdk_len);
struct ieee802_11_elems;
u16 wpa_auth_802_1x_ft_check_assoc(struct wpa_state_machine *sm,
diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index 9b23057186d9..c028236fb660 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -2663,13 +2663,14 @@ int wpa_auth_802_1x_ft_pmk_to_ptk(struct wpa_state_machine *sm,
int akmp, int cipher,
const u8 *rsnxe, size_t rsnxe_len,
const u8 *dhss, size_t dhss_len,
+ const struct wpa_ft_pqc_params *pqc,
struct wpa_ptk *ptk, size_t kdk_len)
{
struct wpa_auth_config *conf = &sm->wpa_auth->conf;
u8 pmk_r0[PMK_LEN_MAX], pmk_r0_name[WPA_PMK_NAME_LEN];
u8 pmk_r1[PMK_LEN_MAX], ptk_name[WPA_PMK_NAME_LEN];
size_t key_len;
- int ret = -1;
+ int res = -1, ret = -1;
if (xxkey_len > sizeof(sm->xxkey))
return -1;
@@ -2711,10 +2712,25 @@ int wpa_auth_802_1x_ft_pmk_to_ptk(struct wpa_state_machine *sm,
sm->pmk_r1_name_valid = 1;
- if (wpa_pmk_r1_to_ptk(pmk_r1, key_len, snonce, anonce, sm->addr,
- sm->wpa_auth->addr, sm->pmk_r1_name,
- dhss, dhss_len, ptk, ptk_name, akmp, cipher,
- kdk_len) < 0)
+#ifdef CONFIG_PQC
+ /*
+ * IKM is the PMK-R1 when FT is used (see section 12.17.3 of Draft
+ * IEEE P802.11bt/D1.1)
+ */
+ if (pqc)
+ res = pqc_pmk_to_ptk(pmk_r1, key_len, sm->addr,
+ sm->wpa_auth->addr, pqc->hash, cipher,
+ dhss, dhss_len, pqc->ml_kem_ss,
+ pqc->transcript, pqc->transcript_len,
+ ptk, kdk_len);
+#endif /* CONFIG_PQC */
+
+ if (!pqc)
+ res = wpa_pmk_r1_to_ptk(pmk_r1, key_len, snonce, anonce,
+ sm->addr, sm->wpa_auth->addr,
+ sm->pmk_r1_name, dhss, dhss_len, ptk,
+ ptk_name, akmp, cipher, kdk_len);
+ if (res < 0)
goto out;
wpa_auth_ft_store_keys(sm, pmk_r0, pmk_r1, pmk_r0_name, key_len);
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 8292761ec568..7a82db952bb3 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -832,6 +832,13 @@ int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
size_t pasn_mic_len(enum rsn_hash_alg alg);
size_t wpa_hash_len(enum rsn_hash_alg hash);
+
+struct wpa_ft_pqc_params {
+ enum rsn_hash_alg hash;
+ const u8 *ml_kem_ss;
+ const u8 *transcript;
+ size_t transcript_len;
+};
int pqc_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const u8 *spa, const u8 *aa,
enum rsn_hash_alg hash, int cipher,
const u8 *dhss, size_t dhss_len, const u8 *ml_kem_ss,
diff --git a/src/rsn_supp/wpa.h b/src/rsn_supp/wpa.h
index 33eab0286596..92f9c8f7a063 100644
--- a/src/rsn_supp/wpa.h
+++ b/src/rsn_supp/wpa.h
@@ -613,6 +613,7 @@ int wpa_sm_802_1x_ft_pmk_to_ptk(struct wpa_sm *sm, const u8 *xxkey,
const u8 *anonce, const u8 *aa,
int akmp, int cipher,
const u8 *dhss, size_t dhss_len,
+ const struct wpa_ft_pqc_params *pqc,
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);
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index 427a9d0fca31..34f650e846c2 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -191,9 +191,11 @@ int wpa_sm_802_1x_ft_pmk_to_ptk(struct wpa_sm *sm, const u8 *xxkey,
const u8 *anonce, const u8 *aa,
int akmp, int cipher,
const u8 *dhss, size_t dhss_len,
+ const struct wpa_ft_pqc_params *pqc,
struct wpa_ptk *ptk, size_t kdk_len)
{
u8 ptk_name[WPA_PMK_NAME_LEN];
+ int res = -1;
if (xxkey_len > sizeof(sm->xxkey))
return -1;
@@ -223,10 +225,24 @@ int wpa_sm_802_1x_ft_pmk_to_ptk(struct wpa_sm *sm, const u8 *xxkey,
wpa_ft_set_r1_name(sm, sm->r1kh_id, sm->pmk_r1_name);
#endif /* CONFIG_PMKSA_PRIVACY */
- 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)
+#ifdef CONFIG_PQC
+ /*
+ * IKM is the PMK-R1 when FT is used (see section 12.17.3 of Draft
+ * IEEE P802.11bt/D1.1)
+ */
+ if (pqc)
+ res = pqc_pmk_to_ptk(sm->pmk_r1, sm->pmk_r1_len, sm->own_addr,
+ aa, pqc->hash, cipher, dhss, dhss_len,
+ pqc->ml_kem_ss, pqc->transcript,
+ pqc->transcript_len, ptk, kdk_len);
+#endif /* CONFIG_PQC */
+
+ if (!pqc)
+ res = 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);
+ if (res < 0)
return -1;
os_memcpy(sm->snonce, snonce, WPA_NONCE_LEN);
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index 08e42990100f..4caa7631977d 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -182,7 +182,7 @@ static int sme_get_pmk_for_1x_auth(struct wpa_supplicant *wpa_s,
#ifdef CONFIG_IEEE80211R
/* XXKey is the second 256 bits of the MSK for FT-EAP */
if (wpa_s->auth_1x && wpa_s->auth_1x->ft &&
- !wpa_key_mgmt_sha384(key_mgmt)) {
+ !wpa_key_mgmt_sha384(key_mgmt) && !wpa_key_mgmt_pqc(key_mgmt)) {
u8 msk[2 * PMK_LEN];
res = eapol_sm_get_key(wpa_s->eapol, msk, sizeof(msk));
@@ -4961,6 +4961,31 @@ static int sme_802_1x_derive_ptk_and_install(
dhss_len = wpabuf_len(auth_1x->dhss);
}
+#ifdef CONFIG_IEEE80211R
+ if (auth_1x->ft) {
+ struct wpa_ft_pqc_params pqc;
+
+ pqc.hash = auth_1x->pqc_profile->hash;
+ pqc.ml_kem_ss = wpabuf_head(auth_1x->ml_kem_ss);
+ pqc.transcript = t;
+ pqc.transcript_len = t_len;
+ if (wpa_sm_802_1x_ft_pmk_to_ptk(
+ wpa_s->wpa, pmk, pmk_len, auth_1x->snonce,
+ auth_1x->anonce, peer_addr, key_mgmt,
+ pairwise_cipher, dhss, dhss_len, &pqc,
+ &ptk, kdk_len) < 0) {
+ wpa_msg(wpa_s, MSG_INFO,
+ "FT: PQC PTK derivation failed");
+ forced_memzero(pmk, PMK_LEN_MAX);
+ return -1;
+ }
+
+ wpabuf_clear_free(auth_1x->ml_kem_ss);
+ auth_1x->ml_kem_ss = NULL;
+ goto ptk_derived;
+ }
+#endif /* CONFIG_IEEE80211R */
+
if (pqc_pmk_to_ptk(pmk, pmk_len, wpa_s->own_addr, peer_addr,
auth_1x->pqc_profile->hash, pairwise_cipher,
dhss, dhss_len,
@@ -4988,7 +5013,7 @@ static int sme_802_1x_derive_ptk_and_install(
pairwise_cipher,
wpabuf_head(auth_1x->dhss),
wpabuf_len(auth_1x->dhss),
- &ptk, kdk_len) < 0) {
+ NULL, &ptk, kdk_len) < 0) {
wpa_msg(wpa_s, MSG_INFO, "FT: PTK derivation failed");
forced_memzero(pmk, PMK_LEN_MAX);
--
2.55.0
More information about the Hostap
mailing list