[PATCH 42/55] FT: Add transcript hash for the FT protocol with the PQC AKM
Ilan Peer
ilan.peer at intel.com
Thu Dec 3 02:44:41 PST 2026
The transcript covers the first and the second FT protocol messages with
the MIC field of the FTE set to 0.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/common/wpa_common.c | 69 +++++++++++++++++++++++++++++++++++++++++
src/common/wpa_common.h | 7 +++++
2 files changed, 76 insertions(+)
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 3b7da06b1dca..a22c7a3f67de 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1962,6 +1962,75 @@ 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
+ * @hash: Hash algorithm of the PQC profile
+ * @msg1: Frame body of the first FT message (from Authentication Algorithm)
+ * @msg1_len: Length of @msg1
+ * @msg2: Frame body of the second FT message (from Authentication Algorithm)
+ * @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
+ * @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)
+{
+ struct crypto_hash *ctx;
+ enum crypto_hash_alg alg;
+ u8 len[4], zero[SHA512_MAC_LEN / 2];
+
+ if (msg2_mic_offset + mic_len > msg2_len || mic_len > sizeof(zero))
+ return -1;
+
+ switch (hash) {
+ case RSN_HASH_SHA256:
+ alg = CRYPTO_HASH_ALG_SHA256;
+ break;
+ case RSN_HASH_SHA384:
+ alg = CRYPTO_HASH_ALG_SHA384;
+ break;
+ case RSN_HASH_SHA512:
+ alg = CRYPTO_HASH_ALG_SHA512;
+ break;
+ default:
+ return -1;
+ }
+
+ ctx = crypto_hash_init(alg, NULL, 0);
+ if (!ctx)
+ 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.
+ */
+ WPA_PUT_LE32(len, msg1_len);
+ crypto_hash_update(ctx, len, sizeof(len));
+ crypto_hash_update(ctx, msg1, msg1_len);
+
+ os_memset(zero, 0, sizeof(zero));
+ WPA_PUT_LE32(len, msg2_len);
+ crypto_hash_update(ctx, len, sizeof(len));
+ crypto_hash_update(ctx, msg2, msg2_mic_offset);
+ crypto_hash_update(ctx, zero, mic_len);
+ crypto_hash_update(ctx, msg2 + msg2_mic_offset + mic_len,
+ msg2_len - msg2_mic_offset - mic_len);
+
+ return crypto_hash_finish(ctx, t, t_len) ? -1 : 0;
+}
+#endif /* CONFIG_IEEE80211R */
+
+
/**
* pqc_pmk_to_ptk - Derive PTK from PMK for PQC cases
* @pmk: PMK buffer
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 7a82db952bb3..af621e1a65e7 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -839,6 +839,13 @@ struct wpa_ft_pqc_params {
const u8 *transcript;
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_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,
--
2.55.0
More information about the Hostap
mailing list