aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpas_glue.c
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2011-10-28 11:39:44 (GMT)
committerJouni Malinen <j@w1.fi>2013-05-20 08:00:56 (GMT)
commitfa7ae9501b1cb9ef61987d6ab4764167e355ae65 (patch)
treeccb5bd301809cb7d1982ffae0684e9e40bf87698 /wpa_supplicant/wpas_glue.c
parent576bce9c86a26344fae53c380715b458b9bf6d41 (diff)
downloadhostap-fa7ae9501b1cb9ef61987d6ab4764167e355ae65.zip
hostap-fa7ae9501b1cb9ef61987d6ab4764167e355ae65.tar.gz
hostap-fa7ae9501b1cb9ef61987d6ab4764167e355ae65.tar.bz2
Add test code for fetching the last configured GTK
This can be useful for some test cases, so allow wpa_supplicant to be built with special test functionality to expose the current (last configured) GTK. This is disabled by default and can be enabled by adding following line into .config: CFLAGS += -DCONFIG_TESTING_GET_GTK The GTK can then be fetched with "wpa_cli get gtk". Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant/wpas_glue.c')
-rw-r--r--wpa_supplicant/wpas_glue.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 1a64df3..40720c5 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -437,6 +437,13 @@ static int wpa_supplicant_set_key(void *_wpa_s, enum wpa_alg alg,
/* Clear the MIC error counter when setting a new PTK. */
wpa_s->mic_errors_seen = 0;
}
+#ifdef CONFIG_TESTING_GET_GTK
+ if (key_idx > 0 && addr && is_broadcast_ether_addr(addr) &&
+ alg != WPA_ALG_NONE && key_len <= sizeof(wpa_s->last_gtk)) {
+ os_memcpy(wpa_s->last_gtk, key, key_len);
+ wpa_s->last_gtk_len = key_len;
+ }
+#endif /* CONFIG_TESTING_GET_GTK */
return wpa_drv_set_key(wpa_s, alg, addr, key_idx, set_tx, seq, seq_len,
key, key_len);
}