diff --git a/sys/dev/ipw/if_ipwreg.h b/sys/dev/ipw/if_ipwreg.h index 05f5939ac59..acb310f2213 100644 --- a/sys/dev/ipw/if_ipwreg.h +++ b/sys/dev/ipw/if_ipwreg.h @@ -168,7 +168,7 @@ struct ipw_hdr { 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 index dd6bb91bfec..b34867677d1 100644 --- a/sys/dev/iwi/if_iwireg.h +++ b/sys/dev/iwi/if_iwireg.h @@ -341,7 +341,7 @@ struct iwi_tx_desc { #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 @@ struct iwi_wep_key { 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 index 05c5bc90c46..008068c9952 100644 --- a/sys/dev/malo/if_malo.h +++ b/sys/dev/malo/if_malo.h @@ -332,9 +332,9 @@ struct malo_cmd_wepkey { 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 index b7f85e65cfd..87e2679778d 100644 --- a/sys/dev/mwl/if_mwl.c +++ b/sys/dev/mwl/if_mwl.c @@ -1661,10 +1661,10 @@ _mwl_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, /* 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 index af95a7626b6..86d6a568dad 100644 --- a/sys/dev/ral/rt2560reg.h +++ b/sys/dev/ral/rt2560reg.h @@ -224,7 +224,7 @@ struct rt2560_tx_desc { 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 @@ struct rt2560_rx_desc { 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 index e2074e1dd2a..7ac194e6f14 100644 --- a/sys/dev/usb/wlan/if_rsureg.h +++ b/sys/dev/usb/wlan/if_rsureg.h @@ -478,14 +478,14 @@ struct r92s_fw_cmd_set_key { 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 index 4a4a150146a..4683267bda2 100644 --- a/sys/dev/usb/wlan/if_rum.c +++ b/sys/dev/usb/wlan/if_rum.c @@ -2867,10 +2867,10 @@ rum_common_key_set(struct rum_softc *sc, struct ieee80211_key *k, 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 index 348a5758285..cc364e95590 100644 --- 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 index 84d25bbeb95..4c6af326329 100644 --- a/sys/dev/wpi/if_wpireg.h +++ b/sys/dev/wpi/if_wpireg.h @@ -466,7 +466,7 @@ struct wpi_node_info { 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 @@ struct wpi_cmd_data { #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 index 48115da586b..824983ae4d2 100644 --- 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 index e1b261a0be6..cf947e559a4 100644 --- a/sys/net80211/ieee80211_crypto_wep.c +++ b/sys/net80211/ieee80211_crypto_wep.c @@ -348,7 +348,7 @@ wep_encrypt(struct ieee80211_key *key, struct mbuf *m0, int hdrlen) 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 @@ wep_decrypt(struct ieee80211_key *key, struct mbuf *m0, int hdrlen) 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;