From: damien Date: Tue, 12 Aug 2008 18:01:41 +0000 (+0000) Subject: extend the ic_nw_keys[] array to 6 elements. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0cf6590d84a4da6b2ec44ddf2d5f5b5fcecae743;p=openbsd extend the ic_nw_keys[] array to 6 elements. indices 0-3 will be used for group data keys while indices 4-5 will be used for integrity group keys. add a ic_rsngroupmgmtcipher field too. --- diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c index bbc50904b09..688190082e5 100644 --- a/sys/net80211/ieee80211_crypto.c +++ b/sys/net80211/ieee80211_crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_crypto.c,v 1.46 2008/08/12 16:14:05 damien Exp $ */ +/* $OpenBSD: ieee80211_crypto.c,v 1.47 2008/08/12 18:01:41 damien Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini @@ -79,14 +79,35 @@ ieee80211_crypto_detach(struct ifnet *ifp) int i; /* clear all keys from memory */ - for (i = 0; i < IEEE80211_WEP_NKID; i++) { - if (ic->ic_nw_keys[i].k_cipher != IEEE80211_CIPHER_NONE) - (*ic->ic_delete_key)(ic, NULL, &ic->ic_nw_keys[i]); - memset(&ic->ic_nw_keys[i], 0, sizeof(struct ieee80211_key)); + for (i = 0; i < IEEE80211_GROUP_NKID; i++) { + struct ieee80211_key *k = &ic->ic_nw_keys[i]; + if (k->k_cipher != IEEE80211_CIPHER_NONE) + (*ic->ic_delete_key)(ic, NULL, k); + memset(k, 0, sizeof(*k)); } memset(ic->ic_psk, 0, IEEE80211_PMK_LEN); } +/* + * Return the length in bytes of a cipher suite key (see Table 60). + */ +int +ieee80211_cipher_keylen(enum ieee80211_cipher cipher) +{ + switch (cipher) { + case IEEE80211_CIPHER_WEP40: + return 5; + case IEEE80211_CIPHER_TKIP: + return 32; + case IEEE80211_CIPHER_CCMP: + return 16; + case IEEE80211_CIPHER_WEP104: + return 13; + default: /* unknown cipher */ + return 0; + } +} + int ieee80211_set_key(struct ieee80211com *ic, struct ieee80211_node *ni, struct ieee80211_key *k) @@ -449,23 +470,3 @@ ieee80211_eapol_key_decrypt(struct ieee80211_eapol_key *key, return 1; /* unknown Key Descriptor Version */ } - -/* - * Return the length in bytes of a cipher suite key (see Table 60). - */ -int -ieee80211_cipher_keylen(enum ieee80211_cipher cipher) -{ - switch (cipher) { - case IEEE80211_CIPHER_WEP40: - return 5; - case IEEE80211_CIPHER_TKIP: - return 32; - case IEEE80211_CIPHER_CCMP: - return 16; - case IEEE80211_CIPHER_WEP104: - return 13; - default: /* unknown cipher */ - return 0; - } -} diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index c50d8c6257d..61281b7cdea 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ieee80211_var.h,v 1.43 2008/08/12 17:53:13 damien Exp $ */ +/* $OpenBSD: ieee80211_var.h,v 1.44 2008/08/12 18:01:41 damien Exp $ */ /* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */ /*- @@ -170,6 +170,8 @@ struct ieee80211_rxinfo { #define IEEE80211_SCAN_REQUEST 0x2 #define IEEE80211_SCAN_RESUME 0x4 +#define IEEE80211_GROUP_NKID 6 + struct ieee80211com { struct arpcom ic_ac; LIST_ENTRY(ieee80211com) ic_list; /* chain of all ieee80211com */ @@ -248,9 +250,10 @@ struct ieee80211com { u_int8_t ic_des_essid[IEEE80211_NWID_LEN]; struct ieee80211_channel *ic_des_chan; /* desired channel */ u_int8_t ic_des_bssid[IEEE80211_ADDR_LEN]; - struct ieee80211_key ic_nw_keys[IEEE80211_WEP_NKID]; - int ic_def_txkey; /* default tx key index */ + struct ieee80211_key ic_nw_keys[IEEE80211_GROUP_NKID]; + int ic_def_txkey; /* group data key index */ #define ic_wep_txkey ic_def_txkey + int ic_igtk_kid; /* IGTK key index */ u_int32_t ic_iv; /* initial vector for wep */ struct ieee80211_stats ic_stats; /* statistics */ struct timeval ic_last_merge_print; /* for rate-limiting @@ -269,6 +272,7 @@ struct ieee80211com { u_int ic_rsnakms; u_int ic_rsnciphers; enum ieee80211_cipher ic_rsngroupcipher; + enum ieee80211_cipher ic_rsngroupmgmtcipher; u_int8_t *ic_tim_bitmap; u_int ic_tim_len;