forked from Minki/linux
iwlwifi: add 1X HW WEP support
This patch adds support for HW encryption/decryption in 1X WEP. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
6974e36356
commit
0211ddda9d
drivers/net/wireless/iwlwifi
@ -461,6 +461,7 @@ struct iwl4965_tid_data {
|
||||
struct iwl4965_hw_key {
|
||||
enum ieee80211_key_alg alg;
|
||||
int keylen;
|
||||
u8 keyidx;
|
||||
struct ieee80211_key_conf *conf;
|
||||
u8 key[32];
|
||||
};
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "iwl-sta.h"
|
||||
#include "iwl-io.h"
|
||||
#include "iwl-helpers.h"
|
||||
#include "iwl-4965.h"
|
||||
|
||||
int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)
|
||||
{
|
||||
@ -117,3 +118,49 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id)
|
||||
{
|
||||
unsigned long flags;
|
||||
__le16 key_flags = 0;
|
||||
int ret;
|
||||
|
||||
keyconf->flags &= ~IEEE80211_KEY_FLAG_GENERATE_IV;
|
||||
keyconf->hw_key_idx = keyconf->keyidx;
|
||||
|
||||
key_flags |= (STA_KEY_FLG_WEP | STA_KEY_FLG_MAP_KEY_MSK);
|
||||
key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS);
|
||||
key_flags &= ~STA_KEY_FLG_INVALID;
|
||||
|
||||
if (keyconf->keylen == WEP_KEY_LEN_128)
|
||||
key_flags |= STA_KEY_FLG_KEY_SIZE_MSK;
|
||||
|
||||
if (sta_id == priv->hw_setting.bcast_sta_id)
|
||||
key_flags |= STA_KEY_MULTICAST_MSK;
|
||||
|
||||
spin_lock_irqsave(&priv->sta_lock, flags);
|
||||
|
||||
priv->stations[sta_id].keyinfo.alg = keyconf->alg;
|
||||
priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
|
||||
priv->stations[sta_id].keyinfo.keyidx = keyconf->keyidx;
|
||||
|
||||
memcpy(priv->stations[sta_id].keyinfo.key,
|
||||
keyconf->key, keyconf->keylen);
|
||||
|
||||
memcpy(&priv->stations[sta_id].sta.key.key[3],
|
||||
keyconf->key, keyconf->keylen);
|
||||
|
||||
priv->stations[sta_id].sta.key.key_offset = sta_id % 8; /* FIXME */
|
||||
priv->stations[sta_id].sta.key.key_flags = key_flags;
|
||||
|
||||
priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
|
||||
priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
|
||||
|
||||
ret = iwl4965_send_add_station(priv,
|
||||
&priv->stations[sta_id].sta, CMD_ASYNC);
|
||||
|
||||
spin_unlock_irqrestore(&priv->sta_lock, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -42,5 +42,8 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
|
||||
struct ieee80211_key_conf *key);
|
||||
int iwl_set_default_wep_key(struct iwl_priv *priv,
|
||||
struct ieee80211_key_conf *key);
|
||||
int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
|
||||
struct ieee80211_key_conf *keyconf,
|
||||
u8 sta_id);
|
||||
|
||||
#endif /* __iwl_sta_h__ */
|
||||
|
@ -1214,7 +1214,7 @@ static int iwl4965_set_dynamic_key(struct iwl_priv *priv,
|
||||
ret = iwl4965_set_tkip_dynamic_key_info(priv, key, sta_id);
|
||||
break;
|
||||
case ALG_WEP:
|
||||
ret = -EOPNOTSUPP;
|
||||
ret = iwl_set_wep_dynamic_key_info(priv, key, sta_id);
|
||||
break;
|
||||
default:
|
||||
IWL_ERROR("Unknown alg: %s alg = %d\n", __func__, key->alg);
|
||||
@ -2138,7 +2138,12 @@ static void iwl4965_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
|
||||
if (wepkey->key_size == WEP_KEY_LEN_128)
|
||||
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
|
||||
} else {
|
||||
IWL_ERROR("No support for WEP key mappings key\n");
|
||||
/* the WEP key was sent as dynamic */
|
||||
keyidx = keyinfo->keyidx;
|
||||
memcpy(&cmd->cmd.tx.key[3], keyinfo->key,
|
||||
keyinfo->keylen);
|
||||
if (keyinfo->keylen == WEP_KEY_LEN_128)
|
||||
cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
|
||||
}
|
||||
|
||||
cmd->cmd.tx.sec_ctl |= (TX_CMD_SEC_WEP |
|
||||
|
Loading…
Reference in New Issue
Block a user