aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-08-10 03:46:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-08-16 16:45:11 -0400
commit97359d1235eaf634fe706c9faa6e40181cc95fb8 (patch)
tree5799455c94622eaa6a4fb065bd3b5c350bb705e0 /drivers/net/wireless
parent915a824e30c503157c38115eb6a85f60bb653738 (diff)
mac80211: use cipher suite selectors
Currently, mac80211 translates the cfg80211 cipher suite selectors into ALG_* values. That isn't all too useful, and some drivers benefit from the distinction between WEP40 and WEP104 as well. Therefore, convert it all to use the cipher suite selectors. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: Gertjan van Wingerde <gwingerde@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/at76c50x-usb.c7
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c31
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c9
-rw-r--r--drivers/net/wireless/ath/ath5k/pcu.c19
-rw-r--r--drivers/net/wireless/ath/ath9k/common.c36
-rw-r--r--drivers/net/wireless/ath/ath9k/htc_drv_main.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c5
-rw-r--r--drivers/net/wireless/b43/main.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tx.c16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c24
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c43
-rw-r--r--drivers/net/wireless/p54/main.c9
-rw-r--r--drivers/net/wireless/p54/txrx.c17
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00crypto.c17
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_main.c13
-rw-r--r--drivers/net/wireless/wl12xx/wl1251_tx.c4
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_main.c13
-rw-r--r--drivers/net/wireless/wl12xx/wl1271_tx.c4
21 files changed, 159 insertions, 139 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index d5140a87f073..a267bf55574c 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -2061,11 +2061,12 @@ static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2061 2061
2062 int i; 2062 int i;
2063 2063
2064 at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d " 2064 at76_dbg(DBG_MAC80211, "%s(): cmd %d key->cipher %d key->keyidx %d "
2065 "key->keylen %d", 2065 "key->keylen %d",
2066 __func__, cmd, key->alg, key->keyidx, key->keylen); 2066 __func__, cmd, key->cipher, key->keyidx, key->keylen);
2067 2067
2068 if (key->alg != ALG_WEP) 2068 if ((key->cipher != WLAN_CIPHER_SUITE_WEP40) &&
2069 (key->cipher != WLAN_CIPHER_SUITE_WEP104))
2069 return -EOPNOTSUPP; 2070 return -EOPNOTSUPP;
2070 2071
2071 key->hw_key_idx = key->keyidx; 2072 key->hw_key_idx = key->keyidx;
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index c67b05f3bcbd..29d2253ad7e4 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -1190,14 +1190,13 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
1190 if (info->control.hw_key) { 1190 if (info->control.hw_key) {
1191 icv = info->control.hw_key->icv_len; 1191 icv = info->control.hw_key->icv_len;
1192 1192
1193 switch (info->control.hw_key->alg) { 1193 switch (info->control.hw_key->cipher) {
1194 case ALG_WEP: 1194 case WLAN_CIPHER_SUITE_WEP40:
1195 case WLAN_CIPHER_SUITE_WEP104:
1196 case WLAN_CIPHER_SUITE_TKIP:
1195 keytype = AR9170_TX_MAC_ENCR_RC4; 1197 keytype = AR9170_TX_MAC_ENCR_RC4;
1196 break; 1198 break;
1197 case ALG_TKIP: 1199 case WLAN_CIPHER_SUITE_CCMP:
1198 keytype = AR9170_TX_MAC_ENCR_RC4;
1199 break;
1200 case ALG_CCMP:
1201 keytype = AR9170_TX_MAC_ENCR_AES; 1200 keytype = AR9170_TX_MAC_ENCR_AES;
1202 break; 1201 break;
1203 default: 1202 default:
@@ -1778,17 +1777,17 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1778 if ((!ar->vif) || (ar->disable_offload)) 1777 if ((!ar->vif) || (ar->disable_offload))
1779 return -EOPNOTSUPP; 1778 return -EOPNOTSUPP;
1780 1779
1781 switch (key->alg) { 1780 switch (key->cipher) {
1782 case ALG_WEP: 1781 case WLAN_CIPHER_SUITE_WEP40:
1783 if (key->keylen == WLAN_KEY_LEN_WEP40) 1782 ktype = AR9170_ENC_ALG_WEP64;
1784 ktype = AR9170_ENC_ALG_WEP64; 1783 break;
1785 else 1784 case WLAN_CIPHER_SUITE_WEP104:
1786 ktype = AR9170_ENC_ALG_WEP128; 1785 ktype = AR9170_ENC_ALG_WEP128;
1787 break; 1786 break;
1788 case ALG_TKIP: 1787 case WLAN_CIPHER_SUITE_TKIP:
1789 ktype = AR9170_ENC_ALG_TKIP; 1788 ktype = AR9170_ENC_ALG_TKIP;
1790 break; 1789 break;
1791 case ALG_CCMP: 1790 case WLAN_CIPHER_SUITE_CCMP:
1792 ktype = AR9170_ENC_ALG_AESCCMP; 1791 ktype = AR9170_ENC_ALG_AESCCMP;
1793 break; 1792 break;
1794 default: 1793 default:
@@ -1827,7 +1826,7 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1827 if (err) 1826 if (err)
1828 goto out; 1827 goto out;
1829 1828
1830 if (key->alg == ALG_TKIP) { 1829 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
1831 err = ar9170_upload_key(ar, i, sta ? sta->addr : NULL, 1830 err = ar9170_upload_key(ar, i, sta ? sta->addr : NULL,
1832 ktype, 1, key->key + 16, 16); 1831 ktype, 1, key->key + 16, 16);
1833 if (err) 1832 if (err)
@@ -1864,7 +1863,7 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1864 if (err) 1863 if (err)
1865 goto out; 1864 goto out;
1866 1865
1867 if (key->alg == ALG_TKIP) { 1866 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
1868 err = ar9170_upload_key(ar, key->hw_key_idx, 1867 err = ar9170_upload_key(ar, key->hw_key_idx,
1869 NULL, 1868 NULL,
1870 AR9170_ENC_ALG_NONE, 1, 1869 AR9170_ENC_ALG_NONE, 1,
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 373dcfec689c..a729b8774670 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -3297,11 +3297,12 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3297 if (sc->opmode == NL80211_IFTYPE_AP) 3297 if (sc->opmode == NL80211_IFTYPE_AP)
3298 return -EOPNOTSUPP; 3298 return -EOPNOTSUPP;
3299 3299
3300 switch (key->alg) { 3300 switch (key->cipher) {
3301 case ALG_WEP: 3301 case WLAN_CIPHER_SUITE_WEP40:
3302 case ALG_TKIP: 3302 case WLAN_CIPHER_SUITE_WEP104:
3303 case WLAN_CIPHER_SUITE_TKIP:
3303 break; 3304 break;
3304 case ALG_CCMP: 3305 case WLAN_CIPHER_SUITE_CCMP:
3305 if (sc->ah->ah_aes_support) 3306 if (sc->ah->ah_aes_support)
3306 break; 3307 break;
3307 3308
diff --git a/drivers/net/wireless/ath/ath5k/pcu.c b/drivers/net/wireless/ath/ath5k/pcu.c
index 86fdb6ddfaaa..af273358c7cb 100644
--- a/drivers/net/wireless/ath/ath5k/pcu.c
+++ b/drivers/net/wireless/ath/ath5k/pcu.c
@@ -695,21 +695,18 @@ int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
695static 695static
696int ath5k_keycache_type(const struct ieee80211_key_conf *key) 696int ath5k_keycache_type(const struct ieee80211_key_conf *key)
697{ 697{
698 switch (key->alg) { 698 switch (key->cipher) {
699 case ALG_TKIP: 699 case WLAN_CIPHER_SUITE_TKIP:
700 return AR5K_KEYTABLE_TYPE_TKIP; 700 return AR5K_KEYTABLE_TYPE_TKIP;
701 case ALG_CCMP: 701 case WLAN_CIPHER_SUITE_CCMP:
702 return AR5K_KEYTABLE_TYPE_CCM; 702 return AR5K_KEYTABLE_TYPE_CCM;
703 case ALG_WEP: 703 case WLAN_CIPHER_SUITE_WEP40:
704 if (key->keylen == WLAN_KEY_LEN_WEP40) 704 return AR5K_KEYTABLE_TYPE_40;
705 return AR5K_KEYTABLE_TYPE_40; 705 case WLAN_CIPHER_SUITE_WEP104:
706 else if (key->keylen == WLAN_KEY_LEN_WEP104) 706 return AR5K_KEYTABLE_TYPE_104;
707 return AR5K_KEYTABLE_TYPE_104;
708 return -EINVAL;
709 default: 707 default:
710 return -EINVAL; 708 return -EINVAL;
711 } 709 }
712 return -EINVAL;
713} 710}
714 711
715/* 712/*
@@ -728,7 +725,7 @@ int ath5k_hw_set_key(struct ath5k_hw *ah, u16 entry,
728 bool is_tkip; 725 bool is_tkip;
729 const u8 *key_ptr; 726 const u8 *key_ptr;
730 727
731 is_tkip = (key->alg == ALG_TKIP); 728 is_tkip = (key->cipher == WLAN_CIPHER_SUITE_TKIP);
732 729
733 /* 730 /*
734 * key->keylen comes in from mac80211 in bytes. 731 * key->keylen comes in from mac80211 in bytes.
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c
index c86f7d3593ab..3100c87a4fcd 100644
--- a/drivers/net/wireless/ath/ath9k/common.c
+++ b/drivers/net/wireless/ath/ath9k/common.c
@@ -46,12 +46,17 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
46 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); 46 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
47 47
48 if (tx_info->control.hw_key) { 48 if (tx_info->control.hw_key) {
49 if (tx_info->control.hw_key->alg == ALG_WEP) 49 switch (tx_info->control.hw_key->cipher) {
50 case WLAN_CIPHER_SUITE_WEP40:
51 case WLAN_CIPHER_SUITE_WEP104:
50 return ATH9K_KEY_TYPE_WEP; 52 return ATH9K_KEY_TYPE_WEP;
51 else if (tx_info->control.hw_key->alg == ALG_TKIP) 53 case WLAN_CIPHER_SUITE_TKIP:
52 return ATH9K_KEY_TYPE_TKIP; 54 return ATH9K_KEY_TYPE_TKIP;
53 else if (tx_info->control.hw_key->alg == ALG_CCMP) 55 case WLAN_CIPHER_SUITE_CCMP:
54 return ATH9K_KEY_TYPE_AES; 56 return ATH9K_KEY_TYPE_AES;
57 default:
58 break;
59 }
55 } 60 }
56 61
57 return ATH9K_KEY_TYPE_CLEAR; 62 return ATH9K_KEY_TYPE_CLEAR;
@@ -212,11 +217,11 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_common *common)
212} 217}
213 218
214static int ath_reserve_key_cache_slot(struct ath_common *common, 219static int ath_reserve_key_cache_slot(struct ath_common *common,
215 enum ieee80211_key_alg alg) 220 u32 cipher)
216{ 221{
217 int i; 222 int i;
218 223
219 if (alg == ALG_TKIP) 224 if (cipher == WLAN_CIPHER_SUITE_TKIP)
220 return ath_reserve_key_cache_slot_tkip(common); 225 return ath_reserve_key_cache_slot_tkip(common);
221 226
222 /* First, try to find slots that would not be available for TKIP. */ 227 /* First, try to find slots that would not be available for TKIP. */
@@ -293,14 +298,15 @@ int ath9k_cmn_key_config(struct ath_common *common,
293 298
294 memset(&hk, 0, sizeof(hk)); 299 memset(&hk, 0, sizeof(hk));
295 300
296 switch (key->alg) { 301 switch (key->cipher) {
297 case ALG_WEP: 302 case WLAN_CIPHER_SUITE_WEP40:
303 case WLAN_CIPHER_SUITE_WEP104:
298 hk.kv_type = ATH9K_CIPHER_WEP; 304 hk.kv_type = ATH9K_CIPHER_WEP;
299 break; 305 break;
300 case ALG_TKIP: 306 case WLAN_CIPHER_SUITE_TKIP:
301 hk.kv_type = ATH9K_CIPHER_TKIP; 307 hk.kv_type = ATH9K_CIPHER_TKIP;
302 break; 308 break;
303 case ALG_CCMP: 309 case WLAN_CIPHER_SUITE_CCMP:
304 hk.kv_type = ATH9K_CIPHER_AES_CCM; 310 hk.kv_type = ATH9K_CIPHER_AES_CCM;
305 break; 311 break;
306 default: 312 default:
@@ -316,7 +322,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
316 memcpy(gmac, vif->addr, ETH_ALEN); 322 memcpy(gmac, vif->addr, ETH_ALEN);
317 gmac[0] |= 0x01; 323 gmac[0] |= 0x01;
318 mac = gmac; 324 mac = gmac;
319 idx = ath_reserve_key_cache_slot(common, key->alg); 325 idx = ath_reserve_key_cache_slot(common, key->cipher);
320 break; 326 break;
321 case NL80211_IFTYPE_ADHOC: 327 case NL80211_IFTYPE_ADHOC:
322 if (!sta) { 328 if (!sta) {
@@ -326,7 +332,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
326 memcpy(gmac, sta->addr, ETH_ALEN); 332 memcpy(gmac, sta->addr, ETH_ALEN);
327 gmac[0] |= 0x01; 333 gmac[0] |= 0x01;
328 mac = gmac; 334 mac = gmac;
329 idx = ath_reserve_key_cache_slot(common, key->alg); 335 idx = ath_reserve_key_cache_slot(common, key->cipher);
330 break; 336 break;
331 default: 337 default:
332 idx = key->keyidx; 338 idx = key->keyidx;
@@ -348,13 +354,13 @@ int ath9k_cmn_key_config(struct ath_common *common,
348 return -EOPNOTSUPP; 354 return -EOPNOTSUPP;
349 mac = sta->addr; 355 mac = sta->addr;
350 356
351 idx = ath_reserve_key_cache_slot(common, key->alg); 357 idx = ath_reserve_key_cache_slot(common, key->cipher);
352 } 358 }
353 359
354 if (idx < 0) 360 if (idx < 0)
355 return -ENOSPC; /* no free key cache entries */ 361 return -ENOSPC; /* no free key cache entries */
356 362
357 if (key->alg == ALG_TKIP) 363 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
358 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac, 364 ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
359 vif->type == NL80211_IFTYPE_AP); 365 vif->type == NL80211_IFTYPE_AP);
360 else 366 else
@@ -364,7 +370,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
364 return -EIO; 370 return -EIO;
365 371
366 set_bit(idx, common->keymap); 372 set_bit(idx, common->keymap);
367 if (key->alg == ALG_TKIP) { 373 if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
368 set_bit(idx + 64, common->keymap); 374 set_bit(idx + 64, common->keymap);
369 if (common->splitmic) { 375 if (common->splitmic) {
370 set_bit(idx + 32, common->keymap); 376 set_bit(idx + 32, common->keymap);
@@ -389,7 +395,7 @@ void ath9k_cmn_key_delete(struct ath_common *common,
389 return; 395 return;
390 396
391 clear_bit(key->hw_key_idx, common->keymap); 397 clear_bit(key->hw_key_idx, common->keymap);
392 if (key->alg != ALG_TKIP) 398 if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
393 return; 399 return;
394 400
395 clear_bit(key->hw_key_idx + 64, common->keymap); 401 clear_bit(key->hw_key_idx + 64, common->keymap);
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 7d09b4b17bbd..4e345be62435 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1585,9 +1585,10 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
1585 key->hw_key_idx = ret; 1585 key->hw_key_idx = ret;
1586 /* push IV and Michael MIC generation to stack */ 1586 /* push IV and Michael MIC generation to stack */
1587 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 1587 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1588 if (key->alg == ALG_TKIP) 1588 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
1589 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 1589 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1590 if (priv->ah->sw_mgmt_crypto && key->alg == ALG_CCMP) 1590 if (priv->ah->sw_mgmt_crypto &&
1591 key->cipher == WLAN_CIPHER_SUITE_CCMP)
1591 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT; 1592 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
1592 ret = 0; 1593 ret = 0;
1593 } 1594 }
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index a3b0ea90439d..1165f909ef04 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1782,9 +1782,10 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
1782 key->hw_key_idx = ret; 1782 key->hw_key_idx = ret;
1783 /* push IV and Michael MIC generation to stack */ 1783 /* push IV and Michael MIC generation to stack */
1784 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 1784 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
1785 if (key->alg == ALG_TKIP) 1785 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
1786 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; 1786 key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
1787 if (sc->sc_ah->sw_mgmt_crypto && key->alg == ALG_CCMP) 1787 if (sc->sc_ah->sw_mgmt_crypto &&
1788 key->cipher == WLAN_CIPHER_SUITE_CCMP)
1788 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT; 1789 key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
1789 ret = 0; 1790 ret = 0;
1790 } 1791 }
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index a3e2f2bfe3a7..a1186525c70d 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -3759,17 +3759,17 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3759 } 3759 }
3760 3760
3761 err = -EINVAL; 3761 err = -EINVAL;
3762 switch (key->alg) { 3762 switch (key->cipher) {
3763 case ALG_WEP: 3763 case WLAN_CIPHER_SUITE_WEP40:
3764 if (key->keylen == WLAN_KEY_LEN_WEP40) 3764 algorithm = B43_SEC_ALGO_WEP40;
3765 algorithm = B43_SEC_ALGO_WEP40; 3765 break;
3766 else 3766 case WLAN_CIPHER_SUITE_WEP104:
3767 algorithm = B43_SEC_ALGO_WEP104; 3767 algorithm = B43_SEC_ALGO_WEP104;
3768 break; 3768 break;
3769 case ALG_TKIP: 3769 case WLAN_CIPHER_SUITE_TKIP:
3770 algorithm = B43_SEC_ALGO_TKIP; 3770 algorithm = B43_SEC_ALGO_TKIP;
3771 break; 3771 break;
3772 case ALG_CCMP: 3772 case WLAN_CIPHER_SUITE_CCMP:
3773 algorithm = B43_SEC_ALGO_AES; 3773 algorithm = B43_SEC_ALGO_AES;
3774 break; 3774 break;
3775 default: 3775 default:
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
index 69155aa448fb..3fc982e87921 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
@@ -470,8 +470,8 @@ static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
470{ 470{
471 struct ieee80211_key_conf *keyconf = info->control.hw_key; 471 struct ieee80211_key_conf *keyconf = info->control.hw_key;
472 472
473 switch (keyconf->alg) { 473 switch (keyconf->cipher) {
474 case ALG_CCMP: 474 case WLAN_CIPHER_SUITE_CCMP:
475 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 475 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
476 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen); 476 memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
477 if (info->flags & IEEE80211_TX_CTL_AMPDU) 477 if (info->flags & IEEE80211_TX_CTL_AMPDU)
@@ -479,20 +479,20 @@ static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
479 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 479 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
480 break; 480 break;
481 481
482 case ALG_TKIP: 482 case WLAN_CIPHER_SUITE_TKIP:
483 tx_cmd->sec_ctl = TX_CMD_SEC_TKIP; 483 tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
484 ieee80211_get_tkip_key(keyconf, skb_frag, 484 ieee80211_get_tkip_key(keyconf, skb_frag,
485 IEEE80211_TKIP_P2_KEY, tx_cmd->key); 485 IEEE80211_TKIP_P2_KEY, tx_cmd->key);
486 IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n"); 486 IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n");
487 break; 487 break;
488 488
489 case ALG_WEP: 489 case WLAN_CIPHER_SUITE_WEP104:
490 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
491 /* fall through */
492 case WLAN_CIPHER_SUITE_WEP40:
490 tx_cmd->sec_ctl |= (TX_CMD_SEC_WEP | 493 tx_cmd->sec_ctl |= (TX_CMD_SEC_WEP |
491 (keyconf->keyidx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT); 494 (keyconf->keyidx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT);
492 495
493 if (keyconf->keylen == WEP_KEY_LEN_128)
494 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
495
496 memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen); 496 memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);
497 497
498 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 498 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
@@ -500,7 +500,7 @@ static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
500 break; 500 break;
501 501
502 default: 502 default:
503 IWL_ERR(priv, "Unknown encode alg %d\n", keyconf->alg); 503 IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher);
504 break; 504 break;
505 } 505 }
506} 506}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 43e078b87378..21a52ae05c0d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -3389,7 +3389,9 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
3389 * in 1X mode. 3389 * in 1X mode.
3390 * In legacy wep mode, we use another host command to the uCode. 3390 * In legacy wep mode, we use another host command to the uCode.
3391 */ 3391 */
3392 if (key->alg == ALG_WEP && !sta && vif->type != NL80211_IFTYPE_AP) { 3392 if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
3393 key->cipher == WLAN_CIPHER_SUITE_WEP104) &&
3394 !sta && vif->type != NL80211_IFTYPE_AP) {
3393 if (cmd == SET_KEY) 3395 if (cmd == SET_KEY)
3394 is_default_wep_key = !priv->key_mapping_key; 3396 is_default_wep_key = !priv->key_mapping_key;
3395 else 3397 else
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 599635547021..149619fb1c07 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -420,7 +420,7 @@ struct iwl_tid_data {
420}; 420};
421 421
422struct iwl_hw_key { 422struct iwl_hw_key {
423 enum ieee80211_key_alg alg; 423 u32 cipher;
424 int keylen; 424 int keylen;
425 u8 keyidx; 425 u8 keyidx;
426 u8 key[32]; 426 u8 key[32];
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 7e0829be5e78..d5e8db37b86e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -818,7 +818,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
818 818
819 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV; 819 keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
820 keyconf->hw_key_idx = HW_KEY_DEFAULT; 820 keyconf->hw_key_idx = HW_KEY_DEFAULT;
821 priv->stations[IWL_AP_ID].keyinfo.alg = ALG_WEP; 821 priv->stations[IWL_AP_ID].keyinfo.cipher = keyconf->cipher;
822 822
823 priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen; 823 priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
824 memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key, 824 memcpy(&priv->wep_keys[keyconf->keyidx].key, &keyconf->key,
@@ -856,7 +856,7 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
856 856
857 spin_lock_irqsave(&priv->sta_lock, flags); 857 spin_lock_irqsave(&priv->sta_lock, flags);
858 858
859 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 859 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
860 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 860 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
861 priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx; 861 priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
862 862
@@ -906,7 +906,7 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
906 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 906 keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
907 907
908 spin_lock_irqsave(&priv->sta_lock, flags); 908 spin_lock_irqsave(&priv->sta_lock, flags);
909 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 909 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
910 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 910 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
911 911
912 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 912 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
@@ -955,7 +955,7 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
955 955
956 spin_lock_irqsave(&priv->sta_lock, flags); 956 spin_lock_irqsave(&priv->sta_lock, flags);
957 957
958 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 958 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
959 priv->stations[sta_id].keyinfo.keylen = 16; 959 priv->stations[sta_id].keyinfo.keylen = 16;
960 960
961 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK) 961 if ((priv->stations[sta_id].sta.key.key_flags & STA_KEY_FLG_ENCRYPT_MSK)
@@ -1090,24 +1090,26 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
1090 priv->key_mapping_key++; 1090 priv->key_mapping_key++;
1091 keyconf->hw_key_idx = HW_KEY_DYNAMIC; 1091 keyconf->hw_key_idx = HW_KEY_DYNAMIC;
1092 1092
1093 switch (keyconf->alg) { 1093 switch (keyconf->cipher) {
1094 case ALG_CCMP: 1094 case WLAN_CIPHER_SUITE_CCMP:
1095 ret = iwl_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 1095 ret = iwl_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
1096 break; 1096 break;
1097 case ALG_TKIP: 1097 case WLAN_CIPHER_SUITE_TKIP:
1098 ret = iwl_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 1098 ret = iwl_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
1099 break; 1099 break;
1100 case ALG_WEP: 1100 case WLAN_CIPHER_SUITE_WEP40:
1101 case WLAN_CIPHER_SUITE_WEP104:
1101 ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id); 1102 ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id);
1102 break; 1103 break;
1103 default: 1104 default:
1104 IWL_ERR(priv, 1105 IWL_ERR(priv,
1105 "Unknown alg: %s alg = %d\n", __func__, keyconf->alg); 1106 "Unknown alg: %s cipher = %x\n", __func__,
1107 keyconf->cipher);
1106 ret = -EINVAL; 1108 ret = -EINVAL;
1107 } 1109 }
1108 1110
1109 IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n", 1111 IWL_DEBUG_WEP(priv, "Set dynamic key: cipher=%x len=%d idx=%d sta=%d ret=%d\n",
1110 keyconf->alg, keyconf->keylen, keyconf->keyidx, 1112 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
1111 sta_id, ret); 1113 sta_id, ret);
1112 1114
1113 return ret; 1115 return ret;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index b14eaf91c7c2..faa2e0037e10 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -152,7 +152,7 @@ static int iwl3945_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
152 key_flags &= ~STA_KEY_FLG_INVALID; 152 key_flags &= ~STA_KEY_FLG_INVALID;
153 153
154 spin_lock_irqsave(&priv->sta_lock, flags); 154 spin_lock_irqsave(&priv->sta_lock, flags);
155 priv->stations[sta_id].keyinfo.alg = keyconf->alg; 155 priv->stations[sta_id].keyinfo.cipher = keyconf->cipher;
156 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen; 156 priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
157 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 157 memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
158 keyconf->keylen); 158 keyconf->keylen);
@@ -223,23 +223,25 @@ static int iwl3945_set_dynamic_key(struct iwl_priv *priv,
223 223
224 keyconf->hw_key_idx = HW_KEY_DYNAMIC; 224 keyconf->hw_key_idx = HW_KEY_DYNAMIC;
225 225
226 switch (keyconf->alg) { 226 switch (keyconf->cipher) {
227 case ALG_CCMP: 227 case WLAN_CIPHER_SUITE_CCMP:
228 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id); 228 ret = iwl3945_set_ccmp_dynamic_key_info(priv, keyconf, sta_id);
229 break; 229 break;
230 case ALG_TKIP: 230 case WLAN_CIPHER_SUITE_TKIP:
231 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id); 231 ret = iwl3945_set_tkip_dynamic_key_info(priv, keyconf, sta_id);
232 break; 232 break;
233 case ALG_WEP: 233 case WLAN_CIPHER_SUITE_WEP40:
234 case WLAN_CIPHER_SUITE_WEP104:
234 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id); 235 ret = iwl3945_set_wep_dynamic_key_info(priv, keyconf, sta_id);
235 break; 236 break;
236 default: 237 default:
237 IWL_ERR(priv, "Unknown alg: %s alg = %d\n", __func__, keyconf->alg); 238 IWL_ERR(priv, "Unknown alg: %s alg=%x\n", __func__,
239 keyconf->cipher);
238 ret = -EINVAL; 240 ret = -EINVAL;
239 } 241 }
240 242
241 IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n", 243 IWL_DEBUG_WEP(priv, "Set dynamic key: alg=%x len=%d idx=%d sta=%d ret=%d\n",
242 keyconf->alg, keyconf->keylen, keyconf->keyidx, 244 keyconf->cipher, keyconf->keylen, keyconf->keyidx,
243 sta_id, ret); 245 sta_id, ret);
244 246
245 return ret; 247 return ret;
@@ -255,10 +257,11 @@ static int iwl3945_remove_static_key(struct iwl_priv *priv)
255static int iwl3945_set_static_key(struct iwl_priv *priv, 257static int iwl3945_set_static_key(struct iwl_priv *priv,
256 struct ieee80211_key_conf *key) 258 struct ieee80211_key_conf *key)
257{ 259{
258 if (key->alg == ALG_WEP) 260 if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
261 key->cipher == WLAN_CIPHER_SUITE_WEP104)
259 return -EOPNOTSUPP; 262 return -EOPNOTSUPP;
260 263
261 IWL_ERR(priv, "Static key invalid: alg %d\n", key->alg); 264 IWL_ERR(priv, "Static key invalid: cipher %x\n", key->cipher);
262 return -EINVAL; 265 return -EINVAL;
263} 266}
264 267
@@ -370,23 +373,25 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
370 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload; 373 struct iwl3945_tx_cmd *tx_cmd = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
371 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo; 374 struct iwl_hw_key *keyinfo = &priv->stations[sta_id].keyinfo;
372 375
373 switch (keyinfo->alg) { 376 tx_cmd->sec_ctl = 0;
374 case ALG_CCMP: 377
378 switch (keyinfo->cipher) {
379 case WLAN_CIPHER_SUITE_CCMP:
375 tx_cmd->sec_ctl = TX_CMD_SEC_CCM; 380 tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
376 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen); 381 memcpy(tx_cmd->key, keyinfo->key, keyinfo->keylen);
377 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n"); 382 IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
378 break; 383 break;
379 384
380 case ALG_TKIP: 385 case WLAN_CIPHER_SUITE_TKIP:
381 break; 386 break;
382 387
383 case ALG_WEP: 388 case WLAN_CIPHER_SUITE_WEP104:
384 tx_cmd->sec_ctl = TX_CMD_SEC_WEP | 389 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
390 /* fall through */
391 case WLAN_CIPHER_SUITE_WEP40:
392 tx_cmd->sec_ctl |= TX_CMD_SEC_WEP |
385 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT; 393 (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
386 394
387 if (keyinfo->keylen == 13)
388 tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
389
390 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen); 395 memcpy(&tx_cmd->key[3], keyinfo->key, keyinfo->keylen);
391 396
392 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption " 397 IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
@@ -394,7 +399,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
394 break; 399 break;
395 400
396 default: 401 default:
397 IWL_ERR(priv, "Unknown encode alg %d\n", keyinfo->alg); 402 IWL_ERR(priv, "Unknown encode cipher %x\n", keyinfo->cipher);
398 break; 403 break;
399 } 404 }
400} 405}
diff --git a/drivers/net/wireless/p54/main.c b/drivers/net/wireless/p54/main.c
index 47db439b63bf..622d27b6d8f2 100644
--- a/drivers/net/wireless/p54/main.c
+++ b/drivers/net/wireless/p54/main.c
@@ -429,8 +429,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
429 429
430 mutex_lock(&priv->conf_mutex); 430 mutex_lock(&priv->conf_mutex);
431 if (cmd == SET_KEY) { 431 if (cmd == SET_KEY) {
432 switch (key->alg) { 432 switch (key->cipher) {
433 case ALG_TKIP: 433 case WLAN_CIPHER_SUITE_TKIP:
434 if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL | 434 if (!(priv->privacy_caps & (BR_DESC_PRIV_CAP_MICHAEL |
435 BR_DESC_PRIV_CAP_TKIP))) { 435 BR_DESC_PRIV_CAP_TKIP))) {
436 ret = -EOPNOTSUPP; 436 ret = -EOPNOTSUPP;
@@ -439,7 +439,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
439 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 439 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
440 algo = P54_CRYPTO_TKIPMICHAEL; 440 algo = P54_CRYPTO_TKIPMICHAEL;
441 break; 441 break;
442 case ALG_WEP: 442 case WLAN_CIPHER_SUITE_WEP40:
443 case WLAN_CIPHER_SUITE_WEP104:
443 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) { 444 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_WEP)) {
444 ret = -EOPNOTSUPP; 445 ret = -EOPNOTSUPP;
445 goto out_unlock; 446 goto out_unlock;
@@ -447,7 +448,7 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
447 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 448 key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
448 algo = P54_CRYPTO_WEP; 449 algo = P54_CRYPTO_WEP;
449 break; 450 break;
450 case ALG_CCMP: 451 case WLAN_CIPHER_SUITE_CCMP:
451 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) { 452 if (!(priv->privacy_caps & BR_DESC_PRIV_CAP_AESCCMP)) {
452 ret = -EOPNOTSUPP; 453 ret = -EOPNOTSUPP;
453 goto out_unlock; 454 goto out_unlock;
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c
index 427b46f558ed..e53f8cec7798 100644
--- a/drivers/net/wireless/p54/txrx.c
+++ b/drivers/net/wireless/p54/txrx.c
@@ -683,14 +683,15 @@ static void p54_tx_80211_header(struct p54_common *priv, struct sk_buff *skb,
683 } 683 }
684} 684}
685 685
686static u8 p54_convert_algo(enum ieee80211_key_alg alg) 686static u8 p54_convert_algo(u32 cipher)
687{ 687{
688 switch (alg) { 688 switch (cipher) {
689 case ALG_WEP: 689 case WLAN_CIPHER_SUITE_WEP40:
690 case WLAN_CIPHER_SUITE_WEP104:
690 return P54_CRYPTO_WEP; 691 return P54_CRYPTO_WEP;
691 case ALG_TKIP: 692 case WLAN_CIPHER_SUITE_TKIP:
692 return P54_CRYPTO_TKIPMICHAEL; 693 return P54_CRYPTO_TKIPMICHAEL;
693 case ALG_CCMP: 694 case WLAN_CIPHER_SUITE_CCMP:
694 return P54_CRYPTO_AESCCMP; 695 return P54_CRYPTO_AESCCMP;
695 default: 696 default:
696 return 0; 697 return 0;
@@ -731,7 +732,7 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
731 732
732 if (info->control.hw_key) { 733 if (info->control.hw_key) {
733 crypt_offset = ieee80211_get_hdrlen_from_skb(skb); 734 crypt_offset = ieee80211_get_hdrlen_from_skb(skb);
734 if (info->control.hw_key->alg == ALG_TKIP) { 735 if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
735 u8 *iv = (u8 *)(skb->data + crypt_offset); 736 u8 *iv = (u8 *)(skb->data + crypt_offset);
736 /* 737 /*
737 * The firmware excepts that the IV has to have 738 * The firmware excepts that the IV has to have
@@ -827,10 +828,10 @@ int p54_tx_80211(struct ieee80211_hw *dev, struct sk_buff *skb)
827 hdr->tries = ridx; 828 hdr->tries = ridx;
828 txhdr->rts_rate_idx = 0; 829 txhdr->rts_rate_idx = 0;
829 if (info->control.hw_key) { 830 if (info->control.hw_key) {
830 txhdr->key_type = p54_convert_algo(info->control.hw_key->alg); 831 txhdr->key_type = p54_convert_algo(info->control.hw_key->cipher);
831 txhdr->key_len = min((u8)16, info->control.hw_key->keylen); 832 txhdr->key_len = min((u8)16, info->control.hw_key->keylen);
832 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len); 833 memcpy(txhdr->key, info->control.hw_key->key, txhdr->key_len);
833 if (info->control.hw_key->alg == ALG_TKIP) { 834 if (info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
834 /* reserve space for the MIC key */ 835 /* reserve space for the MIC key */
835 len += 8; 836 len += 8;
836 memcpy(skb_put(skb, 8), &(info->control.hw_key->key 837 memcpy(skb_put(skb, 8), &(info->control.hw_key->key
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index cdaf93f48263..97cf72f8bc12 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -355,7 +355,9 @@ static int rt2500usb_config_key(struct rt2x00_dev *rt2x00dev,
355 * it is known that not work at least on some hardware. 355 * it is known that not work at least on some hardware.
356 * SW crypto will be used in that case. 356 * SW crypto will be used in that case.
357 */ 357 */
358 if (key->alg == ALG_WEP && key->keyidx != 0) 358 if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
359 key->cipher == WLAN_CIPHER_SUITE_WEP104) &&
360 key->keyidx != 0)
359 return -EOPNOTSUPP; 361 return -EOPNOTSUPP;
360 362
361 /* 363 /*
diff --git a/drivers/net/wireless/rt2x00/rt2x00crypto.c b/drivers/net/wireless/rt2x00/rt2x00crypto.c
index 583dacd8d241..5e9074bf2b8e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00crypto.c
+++ b/drivers/net/wireless/rt2x00/rt2x00crypto.c
@@ -31,15 +31,14 @@
31 31
32enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key) 32enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key)
33{ 33{
34 switch (key->alg) { 34 switch (key->cipher) {
35 case ALG_WEP: 35 case WLAN_CIPHER_SUITE_WEP40:
36 if (key->keylen == WLAN_KEY_LEN_WEP40) 36 return CIPHER_WEP64;
37 return CIPHER_WEP64; 37 case WLAN_CIPHER_SUITE_WEP104:
38 else 38 return CIPHER_WEP128;
39 return CIPHER_WEP128; 39 case WLAN_CIPHER_SUITE_TKIP:
40 case ALG_TKIP:
41 return CIPHER_TKIP; 40 return CIPHER_TKIP;
42 case ALG_CCMP: 41 case WLAN_CIPHER_SUITE_CCMP:
43 return CIPHER_AES; 42 return CIPHER_AES;
44 default: 43 default:
45 return CIPHER_NONE; 44 return CIPHER_NONE;
@@ -95,7 +94,7 @@ unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
95 overhead += key->iv_len; 94 overhead += key->iv_len;
96 95
97 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) { 96 if (!(key->flags & IEEE80211_KEY_FLAG_GENERATE_MMIC)) {
98 if (key->alg == ALG_TKIP) 97 if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
99 overhead += 8; 98 overhead += 8;
100 } 99 }
101 100
diff --git a/drivers/net/wireless/wl12xx/wl1251_main.c b/drivers/net/wireless/wl12xx/wl1251_main.c
index 861a5f33761e..6d31c855fcfe 100644
--- a/drivers/net/wireless/wl12xx/wl1251_main.c
+++ b/drivers/net/wireless/wl12xx/wl1251_main.c
@@ -725,8 +725,9 @@ static int wl1251_set_key_type(struct wl1251 *wl,
725 struct ieee80211_key_conf *mac80211_key, 725 struct ieee80211_key_conf *mac80211_key,
726 const u8 *addr) 726 const u8 *addr)
727{ 727{
728 switch (mac80211_key->alg) { 728 switch (mac80211_key->cipher) {
729 case ALG_WEP: 729 case WLAN_CIPHER_SUITE_WEP40:
730 case WLAN_CIPHER_SUITE_WEP104:
730 if (is_broadcast_ether_addr(addr)) 731 if (is_broadcast_ether_addr(addr))
731 key->key_type = KEY_WEP_DEFAULT; 732 key->key_type = KEY_WEP_DEFAULT;
732 else 733 else
@@ -734,7 +735,7 @@ static int wl1251_set_key_type(struct wl1251 *wl,
734 735
735 mac80211_key->hw_key_idx = mac80211_key->keyidx; 736 mac80211_key->hw_key_idx = mac80211_key->keyidx;
736 break; 737 break;
737 case ALG_TKIP: 738 case WLAN_CIPHER_SUITE_TKIP:
738 if (is_broadcast_ether_addr(addr)) 739 if (is_broadcast_ether_addr(addr))
739 key->key_type = KEY_TKIP_MIC_GROUP; 740 key->key_type = KEY_TKIP_MIC_GROUP;
740 else 741 else
@@ -742,7 +743,7 @@ static int wl1251_set_key_type(struct wl1251 *wl,
742 743
743 mac80211_key->hw_key_idx = mac80211_key->keyidx; 744 mac80211_key->hw_key_idx = mac80211_key->keyidx;
744 break; 745 break;
745 case ALG_CCMP: 746 case WLAN_CIPHER_SUITE_CCMP:
746 if (is_broadcast_ether_addr(addr)) 747 if (is_broadcast_ether_addr(addr))
747 key->key_type = KEY_AES_GROUP; 748 key->key_type = KEY_AES_GROUP;
748 else 749 else
@@ -750,7 +751,7 @@ static int wl1251_set_key_type(struct wl1251 *wl,
750 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 751 mac80211_key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
751 break; 752 break;
752 default: 753 default:
753 wl1251_error("Unknown key algo 0x%x", mac80211_key->alg); 754 wl1251_error("Unknown key cipher 0x%x", mac80211_key->cipher);
754 return -EOPNOTSUPP; 755 return -EOPNOTSUPP;
755 } 756 }
756 757
@@ -783,7 +784,7 @@ static int wl1251_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
783 wl1251_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd); 784 wl1251_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd);
784 wl1251_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN); 785 wl1251_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN);
785 wl1251_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", 786 wl1251_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x",
786 key->alg, key->keyidx, key->keylen, key->flags); 787 key->cipher, key->keyidx, key->keylen, key->flags);
787 wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen); 788 wl1251_dump(DEBUG_CRYPT, "KEY: ", key->key, key->keylen);
788 789
789 if (is_zero_ether_addr(addr)) { 790 if (is_zero_ether_addr(addr)) {
diff --git a/drivers/net/wireless/wl12xx/wl1251_tx.c b/drivers/net/wireless/wl12xx/wl1251_tx.c
index a38ec199187a..6634b3e27cfc 100644
--- a/drivers/net/wireless/wl12xx/wl1251_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1251_tx.c
@@ -189,7 +189,7 @@ static int wl1251_tx_send_packet(struct wl1251 *wl, struct sk_buff *skb,
189 tx_hdr = (struct tx_double_buffer_desc *) skb->data; 189 tx_hdr = (struct tx_double_buffer_desc *) skb->data;
190 190
191 if (control->control.hw_key && 191 if (control->control.hw_key &&
192 control->control.hw_key->alg == ALG_TKIP) { 192 control->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
193 int hdrlen; 193 int hdrlen;
194 __le16 fc; 194 __le16 fc;
195 u16 length; 195 u16 length;
@@ -399,7 +399,7 @@ static void wl1251_tx_packet_cb(struct wl1251 *wl,
399 */ 399 */
400 frame = skb_pull(skb, sizeof(struct tx_double_buffer_desc)); 400 frame = skb_pull(skb, sizeof(struct tx_double_buffer_desc));
401 if (info->control.hw_key && 401 if (info->control.hw_key &&
402 info->control.hw_key->alg == ALG_TKIP) { 402 info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
403 hdrlen = ieee80211_get_hdrlen_from_skb(skb); 403 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
404 memmove(frame + WL1251_TKIP_IV_SPACE, frame, hdrlen); 404 memmove(frame + WL1251_TKIP_IV_SPACE, frame, hdrlen);
405 skb_pull(skb, WL1251_TKIP_IV_SPACE); 405 skb_pull(skb, WL1251_TKIP_IV_SPACE);
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index 9d68f0012f05..30194c0f36a9 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -1439,7 +1439,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1439 wl1271_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd); 1439 wl1271_debug(DEBUG_CRYPT, "CMD: 0x%x", cmd);
1440 wl1271_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN); 1440 wl1271_dump(DEBUG_CRYPT, "ADDR: ", addr, ETH_ALEN);
1441 wl1271_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x", 1441 wl1271_debug(DEBUG_CRYPT, "Key: algo:0x%x, id:%d, len:%d flags 0x%x",
1442 key_conf->alg, key_conf->keyidx, 1442 key_conf->cipher, key_conf->keyidx,
1443 key_conf->keylen, key_conf->flags); 1443 key_conf->keylen, key_conf->flags);
1444 wl1271_dump(DEBUG_CRYPT, "KEY: ", key_conf->key, key_conf->keylen); 1444 wl1271_dump(DEBUG_CRYPT, "KEY: ", key_conf->key, key_conf->keylen);
1445 1445
@@ -1455,20 +1455,21 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1455 if (ret < 0) 1455 if (ret < 0)
1456 goto out_unlock; 1456 goto out_unlock;
1457 1457
1458 switch (key_conf->alg) { 1458 switch (key_conf->cipher) {
1459 case ALG_WEP: 1459 case WLAN_CIPHER_SUITE_WEP40:
1460 case WLAN_CIPHER_SUITE_WEP104:
1460 key_type = KEY_WEP; 1461 key_type = KEY_WEP;
1461 1462
1462 key_conf->hw_key_idx = key_conf->keyidx; 1463 key_conf->hw_key_idx = key_conf->keyidx;
1463 break; 1464 break;
1464 case ALG_TKIP: 1465 case WLAN_CIPHER_SUITE_TKIP:
1465 key_type = KEY_TKIP; 1466 key_type = KEY_TKIP;
1466 1467
1467 key_conf->hw_key_idx = key_conf->keyidx; 1468 key_conf->hw_key_idx = key_conf->keyidx;
1468 tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq); 1469 tx_seq_32 = WL1271_TX_SECURITY_HI32(wl->tx_security_seq);
1469 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq); 1470 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq);
1470 break; 1471 break;
1471 case ALG_CCMP: 1472 case WLAN_CIPHER_SUITE_CCMP:
1472 key_type = KEY_AES; 1473 key_type = KEY_AES;
1473 1474
1474 key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; 1475 key_conf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
@@ -1476,7 +1477,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1476 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq); 1477 tx_seq_16 = WL1271_TX_SECURITY_LO16(wl->tx_security_seq);
1477 break; 1478 break;
1478 default: 1479 default:
1479 wl1271_error("Unknown key algo 0x%x", key_conf->alg); 1480 wl1271_error("Unknown key algo 0x%x", key_conf->cipher);
1480 1481
1481 ret = -EOPNOTSUPP; 1482 ret = -EOPNOTSUPP;
1482 goto out_sleep; 1483 goto out_sleep;
diff --git a/drivers/net/wireless/wl12xx/wl1271_tx.c b/drivers/net/wireless/wl12xx/wl1271_tx.c
index c592cc2e9fe8..dc0b46c93c4b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_tx.c
+++ b/drivers/net/wireless/wl12xx/wl1271_tx.c
@@ -193,7 +193,7 @@ static int wl1271_tx_frame(struct wl1271 *wl, struct sk_buff *skb)
193 info = IEEE80211_SKB_CB(skb); 193 info = IEEE80211_SKB_CB(skb);
194 194
195 if (info->control.hw_key && 195 if (info->control.hw_key &&
196 info->control.hw_key->alg == ALG_TKIP) 196 info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP)
197 extra = WL1271_TKIP_IV_SPACE; 197 extra = WL1271_TKIP_IV_SPACE;
198 198
199 if (info->control.hw_key) { 199 if (info->control.hw_key) {
@@ -347,7 +347,7 @@ static void wl1271_tx_complete_packet(struct wl1271 *wl,
347 347
348 /* remove TKIP header space if present */ 348 /* remove TKIP header space if present */
349 if (info->control.hw_key && 349 if (info->control.hw_key &&
350 info->control.hw_key->alg == ALG_TKIP) { 350 info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) {
351 int hdrlen = ieee80211_get_hdrlen_from_skb(skb); 351 int hdrlen = ieee80211_get_hdrlen_from_skb(skb);
352 memmove(skb->data + WL1271_TKIP_IV_SPACE, skb->data, hdrlen); 352 memmove(skb->data + WL1271_TKIP_IV_SPACE, skb->data, hdrlen);
353 skb_pull(skb, WL1271_TKIP_IV_SPACE); 353 skb_pull(skb, WL1271_TKIP_IV_SPACE);