Commit 2dcf6b4c authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: Eliminate set_wep_key() and call set_group_key() directly

This also eliminates another round of determine algorithm based on key
length, followed by determine key length based on algorithm.
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ef2743d
...@@ -417,10 +417,9 @@ static int set_pairwise_key(struct rtw_adapter *padapter, struct sta_info *psta) ...@@ -417,10 +417,9 @@ static int set_pairwise_key(struct rtw_adapter *padapter, struct sta_info *psta)
return res; return res;
} }
static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg, static int set_group_key(struct rtw_adapter *padapter, struct key_params *parms,
u8 keyid) u32 alg, u8 keyid)
{ {
u8 keylen;
struct cmd_obj *pcmd; struct cmd_obj *pcmd;
struct setkey_parm *psetkeyparm; struct setkey_parm *psetkeyparm;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv; struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
...@@ -453,20 +452,7 @@ static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg, ...@@ -453,20 +452,7 @@ static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg,
psetkeyparm->set_tx = 1; psetkeyparm->set_tx = 1;
switch (alg) { memcpy(&psetkeyparm->key, parms->key, parms->key_len);
case WLAN_CIPHER_SUITE_WEP40:
keylen = 5;
break;
case WLAN_CIPHER_SUITE_WEP104:
keylen = 13;
break;
case WLAN_CIPHER_SUITE_TKIP:
case WLAN_CIPHER_SUITE_CCMP:
default:
keylen = 16;
}
memcpy(&psetkeyparm->key[0], key, keylen);
pcmd->cmdcode = _SetKey_CMD_; pcmd->cmdcode = _SetKey_CMD_;
pcmd->parmbuf = (u8 *) psetkeyparm; pcmd->parmbuf = (u8 *) psetkeyparm;
...@@ -480,25 +466,6 @@ static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg, ...@@ -480,25 +466,6 @@ static int set_group_key(struct rtw_adapter *padapter, const u8 *key, u32 alg,
return res; return res;
} }
static int set_wep_key(struct rtw_adapter *padapter, const u8 *key, u16 keylen,
u8 keyid)
{
u32 alg;
switch (keylen) {
case 5:
alg = WLAN_CIPHER_SUITE_WEP40;
break;
case 13:
alg = WLAN_CIPHER_SUITE_WEP104;
break;
default:
alg = 0;
}
return set_group_key(padapter, key, alg, keyid);
}
static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index,
int set_tx, const u8 *sta_addr, int set_tx, const u8 *sta_addr,
struct key_params *keyparms) struct key_params *keyparms)
...@@ -548,7 +515,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, ...@@ -548,7 +515,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index,
psecuritypriv->wep_key[key_index].keylen = key_len; psecuritypriv->wep_key[key_index].keylen = key_len;
set_wep_key(padapter, keyparms->key, key_len, key_index); set_group_key(padapter, keyparms, keyparms->cipher, key_index);
goto exit; goto exit;
} }
...@@ -612,7 +579,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, ...@@ -612,7 +579,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index,
psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot11PrivacyAlgrthm =
psecuritypriv->dot118021XGrpPrivacy; psecuritypriv->dot118021XGrpPrivacy;
set_group_key(padapter, keyparms->key, set_group_key(padapter, keyparms,
psecuritypriv->dot118021XGrpPrivacy, psecuritypriv->dot118021XGrpPrivacy,
key_index); key_index);
...@@ -723,7 +690,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index, ...@@ -723,7 +690,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, u8 key_index,
psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot11PrivacyAlgrthm =
psecuritypriv->dot118021XGrpPrivacy; psecuritypriv->dot118021XGrpPrivacy;
set_group_key(padapter, keyparms->key, set_group_key(padapter, keyparms,
psecuritypriv->dot118021XGrpPrivacy, psecuritypriv->dot118021XGrpPrivacy,
key_index); key_index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment