-/* $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 <damien.bergamini@free.fr>
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)
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;
- }
-}
-/* $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 $ */
/*-
#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 */
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
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;