mesh: Use variable length MGTK for RX

This extends the data structures to allow variable length MGTK to be
stored for RX. This is needed as an initial step towards supporting
different cipher suites.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2016-06-18 14:45:35 +03:00
parent fccba2c946
commit a4eec3c230
3 changed files with 9 additions and 5 deletions

View file

@ -87,7 +87,8 @@ struct sta_info {
u8 aek[32]; /* SHA256 digest length */
u8 mtk[WPA_TK_MAX_LEN];
size_t mtk_len;
u8 mgtk[16];
u8 mgtk[WPA_TK_MAX_LEN];
size_t mgtk_len;
u8 sae_auth_retry;
#endif /* CONFIG_MESH */

View file

@ -797,15 +797,17 @@ static void mesh_mpm_plink_estab(struct wpa_supplicant *wpa_s,
/* TODO: support for other ciphers */
wpa_drv_set_key(wpa_s, WPA_ALG_CCMP, sta->addr, 0, 0,
seq, sizeof(seq), sta->mtk, sta->mtk_len);
wpa_hexdump_key(MSG_DEBUG, "mesh: RX MGTK",
sta->mgtk, sta->mgtk_len);
/* TODO: support for other ciphers */
/* FIX: key index.. */
wpa_drv_set_key(wpa_s, WPA_ALG_CCMP, sta->addr, 1, 0,
seq, sizeof(seq),
sta->mgtk, sizeof(sta->mgtk));
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));
wpa_hexdump_key(MSG_DEBUG, "mgtk:",
sta->mgtk, sizeof(sta->mgtk));
}
wpa_mesh_set_plink_state(wpa_s, sta, PLINK_ESTAB);

View file

@ -640,6 +640,7 @@ int mesh_rsn_process_ampe(struct wpa_supplicant *wpa_s, struct sta_info *sta,
os_memcpy(sta->peer_nonce, ampe->local_nonce,
sizeof(ampe->local_nonce));
os_memcpy(sta->mgtk, ampe->mgtk, sizeof(ampe->mgtk));
sta->mgtk_len = sizeof(ampe->mgtk);
/* todo parse mgtk expiration */
free: