aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-26 11:53:17 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:54:18 -0400
commit628a140ba033ef201706a8c7e767c8a0c0f8326c (patch)
tree7aae1dbc152bf9180fee3d238f224c2f4b1741b5
parent640845a5632390eaa9357cd818646c8f0ee3d47e (diff)
[MAC80211]: remove ALG_NONE
This "algorithm" is used only internally and is not useful. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Cc: Michael Buesch <mb@bu3sch.de> Acked-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/wireless/b43/main.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c4
-rw-r--r--include/net/mac80211.h2
-rw-r--r--net/mac80211/ieee80211_ioctl.c19
-rw-r--r--net/mac80211/key.c1
-rw-r--r--net/mac80211/rx.c3
-rw-r--r--net/mac80211/tx.c2
8 files changed, 11 insertions, 27 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 6c80f2e2f4ee..c141a264ac45 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2827,9 +2827,6 @@ static int b43_dev_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
2827 if (!dev) 2827 if (!dev)
2828 return -ENODEV; 2828 return -ENODEV;
2829 switch (key->alg) { 2829 switch (key->alg) {
2830 case ALG_NONE:
2831 algorithm = B43_SEC_ALGO_NONE;
2832 break;
2833 case ALG_WEP: 2830 case ALG_WEP:
2834 if (key->keylen == 5) 2831 if (key->keylen == 5)
2835 algorithm = B43_SEC_ALGO_WEP40; 2832 algorithm = B43_SEC_ALGO_WEP40;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2cd7caa69e46..75e3b5c3f155 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2579,10 +2579,6 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2579 "with key %d\n", ctl->key_idx); 2579 "with key %d\n", ctl->key_idx);
2580 break; 2580 break;
2581 2581
2582 case ALG_NONE:
2583 IWL_DEBUG_TX("Tx packet in the clear (encrypt requested).\n");
2584 break;
2585
2586 default: 2582 default:
2587 printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg); 2583 printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg);
2588 break; 2584 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 5a8342664af1..b1a6e39f7821 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -2663,10 +2663,6 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
2663 "with key %d\n", ctl->key_idx); 2663 "with key %d\n", ctl->key_idx);
2664 break; 2664 break;
2665 2665
2666 case ALG_NONE:
2667 IWL_DEBUG_TX("Tx packet in the clear (encrypt requested).\n");
2668 break;
2669
2670 default: 2666 default:
2671 printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg); 2667 printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg);
2672 break; 2668 break;
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index c143ac8965db..1a2114b8d221 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -541,13 +541,11 @@ struct ieee80211_if_conf {
541 541
542/** 542/**
543 * enum ieee80211_key_alg - key algorithm 543 * enum ieee80211_key_alg - key algorithm
544 * @ALG_NONE: Unset key algorithm, will never be passed to the driver
545 * @ALG_WEP: WEP40 or WEP104 544 * @ALG_WEP: WEP40 or WEP104
546 * @ALG_TKIP: TKIP 545 * @ALG_TKIP: TKIP
547 * @ALG_CCMP: CCMP (AES) 546 * @ALG_CCMP: CCMP (AES)
548 */ 547 */
549enum ieee80211_key_alg { 548enum ieee80211_key_alg {
550 ALG_NONE,
551 ALG_WEP, 549 ALG_WEP,
552 ALG_TKIP, 550 ALG_TKIP,
553 ALG_CCMP, 551 ALG_CCMP,
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 48e68434b38a..6c8e73e0d29d 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -27,8 +27,9 @@
27 27
28 28
29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, 29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
30 int idx, int alg, int set_tx_key, 30 int idx, int alg, int remove,
31 const u8 *_key, size_t key_len) 31 int set_tx_key, const u8 *_key,
32 size_t key_len)
32{ 33{
33 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 34 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
34 int ret = 0; 35 int ret = 0;
@@ -75,7 +76,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
75 key = sta->key; 76 key = sta->key;
76 } 77 }
77 78
78 if (alg == ALG_NONE) { 79 if (remove) {
79 ieee80211_key_free(key); 80 ieee80211_key_free(key);
80 key = NULL; 81 key = NULL;
81 } else { 82 } else {
@@ -827,6 +828,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
827 struct ieee80211_sub_if_data *sdata; 828 struct ieee80211_sub_if_data *sdata;
828 int idx, i, alg = ALG_WEP; 829 int idx, i, alg = ALG_WEP;
829 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 830 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
831 int remove = 0;
830 832
831 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
832 834
@@ -845,7 +847,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
845 idx--; 847 idx--;
846 848
847 if (erq->flags & IW_ENCODE_DISABLED) 849 if (erq->flags & IW_ENCODE_DISABLED)
848 alg = ALG_NONE; 850 remove = 1;
849 else if (erq->length == 0) { 851 else if (erq->length == 0) {
850 /* No key data - just set the default TX key index */ 852 /* No key data - just set the default TX key index */
851 ieee80211_set_default_key(sdata, idx); 853 ieee80211_set_default_key(sdata, idx);
@@ -854,7 +856,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
854 856
855 return ieee80211_set_encryption( 857 return ieee80211_set_encryption(
856 dev, bcaddr, 858 dev, bcaddr,
857 idx, alg, 859 idx, alg, remove,
858 !sdata->default_key, 860 !sdata->default_key,
859 keybuf, erq->length); 861 keybuf, erq->length);
860} 862}
@@ -1005,11 +1007,11 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1005{ 1007{
1006 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1008 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1007 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 1009 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
1008 int alg, idx, i; 1010 int uninitialized_var(alg), idx, i, remove = 0;
1009 1011
1010 switch (ext->alg) { 1012 switch (ext->alg) {
1011 case IW_ENCODE_ALG_NONE: 1013 case IW_ENCODE_ALG_NONE:
1012 alg = ALG_NONE; 1014 remove = 1;
1013 break; 1015 break;
1014 case IW_ENCODE_ALG_WEP: 1016 case IW_ENCODE_ALG_WEP:
1015 alg = ALG_WEP; 1017 alg = ALG_WEP;
@@ -1025,7 +1027,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1025 } 1027 }
1026 1028
1027 if (erq->flags & IW_ENCODE_DISABLED) 1029 if (erq->flags & IW_ENCODE_DISABLED)
1028 alg = ALG_NONE; 1030 remove = 1;
1029 1031
1030 idx = erq->flags & IW_ENCODE_INDEX; 1032 idx = erq->flags & IW_ENCODE_INDEX;
1031 if (idx < 1 || idx > 4) { 1033 if (idx < 1 || idx > 4) {
@@ -1044,6 +1046,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1044 idx--; 1046 idx--;
1045 1047
1046 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, 1048 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
1049 remove,
1047 ext->ext_flags & 1050 ext->ext_flags &
1048 IW_ENCODE_EXT_SET_TX_KEY, 1051 IW_ENCODE_EXT_SET_TX_KEY,
1049 ext->key, ext->key_len); 1052 ext->key, ext->key_len);
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index f13d46b2c13c..0b2328f7d67c 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -121,7 +121,6 @@ struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
121 struct ieee80211_key *key; 121 struct ieee80211_key *key;
122 122
123 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS); 123 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS);
124 BUG_ON(alg == ALG_NONE);
125 124
126 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); 125 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
127 if (!key) 126 if (!key)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f5caa1a016ee..8c16574ec39c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -532,9 +532,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
532 return ieee80211_crypto_tkip_decrypt(rx); 532 return ieee80211_crypto_tkip_decrypt(rx);
533 case ALG_CCMP: 533 case ALG_CCMP:
534 return ieee80211_crypto_ccmp_decrypt(rx); 534 return ieee80211_crypto_ccmp_decrypt(rx);
535 case ALG_NONE:
536 WARN_ON(1);
537 return TXRX_CONTINUE;
538 } 535 }
539 536
540 /* not reached */ 537 /* not reached */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8f0007a925a2..47416b0645db 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -554,8 +554,6 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
554 return ieee80211_crypto_tkip_encrypt(tx); 554 return ieee80211_crypto_tkip_encrypt(tx);
555 case ALG_CCMP: 555 case ALG_CCMP:
556 return ieee80211_crypto_ccmp_encrypt(tx); 556 return ieee80211_crypto_ccmp_encrypt(tx);
557 case ALG_NONE:
558 return TXRX_CONTINUE;
559 } 557 }
560 558
561 /* not reached */ 559 /* not reached */