diff options
author | Damien Bergamini <damien@cvs.openbsd.org> | 2007-08-01 12:32:27 +0000 |
---|---|---|
committer | Damien Bergamini <damien@cvs.openbsd.org> | 2007-08-01 12:32:27 +0000 |
commit | 5246d9c4ee91b0b7d8ea9117786f6d927f77fd25 (patch) | |
tree | 0469a2f8da1b00b336476c2764ddfafccab1b241 /sys/net80211 | |
parent | 8d11e8f2ae4bd77dcd29ef4f99061c9a7510335a (diff) |
PMKID KDE is optionnal in message 1 of the 4-way handshake (at least
when using WPA-PSK).
add a ni_replaycnt_ok flag to struct ieee80211_node to mark the replay
counter as valid. the replay counter is marked valid only when message
3 of the 4-way handshake is received since message 1 contains no MIC.
Diffstat (limited to 'sys/net80211')
-rw-r--r-- | sys/net80211/ieee80211_input.c | 13 | ||||
-rw-r--r-- | sys/net80211/ieee80211_node.h | 3 |
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/net80211/ieee80211_input.c b/sys/net80211/ieee80211_input.c index 9d2816a14b2..0e5699323c2 100644 --- a/sys/net80211/ieee80211_input.c +++ b/sys/net80211/ieee80211_input.c @@ -1,5 +1,5 @@ /* $NetBSD: ieee80211_input.c,v 1.24 2004/05/31 11:12:24 dyoung Exp $ */ -/* $OpenBSD: ieee80211_input.c,v 1.49 2007/08/01 12:26:16 damien Exp $ */ +/* $OpenBSD: ieee80211_input.c,v 1.50 2007/08/01 12:32:26 damien Exp $ */ /*- * Copyright (c) 2001 Atsushi Onoe * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -1899,7 +1899,7 @@ ieee80211_recv_4way_msg1(struct ieee80211com *ic, ic->ic_opmode != IEEE80211_M_IBSS) return; - if (BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) + if (ni->ni_replaycnt && BE_READ_8(key->replaycnt) <= ni->ni_replaycnt) return; /* save authenticator's nonce (ANonce) */ @@ -1928,11 +1928,13 @@ ieee80211_recv_4way_msg1(struct ieee80211com *ic, } frm += 2 + frm[1]; } - /* check that we have a valid PMKID KDE */ - if (pmkid == NULL || pmkid[1] - 4 < 16) + /* check that the PMKID KDE is valid */ + if (pmkid != NULL && pmkid[1] - 4 < 16) return; - /* do not update replaycnt since the frame contains no MIC */ + /* update the last seen value of the key replay counter field */ + ni->ni_replaycnt = BE_READ_8(key->replaycnt); + /* do not set ni_replaycnt_ok since the frame contains no MIC */ /* generate a new nonce (SNonce) */ get_random_bytes(snonce, EAPOL_KEY_NONCE_LEN); @@ -2088,6 +2090,7 @@ ieee80211_recv_4way_msg3(struct ieee80211com *ic, /* update the last seen value of the key replay counter field */ ni->ni_replaycnt = BE_READ_8(key->replaycnt); + ni->ni_replaycnt_ok = 1; /* * If a second RSN information element is present, use its pairwise diff --git a/sys/net80211/ieee80211_node.h b/sys/net80211/ieee80211_node.h index 3b6e5f8c109..11db49d4c2a 100644 --- a/sys/net80211/ieee80211_node.h +++ b/sys/net80211/ieee80211_node.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_node.h,v 1.18 2007/07/28 11:09:03 damien Exp $ */ +/* $OpenBSD: ieee80211_node.h,v 1.19 2007/08/01 12:32:26 damien Exp $ */ /* $NetBSD: ieee80211_node.h,v 1.9 2004/04/30 22:57:32 dyoung Exp $ */ /*- @@ -122,6 +122,7 @@ struct ieee80211_node { int ni_port_valid; u_int8_t ni_nonce[EAPOL_KEY_NONCE_LEN]; u_int64_t ni_replaycnt; + u_int8_t ni_replaycnt_ok; u_int8_t *ni_rsnie; struct ieee80211_ptk ni_ptk; u_int8_t ni_ptk_ok; |