From 4367eec4394002046e1ad99b2ecf878d925415f0 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 18 Jun 2016 15:50:14 +0300 Subject: [PATCH] mesh: Do not use RX MGTK as RX IGTK The previous implementation was incorrect in forcing the MGTK to be used as the IGTK as well. Define new variable for storing IGTK and use that, if set, to configure IGTK to the driver. This commit does not yet fix AMPE element parsing to fill in this information. Signed-off-by: Jouni Malinen --- src/ap/sta_info.h | 2 ++ wpa_supplicant/mesh_mpm.c | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h index b5ed91801..2e1e019ef 100644 --- a/src/ap/sta_info.h +++ b/src/ap/sta_info.h @@ -89,6 +89,8 @@ struct sta_info { size_t mtk_len; u8 mgtk[WPA_TK_MAX_LEN]; size_t mgtk_len; + u8 igtk[WPA_TK_MAX_LEN]; + size_t igtk_len; u8 sae_auth_retry; #endif /* CONFIG_MESH */ diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index 090198d48..9829bccd0 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -805,9 +805,15 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s, wpa_drv_set_key(wpa_s, WPA_ALG_CCMP, sta->addr, 1, 0, seq, sizeof(seq), sta->mgtk, sta->mgtk_len); - wpa_drv_set_key(wpa_s, WPA_ALG_IGTK, sta->addr, 4, 0, - seq, sizeof(seq), - sta->mgtk, sizeof(sta->mgtk)); + + if (sta->igtk_len) { + wpa_hexdump_key(MSG_DEBUG, "RX IGTK", + sta->igtk, sta->igtk_len); + /* FIX: key index.. */ + wpa_drv_set_key(wpa_s, WPA_ALG_IGTK, sta->addr, 4, 0, + seq, sizeof(seq), + sta->igtk, sta->igtk_len); + } } wpa_mesh_set_plink_state(wpa_s, sta, PLINK_ESTAB);