aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/mesh_rsn.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2016-06-18 11:39:43 (GMT)
committerJouni Malinen <j@w1.fi>2016-06-19 17:18:09 (GMT)
commit696f792320b9a082d28eba4e97ccc4cdab09b8b8 (patch)
tree2c25506bab80a11616faf4b89f356598460d12a8 /wpa_supplicant/mesh_rsn.c
parentb02f4d058cbf113646d5fcd22d9a23c113f0319a (diff)
downloadhostap-696f792320b9a082d28eba4e97ccc4cdab09b8b8.zip
hostap-696f792320b9a082d28eba4e97ccc4cdab09b8b8.tar.gz
hostap-696f792320b9a082d28eba4e97ccc4cdab09b8b8.tar.bz2
mesh: Support variable length TX MGTK
This is an initial step in supporting multiple cipher suites. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/mesh_rsn.c')
-rw-r--r--wpa_supplicant/mesh_rsn.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/wpa_supplicant/mesh_rsn.c b/wpa_supplicant/mesh_rsn.c
index d7a8115..021b7d2 100644
--- a/wpa_supplicant/mesh_rsn.c
+++ b/wpa_supplicant/mesh_rsn.c
@@ -173,7 +173,8 @@ static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr,
}
/* TODO: support rekeying */
- if (random_get_bytes(rsn->mgtk, 16) < 0)
+ rsn->mgtk_len = wpa_cipher_key_len(WPA_CIPHER_CCMP);
+ if (random_get_bytes(rsn->mgtk, rsn->mgtk_len) < 0)
return -1;
/* group mgmt */
@@ -181,8 +182,10 @@ static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr,
seq, sizeof(seq), rsn->mgtk, sizeof(rsn->mgtk));
/* group privacy / data frames */
+ wpa_hexdump_key(MSG_DEBUG, "mesh: Own TX MGTK",
+ rsn->mgtk, rsn->mgtk_len);
wpa_drv_set_key(rsn->wpa_s, WPA_ALG_CCMP, NULL, 1, 1,
- seq, sizeof(seq), rsn->mgtk, sizeof(rsn->mgtk));
+ seq, sizeof(seq), rsn->mgtk, rsn->mgtk_len);
return 0;
}
@@ -191,6 +194,7 @@ static int __mesh_rsn_auth_init(struct mesh_rsn *rsn, const u8 *addr,
static void mesh_rsn_deinit(struct mesh_rsn *rsn)
{
os_memset(rsn->mgtk, 0, sizeof(rsn->mgtk));
+ rsn->mgtk_len = 0;
if (rsn->auth)
wpa_deinit(rsn->auth);
}