[PATCH 45/55] AP: Support the PQC AKM in the FT protocol

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


With AKM 00-0F-AC:32, the PTK is derived from the PMK-R1, the shared
secrets and the transcript of both FT protocol messages (see Section
12.16.8.2 in Draft IEEE P802.11bt/D1.1).

Derive the PTK when the second message is sent, and reject a PQC
profile whose hash does not match the PMK-R1 length.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/ap/wpa_auth_ft.c | 108 +++++++++++++++++++++++++++++++++++++------
 1 file changed, 93 insertions(+), 15 deletions(-)

diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index 3323d3386878..bc15d6890c7b 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -4079,6 +4079,7 @@ static int wpa_ft_process_auth_req(struct wpa_state_machine *sm,
 	int retval = WLAN_STATUS_UNSPECIFIED_FAILURE;
 	const u8 *dhss = NULL;
 	size_t dhss_len = 0;
+	bool defer_ptk = false;
 #ifdef CONFIG_ENC_ASSOC
 	struct crypto_ecdh *ecdh = NULL;
 	struct wpabuf *dhss_buf = NULL;
@@ -4316,6 +4317,18 @@ pmk_r1_derived:
 		goto out;
 	}
 
+#ifdef CONFIG_PQC
+	/* PMK-R1 length is the profile hash */
+	if (sm->ft_pqc_profile &&
+	    wpa_hash_len(sm->ft_pqc_profile->hash) != sm->pmk_r1_len) {
+		wpa_printf(MSG_DEBUG,
+			   "FT: PQC security profile %u does not match the PMK-R1 length %u",
+			   sm->ft_pqc_profile->number, sm->pmk_r1_len);
+		retval = WLAN_STATUS_REJECTED_INVALID_SECURITY_PROFILE;
+		goto out;
+	}
+#endif /* CONFIG_PQC */
+
 	if (sm->pmk_r1_len == SHA512_MAC_LEN)
 		sm->hash_alg = RSN_HASH_SHA512;
 	else if (sm->pmk_r1_len == SHA384_MAC_LEN)
@@ -4378,25 +4391,51 @@ pmk_r1_derived:
 	else
 		kdk_len = 0;
 
-	if (wpa_pmk_r1_to_ptk(pmk_r1, pmk_r1_len, sm->SNonce, sm->ANonce,
-			      sm->addr, sm->wpa_auth->addr, pmk_r1_name,
-			      dhss, dhss_len, &sm->PTK, ptk_name,
-			      parse.key_mgmt, pairwise, kdk_len) < 0)
-		goto out;
+#ifdef CONFIG_PQC
+	/*
+	 * The transcript includes the second message, so derive the PTK when
+	 * it is sent.
+	 */
+	if (sm->ft_pqc_profile) {
+		sm->ft_kdk_len = kdk_len;
+		sm->pairwise = pairwise;
+		sm->ft_msg1 = wpabuf_alloc(6 + ies_len);
+		if (!sm->ft_msg1)
+			goto out;
 
-#ifdef CONFIG_PASN
-	if (sm->wpa_auth->conf.secure_ltf &&
-	    ieee802_11_rsnx_capab(sm->rsnxe, WLAN_RSNX_CAPAB_SECURE_LTF) &&
-	    wpa_ltf_keyseed(&sm->PTK, parse.key_mgmt, pairwise)) {
-		wpa_printf(MSG_DEBUG, "FT: Failed to derive LTF keyseed");
-		goto out;
+		wpabuf_put_le16(sm->ft_msg1, WLAN_AUTH_FT);
+		wpabuf_put_le16(sm->ft_msg1, 1);
+		wpabuf_put_le16(sm->ft_msg1, WLAN_STATUS_SUCCESS);
+		wpabuf_put_data(sm->ft_msg1, ies, ies_len);
+
+		defer_ptk = true;
 	}
+#endif /* CONFIG_PQC */
+
+	if (!defer_ptk) {
+		if (wpa_pmk_r1_to_ptk(pmk_r1, pmk_r1_len, sm->SNonce,
+				      sm->ANonce, sm->addr, sm->wpa_auth->addr,
+				      pmk_r1_name, dhss, dhss_len, &sm->PTK,
+				      ptk_name, parse.key_mgmt, pairwise,
+				      kdk_len) < 0)
+			goto out;
+
+#ifdef CONFIG_PASN
+		if (sm->wpa_auth->conf.secure_ltf &&
+		    ieee802_11_rsnx_capab(sm->rsnxe,
+					  WLAN_RSNX_CAPAB_SECURE_LTF) &&
+		    wpa_ltf_keyseed(&sm->PTK, parse.key_mgmt, pairwise)) {
+			wpa_printf(MSG_DEBUG,
+				   "FT: Failed to derive LTF keyseed");
+			goto out;
+		}
 #endif /* CONFIG_PASN */
 
-	sm->pairwise = pairwise;
-	sm->PTK_valid = true;
-	sm->tk_already_set = false;
-	wpa_ft_install_ptk(sm, 0);
+		sm->pairwise = pairwise;
+		sm->PTK_valid = true;
+		sm->tk_already_set = false;
+		wpa_ft_install_ptk(sm, 0);
+	}
 
 	if (wpa_ft_set_vlan(sm->wpa_auth, sm->addr, &vlan) < 0) {
 		wpa_printf(MSG_DEBUG, "FT: Failed to configure VLAN");
@@ -4535,6 +4574,45 @@ int wpa_ft_msg2_set_mic(struct wpa_state_machine *sm, u8 *body,
 	ies = body + 6;
 	ies_len = body_len - 6;
 	fte = (u8 *)get_ie(ies, ies_len, WLAN_EID_FAST_BSS_TRANSITION);
+
+#ifdef CONFIG_PQC
+	if (sm->ft_pqc_profile) {
+		u8 t[SHA512_MAC_LEN];
+		size_t t_len = sizeof(t), mic_len;
+		int res;
+
+		mic_len = sm->pmk_r1_len / 2;
+		if (!fte || fte[1] < 2 + mic_len || !sm->ft_msg1 ||
+		    !sm->ft_ml_kem_ss)
+			return -1;
+
+		res = wpa_ft_pqc_transcript(sm->ft_pqc_profile->hash,
+					    wpabuf_head(sm->ft_msg1),
+					    wpabuf_len(sm->ft_msg1),
+					    body, body_len, fte + 4 - body,
+					    mic_len, t, &t_len);
+		if (!res)
+			res = pqc_pmk_to_ptk(
+				sm->pmk_r1, sm->pmk_r1_len, sm->addr,
+				wpa_auth->addr, sm->ft_pqc_profile->hash,
+				sm->pairwise,
+				sm->ft_dhss ? wpabuf_head(sm->ft_dhss) : NULL,
+				sm->ft_dhss ? wpabuf_len(sm->ft_dhss) : 0,
+				wpabuf_head(sm->ft_ml_kem_ss), t, t_len,
+				&sm->PTK, sm->ft_kdk_len);
+
+		wpa_ft_pqc_clear(sm);
+		if (res < 0) {
+			wpa_printf(MSG_DEBUG, "FT: PQC PTK derivation failed");
+			return -1;
+		}
+
+		sm->PTK_valid = true;
+		sm->tk_already_set = false;
+		wpa_ft_install_ptk(sm, 0);
+	}
+#endif /* CONFIG_PQC */
+
 	if (!fte || fte[1] < 2 + sm->PTK.kck_len)
 		return -1;
 
-- 
2.55.0




More information about the Hostap mailing list