Commit 4e297c21 authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: rtw_cfg80211_ap_set_encryption() is only called for WIFI_AP_STATE

No point checking it again in here, twice!
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5dab9e7d
...@@ -509,7 +509,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -509,7 +509,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
u8 wep_key_idx; u8 wep_key_idx;
struct sta_info *psta = NULL, *pbcmc_sta = NULL; struct sta_info *psta = NULL, *pbcmc_sta = NULL;
struct rtw_adapter *padapter = netdev_priv(dev); struct rtw_adapter *padapter = netdev_priv(dev);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv; struct security_priv *psecuritypriv = &padapter->securitypriv;
struct sta_priv *pstapriv = &padapter->stapriv; struct sta_priv *pstapriv = &padapter->stapriv;
...@@ -598,7 +597,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -598,7 +597,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
} }
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */ if (!psta) { /* group key */
if (param->u.crypt.set_tx == 0) { /* group key */ if (param->u.crypt.set_tx == 0) { /* group key */
if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 || if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) { keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) {
...@@ -620,7 +619,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -620,7 +619,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
DBG_8723A("%s, set group_key, TKIP\n", DBG_8723A("%s, set group_key, TKIP\n",
__func__); __func__);
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_TKIP; psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_TKIP;
memcpy(psecuritypriv-> memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx]. dot118021XGrpKey[param->u.crypt.idx].
...@@ -645,7 +645,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -645,7 +645,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
DBG_8723A("%s, set group_key, CCMP\n", DBG_8723A("%s, set group_key, CCMP\n",
__func__); __func__);
psecuritypriv->dot118021XGrpPrivacy = WLAN_CIPHER_SUITE_CCMP; psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_CCMP;
memcpy(psecuritypriv-> memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt.idx]. dot118021XGrpKey[param->u.crypt.idx].
...@@ -685,9 +686,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -685,9 +686,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
goto exit; goto exit;
} }
if (psecuritypriv->dot11AuthAlgrthm == if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) {
dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */ /* psk/802_1x */
if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
if (param->u.crypt.set_tx == 1) { if (param->u.crypt.set_tx == 1) {
/* pairwise key */ /* pairwise key */
memcpy(psta->dot118021x_UncstKey.skey, memcpy(psta->dot118021x_UncstKey.skey,
...@@ -695,22 +695,20 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -695,22 +695,20 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
(param->u.crypt.key_len > (param->u.crypt.key_len >
16 ? 16 : param->u.crypt.key_len)); 16 ? 16 : param->u.crypt.key_len));
if (keyparms->cipher == if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
WLAN_CIPHER_SUITE_WEP40 || keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) {
keyparms->cipher ==
WLAN_CIPHER_SUITE_WEP104) {
DBG_8723A("%s, set pairwise key, WEP\n", DBG_8723A("%s, set pairwise key, WEP\n",
__func__); __func__);
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_WEP40; psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_WEP40;
if (param->u.crypt.key_len == 13) { if (param->u.crypt.key_len == 13) {
psta->dot118021XPrivacy = psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_WEP104; WLAN_CIPHER_SUITE_WEP104;
} }
} else if (keyparms->cipher == } else if (keyparms->cipher == WLAN_CIPHER_SUITE_TKIP) {
WLAN_CIPHER_SUITE_TKIP) { DBG_8723A("%s, set pairwise key, TKIP\n",
DBG_8723A("%s, set pairwise key, " __func__);
"TKIP\n", __func__);
psta->dot118021XPrivacy = psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_TKIP; WLAN_CIPHER_SUITE_TKIP;
...@@ -724,16 +722,15 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -724,16 +722,15 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
psecuritypriv->busetkipkey = 1; psecuritypriv->busetkipkey = 1;
} else if (keyparms->cipher == } else if (keyparms->cipher == WLAN_CIPHER_SUITE_CCMP) {
WLAN_CIPHER_SUITE_CCMP) { DBG_8723A("%s, set pairwise key, CCMP\n",
DBG_8723A("%s, set pairwise key, " __func__);
"CCMP\n", __func__);
psta->dot118021XPrivacy = psta->dot118021XPrivacy =
WLAN_CIPHER_SUITE_CCMP; WLAN_CIPHER_SUITE_CCMP;
} else { } else {
DBG_8723A("%s, set pairwise key, " DBG_8723A("%s, set pairwise key, none\n",
"none\n", __func__); __func__);
psta->dot118021XPrivacy = 0; psta->dot118021XPrivacy = 0;
} }
...@@ -744,27 +741,22 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -744,27 +741,22 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
psta->bpairwise_key_installed = true; psta->bpairwise_key_installed = true;
} else { /* group key??? */ } else { /* group key??? */
if (keyparms->cipher == if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
WLAN_CIPHER_SUITE_WEP40 || keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) {
keyparms->cipher ==
WLAN_CIPHER_SUITE_WEP104) {
memcpy(psecuritypriv-> memcpy(psecuritypriv->
dot118021XGrpKey[param->u.crypt. dot118021XGrpKey[param->u.crypt.
idx].skey, idx].skey,
param->u.crypt.key, param->u.crypt.key,
(param->u.crypt.key_len > (param->u.crypt.key_len >
16 ? 16 : param->u.crypt. 16 ? 16 : param->u.crypt.key_len));
key_len));
psecuritypriv->dot118021XGrpPrivacy = psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_WEP40; WLAN_CIPHER_SUITE_WEP40;
if (param->u.crypt.key_len == 13) { if (param->u.crypt.key_len == 13) {
psecuritypriv-> psecuritypriv->dot118021XGrpPrivacy =
dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_WEP104; WLAN_CIPHER_SUITE_WEP104;
} }
} else if (keyparms->cipher == } else if (keyparms->cipher == WLAN_CIPHER_SUITE_TKIP) {
WLAN_CIPHER_SUITE_TKIP) {
psecuritypriv->dot118021XGrpPrivacy = psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_TKIP; WLAN_CIPHER_SUITE_TKIP;
...@@ -773,8 +765,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -773,8 +765,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
idx].skey, idx].skey,
param->u.crypt.key, param->u.crypt.key,
(param->u.crypt.key_len > (param->u.crypt.key_len >
16 ? 16 : param->u.crypt. 16 ? 16 : param->u.crypt.key_len));
key_len));
/* DEBUG_ERR("set key length :param->u" /* DEBUG_ERR("set key length :param->u"
".crypt.key_len =%d\n", ".crypt.key_len =%d\n",
...@@ -782,19 +773,16 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -782,19 +773,16 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
/* set mic key */ /* set mic key */
memcpy(psecuritypriv-> memcpy(psecuritypriv->
dot118021XGrptxmickey[param->u. dot118021XGrptxmickey[param->u.
crypt.idx]. crypt.idx].skey,
skey, &param->u.crypt.key[16], &param->u.crypt.key[16], 8);
8);
memcpy(psecuritypriv-> memcpy(psecuritypriv->
dot118021XGrprxmickey[param->u. dot118021XGrprxmickey[param->u.
crypt.idx]. crypt.idx].skey,
skey, &param->u.crypt.key[24], &param->u.crypt.key[24], 8);
8);
psecuritypriv->busetkipkey = 1; psecuritypriv->busetkipkey = 1;
} else if (keyparms->cipher == } else if (keyparms->cipher == WLAN_CIPHER_SUITE_CCMP) {
WLAN_CIPHER_SUITE_CCMP) {
psecuritypriv->dot118021XGrpPrivacy = psecuritypriv->dot118021XGrpPrivacy =
WLAN_CIPHER_SUITE_CCMP; WLAN_CIPHER_SUITE_CCMP;
...@@ -803,15 +791,12 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -803,15 +791,12 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
idx].skey, idx].skey,
param->u.crypt.key, param->u.crypt.key,
(param->u.crypt.key_len > (param->u.crypt.key_len >
16 ? 16 : param->u.crypt. 16 ? 16 : param->u.crypt.key_len));
key_len));
} else { } else {
psecuritypriv->dot118021XGrpPrivacy = psecuritypriv->dot118021XGrpPrivacy = 0;
0;
} }
psecuritypriv->dot118021XGrpKeyid = psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx;
param->u.crypt.idx;
psecuritypriv->binstallGrpkey = 1; psecuritypriv->binstallGrpkey = 1;
...@@ -819,8 +804,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -819,8 +804,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
psecuritypriv->dot118021XGrpPrivacy; psecuritypriv->dot118021XGrpPrivacy;
set_group_key(padapter, param->u.crypt.key, set_group_key(padapter, param->u.crypt.key,
psecuritypriv-> psecuritypriv->dot118021XGrpPrivacy,
dot118021XGrpPrivacy,
param->u.crypt.idx); param->u.crypt.idx);
pbcmc_sta = rtw_get_bcmc_stainfo23a(padapter); pbcmc_sta = rtw_get_bcmc_stainfo23a(padapter);
...@@ -828,8 +812,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -828,8 +812,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
/* rx will use bmc_sta's /* rx will use bmc_sta's
dot118021XPrivacy */ dot118021XPrivacy */
pbcmc_sta->ieee8021x_blocked = false; pbcmc_sta->ieee8021x_blocked = false;
pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy; pbcmc_sta->dot118021XPrivacy =
} psecuritypriv->dot118021XGrpPrivacy;
} }
} }
} }
...@@ -837,7 +821,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev, ...@@ -837,7 +821,6 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
exit: exit:
return ret; return ret;
} }
#endif #endif
......
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