aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/wlantest.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-07 17:43:10 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-07 21:29:02 (GMT)
commitd06df64d14e591140ba8f0bef17947b3183a14e0 (patch)
tree783eeabde423c1b96233823398d13bd7b8b9f75f /wlantest/wlantest.c
parent3215df77eeaf4fee01d03b1a164b1329cfdcfb52 (diff)
downloadhostap-d06df64d14e591140ba8f0bef17947b3183a14e0.zip
hostap-d06df64d14e591140ba8f0bef17947b3183a14e0.tar.gz
hostap-d06df64d14e591140ba8f0bef17947b3183a14e0.tar.bz2
wlantest: Derive PMK from RADIUS exchange
Decrypt MPPE keys and derive PMK from RADIUS exchange if RADIUS shared secret is known. Use the derived PMK when trying to derive PTK during 4-Way Handshake.
Diffstat (limited to 'wlantest/wlantest.c')
-rw-r--r--wlantest/wlantest.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/wlantest/wlantest.c b/wlantest/wlantest.c
index b28f43d..fc1d408 100644
--- a/wlantest/wlantest.c
+++ b/wlantest/wlantest.c
@@ -33,7 +33,8 @@ static void usage(void)
{
printf("wlantest [-ddhqq] [-i<ifname>] [-r<pcap file>] "
"[-p<passphrase>]\n"
- " [-I<wired ifname>] [-R<wired pcap file>]\n");
+ " [-I<wired ifname>] [-R<wired pcap file>] "
+ "[-P<RADIUS shared secret>]\n");
}
@@ -44,12 +45,29 @@ static void passphrase_deinit(struct wlantest_passphrase *p)
}
+static void secret_deinit(struct wlantest_radius_secret *r)
+{
+ dl_list_del(&r->list);
+ os_free(r);
+}
+
+
static void wlantest_init(struct wlantest *wt)
{
os_memset(wt, 0, sizeof(*wt));
wt->monitor_sock = -1;
dl_list_init(&wt->passphrase);
dl_list_init(&wt->bss);
+ dl_list_init(&wt->secret);
+ dl_list_init(&wt->radius);
+ dl_list_init(&wt->pmk);
+}
+
+
+void radius_deinit(struct wlantest_radius *r)
+{
+ dl_list_del(&r->list);
+ os_free(r);
}
@@ -57,6 +75,10 @@ static void wlantest_deinit(struct wlantest *wt)
{
struct wlantest_bss *bss, *n;
struct wlantest_passphrase *p, *pn;
+ struct wlantest_radius_secret *s, *sn;
+ struct wlantest_radius *r, *rn;
+ struct wlantest_pmk *pmk, *np;
+
if (wt->monitor_sock >= 0)
monitor_deinit(wt);
dl_list_for_each_safe(bss, n, &wt->bss, struct wlantest_bss, list)
@@ -64,6 +86,13 @@ static void wlantest_deinit(struct wlantest *wt)
dl_list_for_each_safe(p, pn, &wt->passphrase,
struct wlantest_passphrase, list)
passphrase_deinit(p);
+ dl_list_for_each_safe(s, sn, &wt->secret,
+ struct wlantest_radius_secret, list)
+ secret_deinit(s);
+ dl_list_for_each_safe(r, rn, &wt->radius, struct wlantest_radius, list)
+ radius_deinit(r);
+ dl_list_for_each_safe(pmk, np, &wt->pmk, struct wlantest_pmk, list)
+ pmk_deinit(pmk);
}
@@ -82,6 +111,21 @@ static void add_passphrase(struct wlantest *wt, const char *passphrase)
}
+static void add_secret(struct wlantest *wt, const char *secret)
+{
+ struct wlantest_radius_secret *s;
+ size_t len = os_strlen(secret);
+
+ if (len >= MAX_RADIUS_SECRET_LEN)
+ return;
+ s = os_zalloc(sizeof(*s));
+ if (s == NULL)
+ return;
+ os_memcpy(s->secret, secret, len);
+ dl_list_add(&wt->secret, &s->list);
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -100,7 +144,7 @@ int main(int argc, char *argv[])
wlantest_init(&wt);
for (;;) {
- c = getopt(argc, argv, "dhi:I:p:qr:R:");
+ c = getopt(argc, argv, "dhi:I:p:P:qr:R:");
if (c < 0)
break;
switch (c) {
@@ -120,6 +164,9 @@ int main(int argc, char *argv[])
case 'p':
add_passphrase(&wt, optarg);
break;
+ case 'P':
+ add_secret(&wt, optarg);
+ break;
case 'q':
wpa_debug_level++;
break;