Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 214009
b: refs/heads/master
c: 97359d1
h: refs/heads/master
i:
  214007: c156359
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Aug 16, 2010
1 parent 75ae5b4 commit f38fe72
Show file tree
Hide file tree
Showing 32 changed files with 237 additions and 261 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 915a824e30c503157c38115eb6a85f60bb653738
refs/heads/master: 97359d1235eaf634fe706c9faa6e40181cc95fb8
7 changes: 4 additions & 3 deletions trunk/drivers/net/wireless/at76c50x-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2061,11 +2061,12 @@ static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,

int i;

at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
at76_dbg(DBG_MAC80211, "%s(): cmd %d key->cipher %d key->keyidx %d "
"key->keylen %d",
__func__, cmd, key->alg, key->keyidx, key->keylen);
__func__, cmd, key->cipher, key->keyidx, key->keylen);

if (key->alg != ALG_WEP)
if ((key->cipher != WLAN_CIPHER_SUITE_WEP40) &&
(key->cipher != WLAN_CIPHER_SUITE_WEP104))
return -EOPNOTSUPP;

key->hw_key_idx = key->keyidx;
Expand Down
31 changes: 15 additions & 16 deletions trunk/drivers/net/wireless/ath/ar9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,14 +1190,13 @@ static int ar9170_tx_prepare(struct ar9170 *ar, struct sk_buff *skb)
if (info->control.hw_key) {
icv = info->control.hw_key->icv_len;

switch (info->control.hw_key->alg) {
case ALG_WEP:
switch (info->control.hw_key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
case WLAN_CIPHER_SUITE_TKIP:
keytype = AR9170_TX_MAC_ENCR_RC4;
break;
case ALG_TKIP:
keytype = AR9170_TX_MAC_ENCR_RC4;
break;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
keytype = AR9170_TX_MAC_ENCR_AES;
break;
default:
Expand Down Expand Up @@ -1778,17 +1777,17 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if ((!ar->vif) || (ar->disable_offload))
return -EOPNOTSUPP;

switch (key->alg) {
case ALG_WEP:
if (key->keylen == WLAN_KEY_LEN_WEP40)
ktype = AR9170_ENC_ALG_WEP64;
else
ktype = AR9170_ENC_ALG_WEP128;
switch (key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
ktype = AR9170_ENC_ALG_WEP64;
break;
case WLAN_CIPHER_SUITE_WEP104:
ktype = AR9170_ENC_ALG_WEP128;
break;
case ALG_TKIP:
case WLAN_CIPHER_SUITE_TKIP:
ktype = AR9170_ENC_ALG_TKIP;
break;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
ktype = AR9170_ENC_ALG_AESCCMP;
break;
default:
Expand Down Expand Up @@ -1827,7 +1826,7 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (err)
goto out;

if (key->alg == ALG_TKIP) {
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
err = ar9170_upload_key(ar, i, sta ? sta->addr : NULL,
ktype, 1, key->key + 16, 16);
if (err)
Expand Down Expand Up @@ -1864,7 +1863,7 @@ static int ar9170_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (err)
goto out;

if (key->alg == ALG_TKIP) {
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
err = ar9170_upload_key(ar, key->hw_key_idx,
NULL,
AR9170_ENC_ALG_NONE, 1,
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/net/wireless/ath/ath5k/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3297,11 +3297,12 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
if (sc->opmode == NL80211_IFTYPE_AP)
return -EOPNOTSUPP;

switch (key->alg) {
case ALG_WEP:
case ALG_TKIP:
switch (key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
case WLAN_CIPHER_SUITE_TKIP:
break;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
if (sc->ah->ah_aes_support)
break;

Expand Down
19 changes: 8 additions & 11 deletions trunk/drivers/net/wireless/ath/ath5k/pcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,21 +695,18 @@ int ath5k_hw_reset_key(struct ath5k_hw *ah, u16 entry)
static
int ath5k_keycache_type(const struct ieee80211_key_conf *key)
{
switch (key->alg) {
case ALG_TKIP:
switch (key->cipher) {
case WLAN_CIPHER_SUITE_TKIP:
return AR5K_KEYTABLE_TYPE_TKIP;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
return AR5K_KEYTABLE_TYPE_CCM;
case ALG_WEP:
if (key->keylen == WLAN_KEY_LEN_WEP40)
return AR5K_KEYTABLE_TYPE_40;
else if (key->keylen == WLAN_KEY_LEN_WEP104)
return AR5K_KEYTABLE_TYPE_104;
return -EINVAL;
case WLAN_CIPHER_SUITE_WEP40:
return AR5K_KEYTABLE_TYPE_40;
case WLAN_CIPHER_SUITE_WEP104:
return AR5K_KEYTABLE_TYPE_104;
default:
return -EINVAL;
}
return -EINVAL;
}

/*
Expand All @@ -728,7 +725,7 @@ int ath5k_hw_set_key(struct ath5k_hw *ah, u16 entry,
bool is_tkip;
const u8 *key_ptr;

is_tkip = (key->alg == ALG_TKIP);
is_tkip = (key->cipher == WLAN_CIPHER_SUITE_TKIP);

/*
* key->keylen comes in from mac80211 in bytes.
Expand Down
36 changes: 21 additions & 15 deletions trunk/drivers/net/wireless/ath/ath9k/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,17 @@ int ath9k_cmn_get_hw_crypto_keytype(struct sk_buff *skb)
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);

if (tx_info->control.hw_key) {
if (tx_info->control.hw_key->alg == ALG_WEP)
switch (tx_info->control.hw_key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
return ATH9K_KEY_TYPE_WEP;
else if (tx_info->control.hw_key->alg == ALG_TKIP)
case WLAN_CIPHER_SUITE_TKIP:
return ATH9K_KEY_TYPE_TKIP;
else if (tx_info->control.hw_key->alg == ALG_CCMP)
case WLAN_CIPHER_SUITE_CCMP:
return ATH9K_KEY_TYPE_AES;
default:
break;
}
}

return ATH9K_KEY_TYPE_CLEAR;
Expand Down Expand Up @@ -212,11 +217,11 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_common *common)
}

static int ath_reserve_key_cache_slot(struct ath_common *common,
enum ieee80211_key_alg alg)
u32 cipher)
{
int i;

if (alg == ALG_TKIP)
if (cipher == WLAN_CIPHER_SUITE_TKIP)
return ath_reserve_key_cache_slot_tkip(common);

/* First, try to find slots that would not be available for TKIP. */
Expand Down Expand Up @@ -293,14 +298,15 @@ int ath9k_cmn_key_config(struct ath_common *common,

memset(&hk, 0, sizeof(hk));

switch (key->alg) {
case ALG_WEP:
switch (key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
case WLAN_CIPHER_SUITE_WEP104:
hk.kv_type = ATH9K_CIPHER_WEP;
break;
case ALG_TKIP:
case WLAN_CIPHER_SUITE_TKIP:
hk.kv_type = ATH9K_CIPHER_TKIP;
break;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
hk.kv_type = ATH9K_CIPHER_AES_CCM;
break;
default:
Expand All @@ -316,7 +322,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
memcpy(gmac, vif->addr, ETH_ALEN);
gmac[0] |= 0x01;
mac = gmac;
idx = ath_reserve_key_cache_slot(common, key->alg);
idx = ath_reserve_key_cache_slot(common, key->cipher);
break;
case NL80211_IFTYPE_ADHOC:
if (!sta) {
Expand All @@ -326,7 +332,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
memcpy(gmac, sta->addr, ETH_ALEN);
gmac[0] |= 0x01;
mac = gmac;
idx = ath_reserve_key_cache_slot(common, key->alg);
idx = ath_reserve_key_cache_slot(common, key->cipher);
break;
default:
idx = key->keyidx;
Expand All @@ -348,13 +354,13 @@ int ath9k_cmn_key_config(struct ath_common *common,
return -EOPNOTSUPP;
mac = sta->addr;

idx = ath_reserve_key_cache_slot(common, key->alg);
idx = ath_reserve_key_cache_slot(common, key->cipher);
}

if (idx < 0)
return -ENOSPC; /* no free key cache entries */

if (key->alg == ALG_TKIP)
if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
ret = ath_setkey_tkip(common, idx, key->key, &hk, mac,
vif->type == NL80211_IFTYPE_AP);
else
Expand All @@ -364,7 +370,7 @@ int ath9k_cmn_key_config(struct ath_common *common,
return -EIO;

set_bit(idx, common->keymap);
if (key->alg == ALG_TKIP) {
if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
set_bit(idx + 64, common->keymap);
if (common->splitmic) {
set_bit(idx + 32, common->keymap);
Expand All @@ -389,7 +395,7 @@ void ath9k_cmn_key_delete(struct ath_common *common,
return;

clear_bit(key->hw_key_idx, common->keymap);
if (key->alg != ALG_TKIP)
if (key->cipher != WLAN_CIPHER_SUITE_TKIP)
return;

clear_bit(key->hw_key_idx + 64, common->keymap);
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/net/wireless/ath/ath9k/htc_drv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,9 +1585,10 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
key->hw_key_idx = ret;
/* push IV and Michael MIC generation to stack */
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key->alg == ALG_TKIP)
if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
if (priv->ah->sw_mgmt_crypto && key->alg == ALG_CCMP)
if (priv->ah->sw_mgmt_crypto &&
key->cipher == WLAN_CIPHER_SUITE_CCMP)
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
ret = 0;
}
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1782,9 +1782,10 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
key->hw_key_idx = ret;
/* push IV and Michael MIC generation to stack */
key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
if (key->alg == ALG_TKIP)
if (key->cipher == WLAN_CIPHER_SUITE_TKIP)
key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
if (sc->sc_ah->sw_mgmt_crypto && key->alg == ALG_CCMP)
if (sc->sc_ah->sw_mgmt_crypto &&
key->cipher == WLAN_CIPHER_SUITE_CCMP)
key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
ret = 0;
}
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/net/wireless/b43/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3759,17 +3759,17 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
}

err = -EINVAL;
switch (key->alg) {
case ALG_WEP:
if (key->keylen == WLAN_KEY_LEN_WEP40)
algorithm = B43_SEC_ALGO_WEP40;
else
algorithm = B43_SEC_ALGO_WEP104;
switch (key->cipher) {
case WLAN_CIPHER_SUITE_WEP40:
algorithm = B43_SEC_ALGO_WEP40;
break;
case WLAN_CIPHER_SUITE_WEP104:
algorithm = B43_SEC_ALGO_WEP104;
break;
case ALG_TKIP:
case WLAN_CIPHER_SUITE_TKIP:
algorithm = B43_SEC_ALGO_TKIP;
break;
case ALG_CCMP:
case WLAN_CIPHER_SUITE_CCMP:
algorithm = B43_SEC_ALGO_AES;
break;
default:
Expand Down
16 changes: 8 additions & 8 deletions trunk/drivers/net/wireless/iwlwifi/iwl-agn-tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,37 +470,37 @@ static void iwlagn_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
{
struct ieee80211_key_conf *keyconf = info->control.hw_key;

switch (keyconf->alg) {
case ALG_CCMP:
switch (keyconf->cipher) {
case WLAN_CIPHER_SUITE_CCMP:
tx_cmd->sec_ctl = TX_CMD_SEC_CCM;
memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
if (info->flags & IEEE80211_TX_CTL_AMPDU)
tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK;
IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
break;

case ALG_TKIP:
case WLAN_CIPHER_SUITE_TKIP:
tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
ieee80211_get_tkip_key(keyconf, skb_frag,
IEEE80211_TKIP_P2_KEY, tx_cmd->key);
IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n");
break;

case ALG_WEP:
case WLAN_CIPHER_SUITE_WEP104:
tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;
/* fall through */
case WLAN_CIPHER_SUITE_WEP40:
tx_cmd->sec_ctl |= (TX_CMD_SEC_WEP |
(keyconf->keyidx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT);

if (keyconf->keylen == WEP_KEY_LEN_128)
tx_cmd->sec_ctl |= TX_CMD_SEC_KEY128;

memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);

IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
"with key %d\n", keyconf->keyidx);
break;

default:
IWL_ERR(priv, "Unknown encode alg %d\n", keyconf->alg);
IWL_ERR(priv, "Unknown encode cipher %x\n", keyconf->cipher);
break;
}
}
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3389,7 +3389,9 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
* in 1X mode.
* In legacy wep mode, we use another host command to the uCode.
*/
if (key->alg == ALG_WEP && !sta && vif->type != NL80211_IFTYPE_AP) {
if ((key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
key->cipher == WLAN_CIPHER_SUITE_WEP104) &&
!sta && vif->type != NL80211_IFTYPE_AP) {
if (cmd == SET_KEY)
is_default_wep_key = !priv->key_mapping_key;
else
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ struct iwl_tid_data {
};

struct iwl_hw_key {
enum ieee80211_key_alg alg;
u32 cipher;
int keylen;
u8 keyidx;
u8 key[32];
Expand Down
Loading

0 comments on commit f38fe72

Please sign in to comment.