From 1e6e7f6030f3cec00641c5a356b5986723f33df6 Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 21 May 2014 09:37:36 +0200 Subject: [PATCH] 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 Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8723au/core/rtw_ioctl_set.c | 76 ------------------ .../staging/rtl8723au/include/rtw_ioctl_set.h | 2 - .../staging/rtl8723au/os_dep/ioctl_cfg80211.c | 77 ++++++++++++++++++- 3 files changed, 76 insertions(+), 79 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c index 19e2e68ff85c..99a662d83fc1 100644 --- a/drivers/staging/rtl8723au/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8723au/core/rtw_ioctl_set.c @@ -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 diff --git a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h index 637f33b0c2dc..040543bff1b2 100644 --- a/drivers/staging/rtl8723au/include/rtw_ioctl_set.h +++ b/drivers/staging/rtl8723au/include/rtw_ioctl_set.h @@ -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); diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 08d6b3472bf6..d89b400bc683 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1935,6 +1935,81 @@ exit: 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); -- 2.39.5