[PATCH 05/12] MLD STA: Derive pairwise keys using MLD address

Veerendranath Jakkam quic_vjakkam at quicinc.com
Wed Aug 24 22:53:04 PDT 2022


Pairwise keys must be derived using MLD for MLO connection. Current
changes are handling only ptk derivation during EAPOL Four-Way
handshake.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam at quicinc.com>
---
 src/rsn_supp/wpa.c    | 8 +++++++-
 src/rsn_supp/wpa_ft.c | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 4081dde79..66b94bd12 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -588,6 +588,7 @@ static int wpa_derive_ptk(struct wpa_sm *sm, const unsigned char *src_addr,
 	const u8 *z = NULL;
 	size_t z_len = 0, kdk_len;
 	int akmp;
+	u8 *auth_addr;
 
 #ifdef CONFIG_IEEE80211R
 	if (wpa_key_mgmt_ft(sm->key_mgmt))
@@ -618,8 +619,13 @@ static int wpa_derive_ptk(struct wpa_sm *sm, const unsigned char *src_addr,
 	else
 		kdk_len = 0;
 
+	if (sm->valid_links)
+		auth_addr = sm->ap_mld_addr;
+	else
+		auth_addr = sm->bssid;
+
 	return wpa_pmk_to_ptk(sm->pmk, sm->pmk_len, "Pairwise key expansion",
-			      sm->own_addr, sm->bssid, sm->snonce,
+			      sm->own_addr, auth_addr, sm->snonce,
 			      key->key_nonce, ptk, akmp,
 			      sm->pairwise_cipher, z, z_len,
 			      kdk_len);
diff --git a/src/rsn_supp/wpa_ft.c b/src/rsn_supp/wpa_ft.c
index 9d4044c14..06c74c47c 100644
--- a/src/rsn_supp/wpa_ft.c
+++ b/src/rsn_supp/wpa_ft.c
@@ -41,6 +41,7 @@ int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
 	int use_sha384 = wpa_key_mgmt_sha384(sm->key_mgmt);
 	const u8 *mpmk;
 	size_t mpmk_len, kdk_len;
+	u8 *auth_addr;
 
 	if (sm->xxkey_len > 0) {
 		mpmk = sm->xxkey;
@@ -75,8 +76,13 @@ int wpa_derive_ptk_ft(struct wpa_sm *sm, const unsigned char *src_addr,
 	else
 		kdk_len = 0;
 
+	if (sm->valid_links)
+		auth_addr = sm->ap_mld_addr;
+	else
+		auth_addr = sm->bssid;
+
 	return wpa_pmk_r1_to_ptk(sm->pmk_r1, sm->pmk_r1_len, sm->snonce, anonce,
-				 sm->own_addr, sm->bssid, sm->pmk_r1_name, ptk,
+				 sm->own_addr, auth_addr, sm->pmk_r1_name, ptk,
 				 ptk_name, sm->key_mgmt, sm->pairwise_cipher,
 				 kdk_len);
 }
-- 
2.25.1




More information about the Hostap mailing list