staging: rtl8188eu: remove unused macros and definitions
PATCH 1/8 staging: rtl8188eu: remove unused macros and definitions
Removep unused macros and definitions from rtw_security.h leftover from previous cleanup patches.
--- .../staging/rtl8188eu/include/rtw_security.h | 58 ------------------- 1 file changed, 58 deletions(-)
drivers/staging/rtl8188eu/include/rtw_security.h +0 -58
@@ -228,64 +228,6 @@ struct mic_data {u32 nBytesInM;/* # bytes in M */ }; -extern const u32 Te0[256 ]; -extern const u32 Td0[256 ]; -extern const u32 Td1[256 ]; -extern const u32 Td2[256 ]; -extern const u32 Td3[256 ]; -extern const u32 Td4[256 ]; -extern const u32 rcon[10 ]; -extern const u8 Td4s[256 ]; -extern const u8 rcons[10 ]; - -#define RCON (i) (rcons[(i)] << 24) - -static inline u32 rotr (u32 val,int bits) -{ -return (val >> bits) | (val << (32 - bits)); -} - -#define TE0 (i) Te0[((i) >> 24) & 0xff] -#define TE1 (i) rotr(Te0[((i) >> 16) & 0xff], 8) -#define TE2 (i) rotr(Te0[((i) >> 8) & 0xff], 16) -#define TE3 (i) rotr(Te0[(i) & 0xff], 24) - -/* ===== start - public domain SHA256 implementation ===== */ - -/* This is based on SHA256 implementation in LibTomCrypt that was released into -* public domain by Tom St Denis. -*/ - -/* the K array */ -static const unsigned long K [64 ] = { -0x428a2f98UL ,0x71374491UL ,0xb5c0fbcfUL ,0xe9b5dba5UL ,0x3956c25bUL , -0x59f111f1UL ,0x923f82a4UL ,0xab1c5ed5UL ,0xd807aa98UL ,0x12835b01UL , -0x243185beUL ,0x550c7dc3UL ,0x72be5d74UL ,0x80deb1feUL ,0x9bdc06a7UL , -0xc19bf174UL ,0xe49b69c1UL ,0xefbe4786UL ,0x0fc19dc6UL ,0x240ca1ccUL , -0x2de92c6fUL ,0x4a7484aaUL ,0x5cb0a9dcUL ,0x76f988daUL ,0x983e5152UL , -0xa831c66dUL ,0xb00327c8UL ,0xbf597fc7UL ,0xc6e00bf3UL ,0xd5a79147UL , -0x06ca6351UL ,0x14292967UL ,0x27b70a85UL ,0x2e1b2138UL ,0x4d2c6dfcUL , -0x53380d13UL ,0x650a7354UL ,0x766a0abbUL ,0x81c2c92eUL ,0x92722c85UL , -0xa2bfe8a1UL ,0xa81a664bUL ,0xc24b8b70UL ,0xc76c51a3UL ,0xd192e819UL , -0xd6990624UL ,0xf40e3585UL ,0x106aa070UL ,0x19a4c116UL ,0x1e376c08UL , -0x2748774cUL ,0x34b0bcb5UL ,0x391c0cb3UL ,0x4ed8aa4aUL ,0x5b9cca4fUL , -0x682e6ff3UL ,0x748f82eeUL ,0x78a5636fUL ,0x84c87814UL ,0x8cc70208UL , -0x90befffaUL ,0xa4506cebUL ,0xbef9a3f7UL ,0xc67178f2UL -}; - -/* Various logical functions */ -#define RORc (x, y) \ - (((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y) & 31)) | \ - ((unsigned long)(x) << (unsigned long)(32 - ((y) & 31)))) & 0xFFFFFFFFUL) -#define Ch (x, y, z) (z ^ (x & (y ^ z))) -#define Maj (x, y, z) (((x | y) & z) | (x & y)) -#define S (x, n) RORc((x), (n)) -#define R (x, n) (((x) & 0xFFFFFFFFUL) >> (n)) -#define Sigma0 (x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) -#define Sigma1 (x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) -#define Gamma0 (x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) -#define Gamma1 (x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) -void rtw_secmicsetkey (struct mic_data *pmicdata,u8 *key);void rtw_secmicappendbyte (struct mic_data *pmicdata,u8 b);void rtw_secmicappend (struct mic_data *pmicdata,u8 *src,u32 nBytes);
Signature · 1 line
2.28.0
PATCH 3/8 staging: rtl8188eu: rename struct field Bssid -> bssid
Rename field of struct rt_pmkid_list to avoid camel case.
Bssid -> bssid
--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- drivers/staging/rtl8188eu/include/rtw_security.h | 2 +- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -1
@@ -1673,7 +1673,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid)do {if ((psecuritypriv->PMKIDList[i].bUsed) && - (!memcmp (psecuritypriv->PMKIDList[i].Bssid, bssid,ETH_ALEN ))) + (!memcmp (psecuritypriv->PMKIDList[i].bssid, bssid,ETH_ALEN )))break ; }while (++i <NUM_PMKID_CACHE );
drivers/staging/rtl8188eu/include/rtw_security.h +1 -1
@@ -82,7 +82,7 @@ union Keytype {struct rt_pmkid_list {u8 bUsed; -u8 Bssid[6 ]; +u8 bssid[6 ];u8 PMKID[16 ];u8 SsidBuf[33 ];u8 *ssid_octet;
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +4 -4
@@ -778,7 +778,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,/* overwrite PMKID */ for (j =0 ; j <NUM_PMKID_CACHE ; j++) { -if (!memcmp (psecuritypriv->PMKIDList[j].Bssid, strIssueBssid,ETH_ALEN )) { +if (!memcmp (psecuritypriv->PMKIDList[j].bssid, strIssueBssid,ETH_ALEN )) {/* BSSID is matched, the same AP => rewrite with new PMKID. */ DBG_88E ("[%s] BSSID exists in the PMKList.\n" , __func__);memcpy (psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid,IW_PMKID_LEN );
@@ -794,7 +794,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,DBG_88E ("[%s] Use the new entry index = %d for this PMKID.\n" , __func__, psecuritypriv->PMKIDIndex); -memcpy (psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].Bssid, strIssueBssid,ETH_ALEN ); +memcpy (psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bssid, strIssueBssid,ETH_ALEN );memcpy (psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pPMK->pmkid,IW_PMKID_LEN ); psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = true;
@@ -806,9 +806,9 @@ static int rtw_wx_set_pmkid(struct net_device *dev,DBG_88E ("[%s] IW_PMKSA_REMOVE!\n" , __func__); ret = true;for (j =0 ; j <NUM_PMKID_CACHE ; j++) { -if (!memcmp (psecuritypriv->PMKIDList[j].Bssid, strIssueBssid,ETH_ALEN )) { +if (!memcmp (psecuritypriv->PMKIDList[j].bssid, strIssueBssid,ETH_ALEN )) {/* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ -eth_zero_addr (psecuritypriv->PMKIDList[j].Bssid); +eth_zero_addr (psecuritypriv->PMKIDList[j].bssid); psecuritypriv->PMKIDList[j].bUsed = false;break ; }
Signature · 1 line
2.28.0
PATCH 2/8 staging: rtl8188eu: clean up comparsions to NULL
In reply to Michael StraubeClean up remaining comparsions to NULL reported by checkpatch. x == NULL -> !x
x != NULL -> x
--- drivers/staging/rtl8188eu/core/rtw_security.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/rtl8188eu/core/rtw_security.c +4 -4
@@ -142,7 +142,7 @@ void rtw_wep_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)struct sk_buff *skb;struct lib80211_crypto_ops *crypto_ops; -if (pxmitframe->buf_addr ==NULL ) +if (!pxmitframe->buf_addr)return ;if ((pattrib->encrypt != _WEP40_) && (pattrib->encrypt != _WEP104_))
@@ -589,7 +589,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)struct xmit_priv *pxmitpriv = &padapter->xmitpriv;u32 res = _SUCCESS; -if (pxmitframe->buf_addr ==NULL ) +if (!pxmitframe->buf_addr)return _FAIL; hw_hdr_offset = TXDESC_SIZE +
@@ -602,7 +602,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)else stainfo =rtw_get_stainfo (&padapter->stapriv, &pattrib->ra[0 ]); -if (stainfo !=NULL ) { +if (stainfo) {RT_TRACE (_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n" , __func__));if (is_multicast_ether_addr (pattrib->ra))
@@ -834,7 +834,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, struct recv_frame *precvframe)if (prxattrib->encrypt == _AES_) {struct sta_info *stainfo =rtw_get_stainfo (&padapter->stapriv, &prxattrib->ta[0 ]); -if (stainfo !=NULL ) { +if (stainfo) {int key_idx;const int key_length =16 , iv_len =8 , icv_len =8 ;struct sk_buff *skb = precvframe->pkt;
Signature · 1 line
2.28.0
PATCH 6/8 staging: rtl8188eu: remove cckrates{only}_included()
In reply to Michael StraubeIn rtw_ieee80211.c there are rtw_is_cckrates_included() and rtw_is_cckratesonly_included() which have the same functionality as cckrates_included() and cckrates_only_included() defined in rtw_wlan_util.c. Remove the functions from rtw_wlan_util.c and use those from rtw_ieee80211.c.
--- .../staging/rtl8188eu/core/rtw_wlan_util.c | 34 +++---------------- .../staging/rtl8188eu/include/rtw_mlme_ext.h | 3 -- 2 files changed, 4 insertions(+), 33 deletions(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +4 -30
@@ -53,32 +53,6 @@ static const u8 rtw_basic_rate_mix[7] = { IEEE80211_OFDM_RATE_24MB | IEEE80211_BASIC_RATE_MASK }; -bool cckrates_included (unsigned char *rate,int ratelen) -{ -int i; - -for (i =0 ; i < ratelen; i++) { -u8 r = rate[i] &0x7f ; - -if (r ==2 || r ==4 || r ==11 || r ==22 ) -return true; - } -return false; -} - -bool cckratesonly_included (unsigned char *rate,int ratelen) -{ -int i; - -for (i =0 ; i < ratelen; i++) { -u8 r = rate[i] &0x7f ; - -if (r !=2 && r !=4 && r !=11 && r !=22 ) -return false; - } -return true; -} -unsigned char networktype_to_raid (unsigned char network_type) {switch (network_type) {
@@ -111,9 +85,9 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelenif (pmlmeinfo->HT_enable) network_type =WIRELESS_11_24N ; -if (cckratesonly_included (rate, ratelen)) +if (rtw_is_cckratesonly_included (rate)) network_type |=WIRELESS_11B ; -else if (cckrates_included (rate, ratelen)) +else if (rtw_is_cckrates_included (rate)) network_type |=WIRELESS_11BG ;else network_type |=WIRELESS_11G ;
@@ -1362,9 +1336,9 @@ void update_wireless_mode(struct adapter *padapter)if (pmlmeinfo->HT_enable) network_type =WIRELESS_11_24N ; -if (cckratesonly_included (rate, ratelen)) +if (rtw_is_cckratesonly_included (rate)) network_type |=WIRELESS_11B ; -else if (cckrates_included (rate, ratelen)) +else if (rtw_is_cckrates_included (rate)) network_type |=WIRELESS_11BG ;else network_type |=WIRELESS_11G ;
drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +0 -3
@@ -568,9 +568,6 @@ void addba_timer_hdl(struct timer_list *t);mod_timer (&mlmeext->link_timer, jiffies + \ msecs_to_jiffies(ms)) -bool cckrates_included (unsigned char *rate,int ratelen); -bool cckratesonly_included (unsigned char *rate,int ratelen); -void process_addba_req (struct adapter *padapter,u8 *paddba_req,u8 *addr);void update_TSF (struct mlme_ext_priv *pmlmeext,u8 *pframe,uint len);
Signature · 1 line
2.28.0
PATCH 8/8 staging: rtl8188eu: clean up indent style issue
In reply to Michael StraubeReplace spaces with tab to clear checkpatch error.
ERROR: code indent should use tabs where possible
--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -1
@@ -1730,7 +1730,7 @@ int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_ (ndisauthmode == Ndis802_11AuthModeWPAPSK)) authmode = _WPA_IE_ID_; else if ((ndisauthmode == Ndis802_11AuthModeWPA2) || - (ndisauthmode == Ndis802_11AuthModeWPA2PSK)) + (ndisauthmode == Ndis802_11AuthModeWPA2PSK)) authmode = _WPA2_IE_ID_; else authmode =0x0 ;
Signature · 1 line
2.28.0
PATCH 7/8 staging: rtl8188eu: remove unused variable ratelen
In reply to Michael StraubeAfter the removal of cckrates_included() and cckrates_only_included() from rtw_wlan_util.c the variable/parameter 'ratelen' is unused now. Remove it from update_wireless_mode() and judge_network_type().
--- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 6 ++---- drivers/staging/rtl8188eu/hal/usb_halinit.c | 4 ++-- drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-)
drivers/staging/rtl8188eu/core/rtw_wlan_util.c +2 -4
@@ -76,7 +76,7 @@ unsigned char networktype_to_raid(unsigned char network_type) } } -u8 judge_network_type (struct adapter *padapter,unsigned char *rate,int ratelen) +u8 judge_network_type (struct adapter *padapter,unsigned char *rate) {u8 network_type =0 ;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -1321,15 +1321,13 @@ void update_capinfo(struct adapter *Adapter, u16 updateCap)void update_wireless_mode (struct adapter *padapter) { -int ratelen, network_type =0 ; +int network_type =0 ;u32 SIFS_Timer;struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;struct wlan_bssid_ex *cur_network = &pmlmeinfo->network;unsigned char *rate = cur_network->SupportedRates; - ratelen =rtw_get_rateset_len (cur_network->SupportedRates); -if (pmlmeinfo->HT_info_enable && pmlmeinfo->HT_caps_enable) pmlmeinfo->HT_enable =1 ;
drivers/staging/rtl8188eu/hal/usb_halinit.c +2 -2
@@ -1893,7 +1893,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level)switch (mac_id) {case 0 :/* for infra mode */ supportRateNum =rtw_get_rateset_len (cur_network->SupportedRates); - networkType =judge_network_type (adapt, cur_network->SupportedRates, supportRateNum) &0xf ; + networkType =judge_network_type (adapt, cur_network->SupportedRates) &0xf ; raid =networktype_to_raid (networkType); mask =update_supported_rate (cur_network->SupportedRates, supportRateNum); mask |= (pmlmeinfo->HT_enable) ?update_MSC_rate (&pmlmeinfo->HT_caps) :0 ;
@@ -1911,7 +1911,7 @@ void UpdateHalRAMask8188EUsb(struct adapter *adapt, u32 mac_id, u8 rssi_level)break ;default :/* for each sta in IBSS */ supportRateNum =rtw_get_rateset_len (pmlmeinfo->FW_sta_info[mac_id].SupportedRates); - networkType =judge_network_type (adapt, pmlmeinfo->FW_sta_info[mac_id].SupportedRates, supportRateNum) &0xf ; + networkType =judge_network_type (adapt, pmlmeinfo->FW_sta_info[mac_id].SupportedRates) &0xf ; raid =networktype_to_raid (networkType); mask =update_supported_rate (cur_network->SupportedRates, supportRateNum);
drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +1 -1
@@ -448,7 +448,7 @@ void init_addba_retry_timer(struct adapter *adapt, struct sta_info *sta);struct xmit_frame *alloc_mgtxmitframe (struct xmit_priv *pxmitpriv);unsigned char networktype_to_raid (unsigned char network_type); -u8 judge_network_type (struct adapter *padapter,unsigned char *rate,int len); +u8 judge_network_type (struct adapter *padapter,unsigned char *rate);void get_rate_set (struct adapter *padapter,unsigned char *pbssrate,int *len);void UpdateBrateTbl (struct adapter *padapter,u8 *mBratesOS);void UpdateBrateTblForSoftAP (u8 *bssrateset,u32 bssratelen);
Signature · 1 line
2.28.0
PATCH 4/8 staging: rtl8188eu: use ETH_ALEN
In reply to Michael StraubeUse ETH_ALEN instead of hard coded array size.
--- drivers/staging/rtl8188eu/include/rtw_security.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/include/rtw_security.h +1 -1
@@ -82,7 +82,7 @@ union Keytype {struct rt_pmkid_list {u8 bUsed; -u8 bssid[6 ]; +u8 bssid[ETH_ALEN ];u8 PMKID[16 ];u8 SsidBuf[33 ];u8 *ssid_octet;
Signature · 1 line
2.28.0
PATCH 5/8 staging: rtl8188eu: rename struct field bUsed -> used
In reply to Michael StraubeRename field of struct rt_pmkid_list to avoid camel case.
bUsed -> used
--- drivers/staging/rtl8188eu/core/rtw_mlme.c | 2 +- drivers/staging/rtl8188eu/include/rtw_security.h | 2 +- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme.c +1 -1
@@ -1672,7 +1672,7 @@ static int SecIsInPMKIDList(struct adapter *Adapter, u8 *bssid)int i =0 ;do { -if ((psecuritypriv->PMKIDList[i].bUsed) && +if ((psecuritypriv->PMKIDList[i].used) && (!memcmp (psecuritypriv->PMKIDList[i].bssid, bssid,ETH_ALEN )))break ; }while (++i <NUM_PMKID_CACHE );
drivers/staging/rtl8188eu/include/rtw_security.h +1 -1
@@ -81,7 +81,7 @@ union Keytype { };struct rt_pmkid_list { -u8 bUsed; +u8 used;u8 bssid[ETH_ALEN ];u8 PMKID[16 ];u8 SsidBuf[33 ];
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +3 -3
@@ -782,7 +782,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,/* BSSID is matched, the same AP => rewrite with new PMKID. */ DBG_88E ("[%s] BSSID exists in the PMKList.\n" , __func__);memcpy (psecuritypriv->PMKIDList[j].PMKID, pPMK->pmkid,IW_PMKID_LEN ); - psecuritypriv->PMKIDList[j].bUsed = true; + psecuritypriv->PMKIDList[j].used = true; psecuritypriv->PMKIDIndex = j +1 ; blInserted = true;break ;
@@ -797,7 +797,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,memcpy (psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bssid, strIssueBssid,ETH_ALEN );memcpy (psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].PMKID, pPMK->pmkid,IW_PMKID_LEN ); - psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].bUsed = true; + psecuritypriv->PMKIDList[psecuritypriv->PMKIDIndex].used = true; psecuritypriv->PMKIDIndex++;if (psecuritypriv->PMKIDIndex ==16 ) psecuritypriv->PMKIDIndex =0 ;
@@ -809,7 +809,7 @@ static int rtw_wx_set_pmkid(struct net_device *dev,if (!memcmp (psecuritypriv->PMKIDList[j].bssid, strIssueBssid,ETH_ALEN )) {/* BSSID is matched, the same AP => Remove this PMKID information and reset it. */ eth_zero_addr (psecuritypriv->PMKIDList[j].bssid); - psecuritypriv->PMKIDList[j].bUsed = false; + psecuritypriv->PMKIDList[j].used = false;break ; } }
Signature · 1 line
2.28.0