diff --git a/sys/dev/ipw/if_ipwreg.h b/sys/dev/ipw/if_ipwreg.h --- a/sys/dev/ipw/if_ipwreg.h +++ b/sys/dev/ipw/if_ipwreg.h @@ -168,7 +168,7 @@ uint8_t encrypt; uint8_t keyidx; uint8_t keysz; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX should be HW specific */ uint8_t reserved[10]; uint8_t src_addr[IEEE80211_ADDR_LEN]; uint8_t dst_addr[IEEE80211_ADDR_LEN]; diff --git a/sys/dev/iwi/if_iwireg.h b/sys/dev/iwi/if_iwireg.h --- a/sys/dev/iwi/if_iwireg.h +++ b/sys/dev/iwi/if_iwireg.h @@ -341,7 +341,7 @@ #define IWI_DATA_XFLAG_QOS 0x10 uint8_t wep_txkey; - uint8_t wepkey[IEEE80211_KEYBUF_SIZE]; + uint8_t wepkey[IEEE80211_KEYBUF_128_SIZE]; /* XXX hardware specific */ uint8_t rate; uint8_t antenna; uint8_t reserved3[10]; @@ -530,7 +530,7 @@ uint8_t seq; uint8_t idx; uint8_t len; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX hardware specific */ } __packed; /* structure for command IWI_CMD_SET_WME_PARAMS */ diff --git a/sys/dev/malo/if_malo.h b/sys/dev/malo/if_malo.h --- a/sys/dev/malo/if_malo.h +++ b/sys/dev/malo/if_malo.h @@ -332,9 +332,9 @@ uint8_t len; uint8_t flags; uint16_t index; - uint8_t value[IEEE80211_KEYBUF_SIZE]; - uint8_t txmickey[IEEE80211_WEP_MICLEN]; - uint8_t rxmickey[IEEE80211_WEP_MICLEN]; + uint8_t value[IEEE80211_KEYBUF_128_SIZE]; /* XXX hardware */ + uint8_t txmickey[IEEE80211_WEP_MICLEN]; /* XXX hardware */ + uint8_t rxmickey[IEEE80211_WEP_MICLEN]; /* XXX hardware */ uint64_t rxseqctr; uint64_t txseqctr; } __packed; diff --git a/sys/dev/mwl/if_mwl.c b/sys/dev/mwl/if_mwl.c --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -1661,10 +1661,10 @@ /* Copy in TKIP MIC after the 16 byte main key */ memcpy(hk.key.aes, ieee80211_crypto_get_key_data(k), ieee80211_crypto_get_key_len(k)); - memcpy(hk.key.aes + IEEE80211_KEYBUF_SIZE, + memcpy(hk.key.aes + IEEE80211_KEYBUF_128_SIZE, ieee80211_crypto_get_key_txmic_data(k), 8); - memcpy(hk.key.aes + IEEE80211_KEYBUF_SIZE + 8, + memcpy(hk.key.aes + IEEE80211_KEYBUF_128_SIZE + 8, ieee80211_crypto_get_key_rxmic_data(k), 8); break; diff --git a/sys/dev/ral/rt2560reg.h b/sys/dev/ral/rt2560reg.h --- a/sys/dev/ral/rt2560reg.h +++ b/sys/dev/ral/rt2560reg.h @@ -224,7 +224,7 @@ uint8_t plcp_length_hi; uint32_t iv; uint32_t eiv; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX hardware */ uint32_t reserved2[2]; } __packed; @@ -251,7 +251,7 @@ uint8_t ta[IEEE80211_ADDR_LEN]; uint32_t iv; uint32_t eiv; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX hardware */ uint32_t reserved[2]; } __packed; diff --git a/sys/dev/usb/wlan/if_rsureg.h b/sys/dev/usb/wlan/if_rsureg.h --- a/sys/dev/usb/wlan/if_rsureg.h +++ b/sys/dev/usb/wlan/if_rsureg.h @@ -478,14 +478,14 @@ uint8_t cam_id; uint8_t grpkey; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX firmware */ } __packed; /* Structure for R92S_CMD_SET_STA_KEY. */ struct r92s_fw_cmd_set_key_mac { uint8_t macaddr[IEEE80211_ADDR_LEN]; uint8_t algo; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX firmware */ } __packed; /* Structures for R92S_EVENT_SURVEY/R92S_CMD_JOIN_BSS. */ diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -2867,10 +2867,10 @@ return EIO; if (k->wk_cipher->ic_cipher == IEEE80211_CIPHER_TKIP) { - if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE, + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_128_SIZE, ieee80211_crypto_get_key_txmic_data(k), 8)) return EIO; - if (rum_write_multi(sc, base + IEEE80211_KEYBUF_SIZE + 8, + if (rum_write_multi(sc, base + IEEE80211_KEYBUF_128_SIZE + 8, ieee80211_crypto_get_key_rxmic_data(k), 8)) return EIO; } diff --git a/sys/dev/usb/wlan/if_rumreg.h b/sys/dev/usb/wlan/if_rumreg.h --- a/sys/dev/usb/wlan/if_rumreg.h +++ b/sys/dev/usb/wlan/if_rumreg.h @@ -45,7 +45,7 @@ /* * H/w encryption/decryption support */ -#define KEY_SIZE (IEEE80211_KEYBUF_SIZE + IEEE80211_MICBUF_SIZE) +#define KEY_SIZE (IEEE80211_KEYBUF_128_SIZE + IEEE80211_MICBUF_128_SIZE) #define RT2573_ADDR_MAX 64 #define RT2573_SKEY_MAX 4 diff --git a/sys/dev/wpi/if_wpireg.h b/sys/dev/wpi/if_wpireg.h --- a/sys/dev/wpi/if_wpireg.h +++ b/sys/dev/wpi/if_wpireg.h @@ -466,7 +466,7 @@ uint8_t reserved4; uint16_t ttak[5]; uint16_t reserved5; - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX firmware */ uint32_t action; #define WPI_ACTION_SET_RATE (1 << 2) @@ -514,7 +514,7 @@ #define WPI_CIPHER_TKIP 3 #define WPI_CIPHER_WEP104 9 - uint8_t key[IEEE80211_KEYBUF_SIZE]; + uint8_t key[IEEE80211_KEYBUF_128_SIZE]; /* XXX firmware */ uint8_t tkip[IEEE80211_WEP_MICLEN]; uint32_t fnext; #define WPI_NEXT_STA_ID(id) ((id) << 8) diff --git a/sys/net80211/ieee80211_crypto.h b/sys/net80211/ieee80211_crypto.h --- a/sys/net80211/ieee80211_crypto.h +++ b/sys/net80211/ieee80211_crypto.h @@ -31,8 +31,24 @@ /* * 802.11 protocol crypto-related definitions. */ -#define IEEE80211_KEYBUF_SIZE 16 -#define IEEE80211_MICBUF_SIZE (8+8) /* space for both tx+rx keys */ + +/* + * Legacy 128 bit key size storage for WEP, TKIP, CCMP key sizes. + * This has been used to store keys in net80211 for various things + * (eg the rc4key in WEP) as well as driver definitions for their + * own hardware programming. + * + * This should eventually be used by the ioctl and drivers instead of + * IEEE80211_KEYBUF_SIZE as the key size will eventually grow. + */ +#define IEEE80211_KEYBUF_128_SIZE 16 +#define IEEE80211_MICBUF_128_SIZE (8+8) /* space for both tx+rx keys */ + +/* + * Temporary definition whilst I clean up where this is still being used. + */ +#define IEEE80211_KEYBUF_SIZE IEEE80211_KEYBUF_128_SIZE +#define IEEE80211_MICBUF_SIZE IEEE80211_MICBUF_128_SIZE /* * Old WEP-style key. Deprecated. diff --git a/sys/net80211/ieee80211_crypto_wep.c b/sys/net80211/ieee80211_crypto_wep.c --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -348,7 +348,7 @@ struct wep_ctx *ctx = key->wk_private; struct ieee80211vap *vap = ctx->wc_vap; struct mbuf *m = m0; - uint8_t rc4key[IEEE80211_WEP_IVLEN + IEEE80211_KEYBUF_SIZE]; + uint8_t rc4key[IEEE80211_WEP_IVLEN + IEEE80211_KEYBUF_128_SIZE]; uint8_t icv[IEEE80211_WEP_CRCLEN]; uint32_t i, j, k, crc; size_t buflen, data_len; @@ -431,7 +431,7 @@ struct wep_ctx *ctx = key->wk_private; struct ieee80211vap *vap = ctx->wc_vap; struct mbuf *m = m0; - uint8_t rc4key[IEEE80211_WEP_IVLEN + IEEE80211_KEYBUF_SIZE]; + uint8_t rc4key[IEEE80211_WEP_IVLEN + IEEE80211_KEYBUF_128_SIZE]; uint8_t icv[IEEE80211_WEP_CRCLEN]; uint32_t i, j, k, crc; size_t buflen, data_len;