mirror of https://gitee.com/openkylin/linux.git
staging: rtl8723au: Move rtw_set_802_11_add_wep23a() to ioctl_cfg80211.c
This is only called from ioctl_cfg80211.c so we can move it here and declare it static. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
e0827909a2
commit
1e6e7f6030
|
@ -360,82 +360,6 @@ int rtw_set_802_11_authentication_mode23a(struct rtw_adapter* padapter,
|
|||
return res;
|
||||
}
|
||||
|
||||
int rtw_set_802_11_add_wep23a(struct rtw_adapter* padapter,
|
||||
struct ndis_802_11_wep *wep)
|
||||
{
|
||||
u8 bdefaultkey;
|
||||
u8 btransmitkey;
|
||||
int keyid, res;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
bdefaultkey = (wep->KeyIndex & 0x40000000) > 0 ? false : true;
|
||||
btransmitkey = (wep->KeyIndex & 0x80000000) > 0 ? true : false;
|
||||
keyid = wep->KeyIndex & 0x3fffffff;
|
||||
|
||||
if (keyid >= 4) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("MgntActrtw_set_802_11_add_wep23a:keyid>4 =>fail\n"));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
switch (wep->KeyLength)
|
||||
{
|
||||
case 5:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength = 5\n"));
|
||||
break;
|
||||
case 13:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength = 13\n"));
|
||||
break;
|
||||
default:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = 0;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("MgntActrtw_set_802_11_add_wep23a:wep->KeyLength!= 5 "
|
||||
"or 13\n"));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_wep23a:befor memcpy, wep->KeyLength = 0x%x "
|
||||
"wep->KeyIndex = 0x%x keyid =%x\n",
|
||||
wep->KeyLength, wep->KeyIndex, keyid));
|
||||
|
||||
memcpy(&psecuritypriv->wep_key[keyid].key, &wep->KeyMaterial,
|
||||
wep->KeyLength);
|
||||
|
||||
psecuritypriv->wep_key[keyid].keylen = wep->KeyLength;
|
||||
|
||||
psecuritypriv->dot11PrivacyKeyIndex = keyid;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("rtw_set_802_11_add_wep23a:security key material : "
|
||||
"%x %x %x %x %x %x %x %x %x %x %x %x %x\n",
|
||||
psecuritypriv->wep_key[keyid].key[0],
|
||||
psecuritypriv->wep_key[keyid].key[1],
|
||||
psecuritypriv->wep_key[keyid].key[2],
|
||||
psecuritypriv->wep_key[keyid].key[3],
|
||||
psecuritypriv->wep_key[keyid].key[4],
|
||||
psecuritypriv->wep_key[keyid].key[5],
|
||||
psecuritypriv->wep_key[keyid].key[6],
|
||||
psecuritypriv->wep_key[keyid].key[7],
|
||||
psecuritypriv->wep_key[keyid].key[8],
|
||||
psecuritypriv->wep_key[keyid].key[9],
|
||||
psecuritypriv->wep_key[keyid].key[10],
|
||||
psecuritypriv->wep_key[keyid].key[11],
|
||||
psecuritypriv->wep_key[keyid].key[12]));
|
||||
|
||||
res = rtw_set_key23a(padapter, psecuritypriv, keyid, 1);
|
||||
|
||||
exit:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* rtw_get_cur_max_rate23a -
|
||||
* @adapter: pointer to _adapter structure
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
int rtw_set_802_11_authentication_mode23a(struct rtw_adapter *pdapter,
|
||||
enum ndis_802_11_auth_mode authmode);
|
||||
int rtw_set_802_11_add_wep23a(struct rtw_adapter * padapter,
|
||||
struct ndis_802_11_wep *wep);
|
||||
int rtw_set_802_11_bssid23a_list_scan(struct rtw_adapter *padapter,
|
||||
struct cfg80211_ssid *pssid,
|
||||
int ssid_max_num);
|
||||
|
|
|
@ -1935,6 +1935,81 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int rtw_cfg80211_add_wep(struct rtw_adapter* padapter,
|
||||
struct ndis_802_11_wep *wep)
|
||||
{
|
||||
u8 bdefaultkey;
|
||||
u8 btransmitkey;
|
||||
int keyid, res;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
bdefaultkey = (wep->KeyIndex & 0x40000000) > 0 ? false : true;
|
||||
btransmitkey = (wep->KeyIndex & 0x80000000) > 0 ? true : false;
|
||||
keyid = wep->KeyIndex & 0x3fffffff;
|
||||
|
||||
if (keyid >= 4) {
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
|
||||
("%s:keyid>4 =>fail\n", __func__));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
switch (wep->KeyLength)
|
||||
{
|
||||
case 5:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP40;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("%s:wep->KeyLength = 5\n", __func__));
|
||||
break;
|
||||
case 13:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = WLAN_CIPHER_SUITE_WEP104;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("%s:wep->KeyLength = 13\n", __func__));
|
||||
break;
|
||||
default:
|
||||
psecuritypriv->dot11PrivacyAlgrthm = 0;
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("%s:wep->KeyLength!= 5 or 13\n", __func__));
|
||||
res = _FAIL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("%s:before memcpy, wep->KeyLength = 0x%x "
|
||||
"wep->KeyIndex = 0x%x keyid =%x\n", __func__,
|
||||
wep->KeyLength, wep->KeyIndex, keyid));
|
||||
|
||||
memcpy(&psecuritypriv->wep_key[keyid].key, &wep->KeyMaterial,
|
||||
wep->KeyLength);
|
||||
|
||||
psecuritypriv->wep_key[keyid].keylen = wep->KeyLength;
|
||||
|
||||
psecuritypriv->dot11PrivacyKeyIndex = keyid;
|
||||
|
||||
RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_info_,
|
||||
("%s:security key material : "
|
||||
"%x %x %x %x %x %x %x %x %x %x %x %x %x\n", __func__,
|
||||
psecuritypriv->wep_key[keyid].key[0],
|
||||
psecuritypriv->wep_key[keyid].key[1],
|
||||
psecuritypriv->wep_key[keyid].key[2],
|
||||
psecuritypriv->wep_key[keyid].key[3],
|
||||
psecuritypriv->wep_key[keyid].key[4],
|
||||
psecuritypriv->wep_key[keyid].key[5],
|
||||
psecuritypriv->wep_key[keyid].key[6],
|
||||
psecuritypriv->wep_key[keyid].key[7],
|
||||
psecuritypriv->wep_key[keyid].key[8],
|
||||
psecuritypriv->wep_key[keyid].key[9],
|
||||
psecuritypriv->wep_key[keyid].key[10],
|
||||
psecuritypriv->wep_key[keyid].key[11],
|
||||
psecuritypriv->wep_key[keyid].key[12]));
|
||||
|
||||
res = rtw_set_key23a(padapter, psecuritypriv, keyid, 1);
|
||||
|
||||
exit:
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
||||
struct cfg80211_connect_params *sme)
|
||||
{
|
||||
|
@ -2152,7 +2227,7 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
|
|||
|
||||
memcpy(pwep->KeyMaterial, (void *)sme->key, pwep->KeyLength);
|
||||
|
||||
if (rtw_set_802_11_add_wep23a(padapter, pwep) != _SUCCESS)
|
||||
if (rtw_cfg80211_add_wep(padapter, pwep) != _SUCCESS)
|
||||
ret = -EOPNOTSUPP;
|
||||
|
||||
kfree(pwep);
|
||||
|
|
Loading…
Reference in New Issue