diff mbox series

[06/12] MLD STA: Configure pairwise keys using MLD address

Message ID 20220825055311.3327147-7-quic_vjakkam@quicinc.com
State Changes Requested
Headers show
Series MLD STA: Add support for four-way handshake and SAE external authentication | expand

Commit Message

Veerendranath Jakkam Aug. 25, 2022, 5:53 a.m. UTC
Configure the pairwise keys with MLD address when plubing to driver.
Current changes handling only EAPOL Four-Way handshake.

Signed-off-by: Veerendranath Jakkam <quic_vjakkam@quicinc.com>
---
 src/rsn_supp/wpa.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Comments

Peer, Ilan Sept. 13, 2022, 7:30 a.m. UTC | #1
Hi,

> From: Hostap <hostap-bounces@lists.infradead.org> On Behalf Of
> Veerendranath Jakkam
> Sent: Thursday, August 25, 2022 08:53
> To: hostap@lists.infradead.org
> Cc: quic_vjakkam@quicinc.com
> Subject: [PATCH 06/12] MLD STA: Configure pairwise keys using MLD address
> 
> Configure the pairwise keys with MLD address when plubing to driver.

Plumbing? 😊

> key_rsc,
> +	if (sm->valid_links)
> +		auth_addr = sm->ap_mld_addr;
> +	else
> +		auth_addr = sm->bssid;
> +

Same here. I think it would be simpler to use a function to get the authenticator address.

Regards,

Ilan.
diff mbox series

Patch

diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 66b94bd12..8ac22eac9 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -1007,6 +1007,7 @@  static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 	int keylen, rsclen;
 	enum wpa_alg alg;
 	const u8 *key_rsc;
+	u8 *auth_addr;
 
 	if (sm->ptk.installed) {
 		wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG,
@@ -1046,13 +1047,18 @@  static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 		wpa_hexdump(MSG_DEBUG, "WPA: RSC", key_rsc, rsclen);
 	}
 
-	if (wpa_sm_set_key(sm, alg, sm->bssid, sm->keyidx_active, 1, key_rsc,
+	if (sm->valid_links)
+		auth_addr = sm->ap_mld_addr;
+	else
+		auth_addr = sm->bssid;
+
+	if (wpa_sm_set_key(sm, alg, auth_addr, sm->keyidx_active, 1, key_rsc,
 			   rsclen, sm->ptk.tk, keylen,
 			   KEY_FLAG_PAIRWISE | key_flag) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
-			"WPA: Failed to set PTK to the driver (alg=%d keylen=%d bssid="
+			"WPA: Failed to set PTK to the driver (alg=%d keylen=%d auth_addr="
 			MACSTR " idx=%d key_flag=0x%x)",
-			alg, keylen, MAC2STR(sm->bssid),
+			alg, keylen, MAC2STR(auth_addr),
 			sm->keyidx_active, key_flag);
 		return -1;
 	}
@@ -1077,11 +1083,13 @@  static int wpa_supplicant_install_ptk(struct wpa_sm *sm,
 
 static int wpa_supplicant_activate_ptk(struct wpa_sm *sm)
 {
+	const u8 *peer_addr = sm->valid_links ? sm->ap_mld_addr : sm->bssid;
+
 	wpa_dbg(sm->ctx->msg_ctx, MSG_DEBUG,
 		"WPA: Activate PTK (idx=%d bssid=" MACSTR ")",
 		sm->keyidx_active, MAC2STR(sm->bssid));
 
-	if (wpa_sm_set_key(sm, 0, sm->bssid, sm->keyidx_active, 0, NULL, 0,
+	if (wpa_sm_set_key(sm, 0, peer_addr, sm->keyidx_active, 0, NULL, 0,
 			   NULL, 0, KEY_FLAG_PAIRWISE_RX_TX_MODIFY) < 0) {
 		wpa_msg(sm->ctx->msg_ctx, MSG_WARNING,
 			"WPA: Failed to activate PTK for TX (idx=%d bssid="