[PATCH 47/55] wpa_supplicant: Support the PQC AKM in the FT protocol
Ilan Peer
ilan.peer at intel.com
Thu Dec 3 02:44:46 PST 2026
With AKM 00-0F-AC:32, the second FT protocol message includes a PQC
Parameter element, and 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).
Process the PQC Parameter element of the second message and derive the
PTK, and reject a PQC Parameter element in the second message if none
was sent in the first.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/rsn_supp/wpa_ft.c | 135 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 132 insertions(+), 3 deletions(-)
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index 466d194d0dac..6948d0019f71 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -1031,6 +1031,15 @@ static int wpa_ft_process_dh(struct wpa_sm *sm, const u8 *ies,
if (ieee802_11_parse_elems(ies, ies_len, &elems, 0) == ParseFailed)
return -1;
+ /*
+ * No PQC Parameter element was sent in the first message, so the AP
+ * must not include one in the second message.
+ */
+ if (elems.pqc_parameter) {
+ wpa_printf(MSG_DEBUG, "FT: Unexpected PQC Parameter element");
+ return -1;
+ }
+
if (!sm->ft_enc_assoc) {
if (elems.owe_dh) {
wpa_printf(MSG_DEBUG,
@@ -1065,6 +1074,84 @@ static int wpa_ft_process_dh(struct wpa_sm *sm, const u8 *ies,
}
+static int wpa_ft_process_pqc(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
+ struct wpabuf **dhss, struct wpabuf **ml_kem_ss)
+{
+#ifdef CONFIG_PQC
+ const struct element *elem, *pqc = NULL;
+ const u8 *pos, *end;
+ u8 content;
+
+ /*
+ * The second message includes a single PQC Parameter element (see
+ * Section 12.16.8.2 in Draft IEEE P802.11bt/D1.1).
+ */
+ for_each_element_id(elem, WLAN_EID_EXT_LENGTH, ies, ies_len) {
+ if (le_to_host16(((const struct ext_len_element *)
+ elem)->ext_id) !=
+ WLAN_EID_EXT_LEN_PQC_PARAMETER)
+ continue;
+
+ if (pqc) {
+ wpa_printf(MSG_DEBUG,
+ "FT: More than one PQC Parameter element");
+ return -1;
+ }
+
+ pqc = elem;
+ }
+
+ if (!pqc || element_datalen(pqc) < 2) {
+ wpa_printf(MSG_DEBUG, "FT: Missing PQC Parameter element");
+ return -1;
+ }
+
+ pos = element_data(pqc);
+ end = pos + element_datalen(pqc);
+ if (*pos++ != sm->security_profile->number) {
+ wpa_printf(MSG_DEBUG, "FT: PQC security profile mismatch");
+ return -1;
+ }
+
+ content = *pos++;
+ if (content != (sm->ft_ecdh ? PQC_CONTENT_PK_PARAM_AND_ML_KEM_CT :
+ PQC_CONTENT_ML_KEM_CT)) {
+ wpa_printf(MSG_DEBUG, "FT: Unexpected PQC content %u", content);
+ return -1;
+ }
+
+ if (sm->ft_ecdh) {
+ size_t pub_len = crypto_ecdh_prime_len(sm->ft_ecdh);
+
+ if ((size_t) (end - pos) < pub_len) {
+ wpa_printf(MSG_DEBUG,
+ "FT: Too short DH public key in PQC Parameter element");
+ return -1;
+ }
+
+ *dhss = crypto_ecdh_set_peerkey(sm->ft_ecdh, 0, pos, pub_len);
+ if (!*dhss) {
+ wpa_printf(MSG_DEBUG, "FT: Invalid DH public key");
+ return -1;
+ }
+
+ pos += pub_len;
+ }
+
+ if (pos == end ||
+ crypto_ml_kem_decapsulate(sm->ft_ml_kem, pos, end - pos,
+ ml_kem_ss) < 0) {
+ wpa_printf(MSG_DEBUG, "FT: ML-KEM decapsulation failed");
+ return -1;
+ }
+
+ return 0;
+#else /* CONFIG_PQC */
+ return -1;
+#endif /* CONFIG_PQC */
+}
+
+
static int wpa_ft_check_msg2_mic(struct wpa_sm *sm, const u8 *bssid,
const u8 *frame_body, size_t body_len,
const struct wpa_ft_ies *parse)
@@ -1120,7 +1207,8 @@ int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
const u8 *bssid;
const u8 *kck;
size_t kck_len, kdk_len;
- struct wpabuf *dhss = NULL;
+ struct wpabuf *dhss = NULL, *ml_kem_ss = NULL;
+ bool pqc = false;
os_memset(&parse, 0, sizeof(parse));
@@ -1217,8 +1305,18 @@ int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
if (ft_action)
sm->ft_enc_assoc = false;
- if (wpa_ft_process_dh(sm, ies, ies_len, &dhss) < 0)
+#ifdef CONFIG_PQC
+ pqc = sm->ft_enc_assoc && sm->ft_ml_kem;
+#endif /* CONFIG_PQC */
+
+ if (pqc)
+ res = wpa_ft_process_pqc(sm, ies, ies_len, &dhss, &ml_kem_ss);
+ else
+ res = wpa_ft_process_dh(sm, ies, ies_len, &dhss);
+
+ if (res < 0)
goto fail;
+
#endif /* CONFIG_ENC_ASSOC */
os_memcpy(sm->r1kh_id, parse.r1kh_id, FT_R1KH_ID_LEN);
@@ -1248,8 +1346,35 @@ int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
else
kdk_len = 0;
+#ifdef CONFIG_PQC
+ if (pqc) {
+ u8 t[SHA512_MAC_LEN];
+ size_t t_len = sizeof(t);
+
+ if (!sm->ft_msg1 || !frame_body || !parse.fte_mic ||
+ parse.fte_mic < frame_body ||
+ wpa_ft_pqc_transcript(sm->ft_pqc_profile->hash,
+ wpabuf_head(sm->ft_msg1),
+ wpabuf_len(sm->ft_msg1),
+ frame_body, frame_body_len,
+ parse.fte_mic - frame_body,
+ parse.fte_mic_len, t, &t_len) < 0 ||
+ pqc_pmk_to_ptk(sm->pmk_r1, sm->pmk_r1_len, sm->own_addr,
+ bssid, sm->ft_pqc_profile->hash,
+ sm->pairwise_cipher,
+ dhss ? wpabuf_head(dhss) : NULL,
+ dhss ? wpabuf_len(dhss) : 0,
+ wpabuf_head(ml_kem_ss), t, t_len,
+ &sm->ptk, kdk_len) < 0) {
+ wpa_printf(MSG_DEBUG, "FT: PQC PTK derivation failed");
+ goto fail;
+ }
+ }
+#endif /* CONFIG_PQC */
+
/* TODO: AP MLD address for MLO */
- if (wpa_pmk_r1_to_ptk(sm->pmk_r1, sm->pmk_r1_len, sm->snonce,
+ if (!pqc &&
+ wpa_pmk_r1_to_ptk(sm->pmk_r1, sm->pmk_r1_len, sm->snonce,
parse.fte_anonce, sm->own_addr, bssid,
sm->pmk_r1_name,
dhss ? wpabuf_head(dhss) : NULL,
@@ -1324,9 +1449,13 @@ int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
ret = 0;
fail:
wpabuf_clear_free(dhss);
+ wpabuf_clear_free(ml_kem_ss);
#ifdef CONFIG_ENC_ASSOC
crypto_ecdh_deinit(sm->ft_ecdh);
sm->ft_ecdh = NULL;
+#ifdef CONFIG_PQC
+ wpa_ft_pqc_deinit(sm);
+#endif /* CONFIG_PQC */
if (ret)
sm->ft_enc_assoc = false;
#endif /* CONFIG_ENC_ASSOC */
--
2.55.0
More information about the Hostap
mailing list