mirror of https://gitee.com/openkylin/linux.git
staging: rtl8723au: rtw_cfg80211_ap_set_encryption(): Use key_params->cipher to determine encryption
Passing strings around for something we have defines for is just silly. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
ef80f1f564
commit
5dab9e7d2a
|
@ -501,7 +501,8 @@ static int set_wep_key(struct rtw_adapter *padapter, u8 *key, u16 keylen,
|
||||||
|
|
||||||
static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
struct ieee_param *param,
|
struct ieee_param *param,
|
||||||
u32 param_len)
|
u32 param_len,
|
||||||
|
struct key_params *keyparms)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
u16 wep_key_len;
|
u16 wep_key_len;
|
||||||
|
@ -549,7 +550,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(param->u.crypt.alg, "WEP") == 0 && (psta == NULL)) {
|
if (!psta && (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
|
||||||
|
keyparms->cipher == WLAN_CIPHER_SUITE_WEP104)) {
|
||||||
DBG_8723A("r871x_set_encryption, crypt.alg = WEP\n");
|
DBG_8723A("r871x_set_encryption, crypt.alg = WEP\n");
|
||||||
|
|
||||||
wep_key_idx = param->u.crypt.idx;
|
wep_key_idx = param->u.crypt.idx;
|
||||||
|
@ -598,7 +600,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
|
|
||||||
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */
|
if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */
|
||||||
if (param->u.crypt.set_tx == 0) { /* group key */
|
if (param->u.crypt.set_tx == 0) { /* group key */
|
||||||
if (strcmp(param->u.crypt.alg, "WEP") == 0) {
|
if (keyparms->cipher == WLAN_CIPHER_SUITE_WEP40 ||
|
||||||
|
keyparms->cipher == WLAN_CIPHER_SUITE_WEP104) {
|
||||||
DBG_8723A("%s, set group_key, WEP\n", __func__);
|
DBG_8723A("%s, set group_key, WEP\n", __func__);
|
||||||
|
|
||||||
memcpy(psecuritypriv->
|
memcpy(psecuritypriv->
|
||||||
|
@ -613,7 +616,7 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
WLAN_CIPHER_SUITE_WEP104;
|
WLAN_CIPHER_SUITE_WEP104;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (strcmp(param->u.crypt.alg, "TKIP") == 0) {
|
} else if (keyparms->cipher == WLAN_CIPHER_SUITE_TKIP) {
|
||||||
DBG_8723A("%s, set group_key, TKIP\n",
|
DBG_8723A("%s, set group_key, TKIP\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
|
@ -638,8 +641,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
|
|
||||||
psecuritypriv->busetkipkey = 1;
|
psecuritypriv->busetkipkey = 1;
|
||||||
|
|
||||||
} else if (strcmp(param->u.crypt.alg, "CCMP") == 0) {
|
} else if (keyparms->cipher == WLAN_CIPHER_SUITE_CCMP) {
|
||||||
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;
|
||||||
|
@ -692,7 +695,10 @@ 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 (!strcmp(param->u.crypt.alg, "WEP")) {
|
if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_WEP40 ||
|
||||||
|
keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_WEP104) {
|
||||||
DBG_8723A("%s, set pairwise key, WEP\n",
|
DBG_8723A("%s, set pairwise key, WEP\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
|
@ -701,11 +707,13 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
psta->dot118021XPrivacy =
|
psta->dot118021XPrivacy =
|
||||||
WLAN_CIPHER_SUITE_WEP104;
|
WLAN_CIPHER_SUITE_WEP104;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(param->u.crypt.alg, "TKIP")) {
|
} else if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_TKIP) {
|
||||||
DBG_8723A("%s, set pairwise key, "
|
DBG_8723A("%s, set pairwise key, "
|
||||||
"TKIP\n", __func__);
|
"TKIP\n", __func__);
|
||||||
|
|
||||||
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_TKIP;
|
psta->dot118021XPrivacy =
|
||||||
|
WLAN_CIPHER_SUITE_TKIP;
|
||||||
|
|
||||||
/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
|
/* DEBUG_ERR("set key length :param->u.crypt.key_len =%d\n", param->u.crypt.key_len); */
|
||||||
/* set mic key */
|
/* set mic key */
|
||||||
|
@ -716,12 +724,13 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
|
|
||||||
psecuritypriv->busetkipkey = 1;
|
psecuritypriv->busetkipkey = 1;
|
||||||
|
|
||||||
} else if (!strcmp(param->u.crypt.alg, "CCMP")) {
|
} else if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_CCMP) {
|
||||||
DBG_8723A("%s, set pairwise key, "
|
DBG_8723A("%s, set pairwise key, "
|
||||||
"CCMP\n", __func__);
|
"CCMP\n", __func__);
|
||||||
|
|
||||||
psta->dot118021XPrivacy = WLAN_CIPHER_SUITE_CCMP;
|
psta->dot118021XPrivacy =
|
||||||
|
WLAN_CIPHER_SUITE_CCMP;
|
||||||
} else {
|
} else {
|
||||||
DBG_8723A("%s, set pairwise key, "
|
DBG_8723A("%s, set pairwise key, "
|
||||||
"none\n", __func__);
|
"none\n", __func__);
|
||||||
|
@ -735,7 +744,10 @@ 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 (!strcmp(param->u.crypt.alg, "WEP")) {
|
if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_WEP40 ||
|
||||||
|
keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_WEP104) {
|
||||||
memcpy(psecuritypriv->
|
memcpy(psecuritypriv->
|
||||||
dot118021XGrpKey[param->u.crypt.
|
dot118021XGrpKey[param->u.crypt.
|
||||||
idx].skey,
|
idx].skey,
|
||||||
|
@ -751,7 +763,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
dot118021XGrpPrivacy =
|
dot118021XGrpPrivacy =
|
||||||
WLAN_CIPHER_SUITE_WEP104;
|
WLAN_CIPHER_SUITE_WEP104;
|
||||||
}
|
}
|
||||||
} else if (!strcmp(param->u.crypt.alg, "TKIP")) {
|
} else if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_TKIP) {
|
||||||
psecuritypriv->dot118021XGrpPrivacy =
|
psecuritypriv->dot118021XGrpPrivacy =
|
||||||
WLAN_CIPHER_SUITE_TKIP;
|
WLAN_CIPHER_SUITE_TKIP;
|
||||||
|
|
||||||
|
@ -780,7 +793,8 @@ static int rtw_cfg80211_ap_set_encryption(struct net_device *dev,
|
||||||
|
|
||||||
psecuritypriv->busetkipkey = 1;
|
psecuritypriv->busetkipkey = 1;
|
||||||
|
|
||||||
} else if (!strcmp(param->u.crypt.alg, "CCMP")) {
|
} else if (keyparms->cipher ==
|
||||||
|
WLAN_CIPHER_SUITE_CCMP) {
|
||||||
psecuritypriv->dot118021XGrpPrivacy =
|
psecuritypriv->dot118021XGrpPrivacy =
|
||||||
WLAN_CIPHER_SUITE_CCMP;
|
WLAN_CIPHER_SUITE_CCMP;
|
||||||
|
|
||||||
|
@ -1099,7 +1113,8 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
|
||||||
if (mac_addr)
|
if (mac_addr)
|
||||||
ether_addr_copy(param->sta_addr, mac_addr);
|
ether_addr_copy(param->sta_addr, mac_addr);
|
||||||
|
|
||||||
ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len);
|
ret = rtw_cfg80211_ap_set_encryption(ndev, param, param_len,
|
||||||
|
params);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
DBG_8723A("error! fw_state = 0x%x, iftype =%d\n",
|
DBG_8723A("error! fw_state = 0x%x, iftype =%d\n",
|
||||||
|
|
Loading…
Reference in New Issue