提交 628a140b 编写于 作者: J Johannes Berg 提交者: David S. Miller

[MAC80211]: remove ALG_NONE

This "algorithm" is used only internally and is not useful.
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
Cc: Michael Buesch <mb@bu3sch.de>
Acked-by: NZhu Yi <yi.zhu@intel.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 640845a5
......@@ -2827,9 +2827,6 @@ static int b43_dev_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (!dev)
return -ENODEV;
switch (key->alg) {
case ALG_NONE:
algorithm = B43_SEC_ALGO_NONE;
break;
case ALG_WEP:
if (key->keylen == 5)
algorithm = B43_SEC_ALGO_WEP40;
......
......@@ -2579,10 +2579,6 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
"with key %d\n", ctl->key_idx);
break;
case ALG_NONE:
IWL_DEBUG_TX("Tx packet in the clear (encrypt requested).\n");
break;
default:
printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg);
break;
......
......@@ -2663,10 +2663,6 @@ static void iwl_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
"with key %d\n", ctl->key_idx);
break;
case ALG_NONE:
IWL_DEBUG_TX("Tx packet in the clear (encrypt requested).\n");
break;
default:
printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg);
break;
......
......@@ -541,13 +541,11 @@ struct ieee80211_if_conf {
/**
* enum ieee80211_key_alg - key algorithm
* @ALG_NONE: Unset key algorithm, will never be passed to the driver
* @ALG_WEP: WEP40 or WEP104
* @ALG_TKIP: TKIP
* @ALG_CCMP: CCMP (AES)
*/
enum ieee80211_key_alg {
ALG_NONE,
ALG_WEP,
ALG_TKIP,
ALG_CCMP,
......
......@@ -27,8 +27,9 @@
static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
int idx, int alg, int set_tx_key,
const u8 *_key, size_t key_len)
int idx, int alg, int remove,
int set_tx_key, const u8 *_key,
size_t key_len)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
int ret = 0;
......@@ -75,7 +76,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
key = sta->key;
}
if (alg == ALG_NONE) {
if (remove) {
ieee80211_key_free(key);
key = NULL;
} else {
......@@ -827,6 +828,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
struct ieee80211_sub_if_data *sdata;
int idx, i, alg = ALG_WEP;
u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
int remove = 0;
sdata = IEEE80211_DEV_TO_SUB_IF(dev);
......@@ -845,7 +847,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
idx--;
if (erq->flags & IW_ENCODE_DISABLED)
alg = ALG_NONE;
remove = 1;
else if (erq->length == 0) {
/* No key data - just set the default TX key index */
ieee80211_set_default_key(sdata, idx);
......@@ -854,7 +856,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
return ieee80211_set_encryption(
dev, bcaddr,
idx, alg,
idx, alg, remove,
!sdata->default_key,
keybuf, erq->length);
}
......@@ -1005,11 +1007,11 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
{
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
int alg, idx, i;
int uninitialized_var(alg), idx, i, remove = 0;
switch (ext->alg) {
case IW_ENCODE_ALG_NONE:
alg = ALG_NONE;
remove = 1;
break;
case IW_ENCODE_ALG_WEP:
alg = ALG_WEP;
......@@ -1025,7 +1027,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
}
if (erq->flags & IW_ENCODE_DISABLED)
alg = ALG_NONE;
remove = 1;
idx = erq->flags & IW_ENCODE_INDEX;
if (idx < 1 || idx > 4) {
......@@ -1044,6 +1046,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
idx--;
return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
remove,
ext->ext_flags &
IW_ENCODE_EXT_SET_TX_KEY,
ext->key, ext->key_len);
......
......@@ -121,7 +121,6 @@ struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
struct ieee80211_key *key;
BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS);
BUG_ON(alg == ALG_NONE);
key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
if (!key)
......
......@@ -532,9 +532,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
return ieee80211_crypto_tkip_decrypt(rx);
case ALG_CCMP:
return ieee80211_crypto_ccmp_decrypt(rx);
case ALG_NONE:
WARN_ON(1);
return TXRX_CONTINUE;
}
/* not reached */
......
......@@ -554,8 +554,6 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
return ieee80211_crypto_tkip_encrypt(tx);
case ALG_CCMP:
return ieee80211_crypto_ccmp_encrypt(tx);
case ALG_NONE:
return TXRX_CONTINUE;
}
/* not reached */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册