[PATCH 50/55] RSN: Make the PQC two message transcript hash generic

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


The transcript of the FT protocol with the PQC AKM and of a PTK rekey
with the PQC AKMs is computed the same way: a hash over two messages
with the MIC field of the second one set to 0.

Rename wpa_ft_pqc_transcript() to pqc_transcript_2msg() and make it
available for both cases.

Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
 src/ap/wpa_auth_ft.c    | 10 +++++-----
 src/common/wpa_common.c | 29 +++++++++++++----------------
 src/common/wpa_common.h | 10 +++++-----
 src/rsn_supp/wpa_ft.c   | 12 ++++++------
 4 files changed, 29 insertions(+), 32 deletions(-)

diff --git a/src/ap/wpa_auth_ft.c b/src/ap/wpa_auth_ft.c
index bc15d6890c7b..0b016ef1515d 100644
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -4586,11 +4586,11 @@ int wpa_ft_msg2_set_mic(struct wpa_state_machine *sm, u8 *body,
 		    !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);
+		res = pqc_transcript_2msg(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,
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 8d54beae4b50..16899b10ad2e 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1963,26 +1963,24 @@ size_t wpa_hash_len(enum rsn_hash_alg hash)
 
 #ifdef CONFIG_PQC
 
-#ifdef CONFIG_IEEE80211R
-
 /**
- * wpa_ft_pqc_transcript - Transcript hash of the FT protocol with PQC
+ * pqc_transcript_2msg - Transcript hash of a two message exchange
  * @hash: Hash algorithm of the PQC profile
- * @msg1: Frame body of the first FT message (from Authentication Algorithm)
+ * @msg1: First message
  * @msg1_len: Length of @msg1
- * @msg2: Frame body of the second FT message (from Authentication Algorithm)
+ * @msg2: Second message
  * @msg2_len: Length of @msg2
- * @msg2_mic_offset: Offset of the FTE MIC field in @msg2
- * @mic_len: Length of the FTE MIC field in @msg2
+ * @msg2_mic_offset: Offset of the MIC field in @msg2
+ * @mic_len: Length of the MIC field in @msg2
  * @t: Buffer for the transcript hash
  * @t_len: Buffer size on input; transcript hash length on output
  * Returns: 0 on success, -1 on failure
  */
-int wpa_ft_pqc_transcript(enum rsn_hash_alg hash,
-			  const u8 *msg1, size_t msg1_len,
-			  const u8 *msg2, size_t msg2_len,
-			  size_t msg2_mic_offset, size_t mic_len,
-			  u8 *t, size_t *t_len)
+int pqc_transcript_2msg(enum rsn_hash_alg hash,
+			const u8 *msg1, size_t msg1_len,
+			const u8 *msg2, size_t msg2_len,
+			size_t msg2_mic_offset, size_t mic_len,
+			u8 *t, size_t *t_len)
 {
 	struct crypto_hash *ctx;
 	enum crypto_hash_alg alg;
@@ -2010,9 +2008,9 @@ int wpa_ft_pqc_transcript(enum rsn_hash_alg hash,
 		return -1;
 
 	/*
-	 * The transcript covers both FT authentication algorithm frames with
-	 * the MIC field of the FTE set to 0.
-	 * See Section 12.17.4 in Draft IEEE P802.11bt/D1.1.
+	 * Each message is preceded by its length as a 4-octet little endian
+	 * value, and the MIC field of the second message is set to 0 (see
+	 * Section 12.17.4 in Draft IEEE P802.11bt/D1.1).
 	 */
 	WPA_PUT_LE32(len, msg1_len);
 	crypto_hash_update(ctx, len, sizeof(len));
@@ -2028,7 +2026,6 @@ int wpa_ft_pqc_transcript(enum rsn_hash_alg hash,
 
 	return crypto_hash_finish(ctx, t, t_len) ? -1 : 0;
 }
-#endif /* CONFIG_IEEE80211R */
 
 
 /**
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 00f98c03d9f2..7c12edcbff76 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -843,11 +843,11 @@ struct wpa_ft_pqc_params {
 	size_t transcript_len;
 };
 
-int wpa_ft_pqc_transcript(enum rsn_hash_alg hash,
-			  const u8 *msg1, size_t msg1_len,
-			  const u8 *msg2, size_t msg2_len,
-			  size_t msg2_mic_offset, size_t mic_len,
-			  u8 *t, size_t *t_len);
+int pqc_transcript_2msg(enum rsn_hash_alg hash,
+			const u8 *msg1, size_t msg1_len,
+			const u8 *msg2, size_t msg2_len,
+			size_t msg2_mic_offset, size_t mic_len,
+			u8 *t, size_t *t_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,
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index 6948d0019f71..dd9fe2ead25f 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -1353,12 +1353,12 @@ int wpa_ft_process_response(struct wpa_sm *sm, const u8 *ies, size_t ies_len,
 
 		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_transcript_2msg(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,
-- 
2.55.0




More information about the Hostap mailing list