* [PATCH v2 1/7] staging: rtl8723bs: Replace string with identifier
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
@ 2019-10-17 4:01 ` Javier F. Arias
2019-10-17 4:02 ` [PATCH v2 2/7] staging: rtl8723bs: Fix lines over 80 characters Javier F. Arias
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:01 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Replace the hardcoded function names with the corresponding
predefined identifiers.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 5ffaf9bfa6e8..4c92a3abb2c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -303,8 +303,8 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
*((u32 *)crc) = le32_to_cpu(getcrc32(payload, length-4));
if (crc[3] != payload[length-1] || crc[2] != payload[length-2] || crc[1] != payload[length-3] || crc[0] != payload[length-4]) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
- crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4]));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
+ __func__, crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4]));
}
WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
@@ -695,7 +695,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
return _FAIL;
}
*/
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt: stainfo!= NULL!!!\n"));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__));
if (IS_MCAST(pattrib->ra))
prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
@@ -853,7 +853,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
TKIP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
} else {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_decrypt: stainfo == NULL!!!\n"));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo == NULL!!!\n", __func__));
res = _FAIL;
}
@@ -1543,7 +1543,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
/* 4 start to encrypt each fragment */
if (pattrib->encrypt == _AES_) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_encrypt: stainfo!= NULL!!!\n"));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__));
if (IS_MCAST(pattrib->ra))
prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
@@ -1834,10 +1834,10 @@ static sint aes_decipher(u8 *key, uint hdrlen,
/* compare the mic */
for (i = 0; i < 8; i++) {
if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n",
- i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]));
- DBG_871X("aes_decipher:mic check error mic[%d]: pframe(%x) != message(%x)\n",
- i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]);
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
+ __func__, i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]));
+ DBG_871X("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
+ __func__, i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]);
res = _FAIL;
}
}
@@ -1868,7 +1868,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (prxattrib->encrypt == _AES_) {
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo != NULL) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo!= NULL!!!\n"));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__));
if (IS_MCAST(prxattrib->ra)) {
static unsigned long start;
@@ -1926,7 +1926,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
AES_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
} else {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_aes_decrypt: stainfo == NULL!!!\n"));
+ RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo == NULL!!!\n", __func__));
res = _FAIL;
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 2/7] staging: rtl8723bs: Fix lines over 80 characters
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
2019-10-17 4:01 ` [PATCH v2 1/7] staging: rtl8723bs: Replace string with identifier Javier F. Arias
@ 2019-10-17 4:02 ` Javier F. Arias
2019-10-17 4:02 ` [PATCH v2 3/7] staging: rtl8723bs: Add spaces between operators Javier F. Arias
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:02 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Fix lines over 80 characters by wrapping arguments in function calls,
improving the format for a better code readability.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 40 ++++++++++++++-----
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 4c92a3abb2c8..605155ea724c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -303,8 +303,14 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
*((u32 *)crc) = le32_to_cpu(getcrc32(payload, length-4));
if (crc[3] != payload[length-1] || crc[2] != payload[length-2] || crc[1] != payload[length-3] || crc[0] != payload[length-4]) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
- __func__, crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4]));
+ RT_TRACE(_module_rtl871x_security_c_,
+ _drv_err_,
+ ("%s:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
+ __func__,
+ crc[3], payload[length-1],
+ crc[2], payload[length-2],
+ crc[1], payload[length-3],
+ crc[0], payload[length-4]));
}
WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
@@ -845,9 +851,13 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
*((u32 *)crc) = le32_to_cpu(getcrc32(payload, length-4));
if (crc[3] != payload[length-1] || crc[2] != payload[length-2] || crc[1] != payload[length-3] || crc[0] != payload[length-4]) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
+ RT_TRACE(_module_rtl871x_security_c_,
+ _drv_err_,
("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
- crc[3], payload[length-1], crc[2], payload[length-2], crc[1], payload[length-3], crc[0], payload[length-4]));
+ crc[3], payload[length-1],
+ crc[2], payload[length-2],
+ crc[1], payload[length-3],
+ crc[0], payload[length-4]));
res = _FAIL;
}
@@ -1834,10 +1844,18 @@ static sint aes_decipher(u8 *key, uint hdrlen,
/* compare the mic */
for (i = 0; i < 8; i++) {
if (pframe[hdrlen+8+plen-8+i] != message[hdrlen+8+plen-8+i]) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
- __func__, i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]));
+ RT_TRACE(_module_rtl871x_security_c_,
+ _drv_err_,
+ ("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
+ __func__,
+ i,
+ pframe[hdrlen+8+plen-8+i],
+ message[hdrlen+8+plen-8+i]));
DBG_871X("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
- __func__, i, pframe[hdrlen+8+plen-8+i], message[hdrlen+8+plen-8+i]);
+ __func__,
+ i,
+ pframe[hdrlen+8+plen-8+i],
+ message[hdrlen+8+plen-8+i]);
res = _FAIL;
}
}
@@ -1868,7 +1886,9 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (prxattrib->encrypt == _AES_) {
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo != NULL) {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__));
+ RT_TRACE(_module_rtl871x_security_c_,
+ _drv_err_,
+ ("%s: stainfo!= NULL!!!\n", __func__));
if (IS_MCAST(prxattrib->ra)) {
static unsigned long start;
@@ -1926,7 +1946,9 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
AES_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
} else {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo == NULL!!!\n", __func__));
+ RT_TRACE(_module_rtl871x_security_c_,
+ _drv_err_,
+ ("%s: stainfo == NULL!!!\n", __func__));
res = _FAIL;
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 3/7] staging: rtl8723bs: Add spaces between operators
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
2019-10-17 4:01 ` [PATCH v2 1/7] staging: rtl8723bs: Replace string with identifier Javier F. Arias
2019-10-17 4:02 ` [PATCH v2 2/7] staging: rtl8723bs: Fix lines over 80 characters Javier F. Arias
@ 2019-10-17 4:02 ` Javier F. Arias
2019-10-17 4:03 ` [PATCH v2 4/7] staging: rtl8723bs: Remove commented code Javier F. Arias
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:02 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Add spaces between operators for a better readability.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 36 +++++++++----------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 605155ea724c..1bda534384a4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -307,10 +307,10 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
_drv_err_,
("%s:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
__func__,
- crc[3], payload[length-1],
- crc[2], payload[length-2],
- crc[1], payload[length-3],
- crc[0], payload[length-4]));
+ crc[3], payload[length - 1],
+ crc[2], payload[length - 2],
+ crc[1], payload[length - 3],
+ crc[0], payload[length - 4]));
}
WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
@@ -854,10 +854,10 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
RT_TRACE(_module_rtl871x_security_c_,
_drv_err_,
("rtw_wep_decrypt:icv error crc[3](%x)!=payload[length-1](%x) || crc[2](%x)!=payload[length-2](%x) || crc[1](%x)!=payload[length-3](%x) || crc[0](%x)!=payload[length-4](%x)\n",
- crc[3], payload[length-1],
- crc[2], payload[length-2],
- crc[1], payload[length-3],
- crc[0], payload[length-4]));
+ crc[3], payload[length - 1],
+ crc[2], payload[length - 2],
+ crc[1], payload[length - 3],
+ crc[0], payload[length - 4]));
res = _FAIL;
}
@@ -1624,11 +1624,11 @@ static sint aes_decipher(u8 *key, uint hdrlen,
payload_remainder = (plen-8) % 16;
pn_vector[0] = pframe[hdrlen];
- pn_vector[1] = pframe[hdrlen+1];
- pn_vector[2] = pframe[hdrlen+4];
- pn_vector[3] = pframe[hdrlen+5];
- pn_vector[4] = pframe[hdrlen+6];
- pn_vector[5] = pframe[hdrlen+7];
+ pn_vector[1] = pframe[hdrlen + 1];
+ pn_vector[2] = pframe[hdrlen + 4];
+ pn_vector[3] = pframe[hdrlen + 5];
+ pn_vector[4] = pframe[hdrlen + 6];
+ pn_vector[5] = pframe[hdrlen + 7];
if ((hdrlen == WLAN_HDR_A3_LEN) || (hdrlen == WLAN_HDR_A3_QOS_LEN))
a4_exists = 0;
@@ -1666,7 +1666,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
qc_exists,
pframe,
pn_vector,
- i+1,
+ i + 1,
frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
);
@@ -1849,13 +1849,13 @@ static sint aes_decipher(u8 *key, uint hdrlen,
("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
__func__,
i,
- pframe[hdrlen+8+plen-8+i],
- message[hdrlen+8+plen-8+i]));
+ pframe[hdrlen + 8 + plen - 8 + i],
+ message[hdrlen + 8 + plen - 8 + i]));
DBG_871X("%s:mic check error mic[%d]: pframe(%x) != message(%x)\n",
__func__,
i,
- pframe[hdrlen+8+plen-8+i],
- message[hdrlen+8+plen-8+i]);
+ pframe[hdrlen + 8 + plen - 8 + i],
+ message[hdrlen + 8 + plen - 8 + i]);
res = _FAIL;
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 4/7] staging: rtl8723bs: Remove commented code
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
` (2 preceding siblings ...)
2019-10-17 4:02 ` [PATCH v2 3/7] staging: rtl8723bs: Add spaces between operators Javier F. Arias
@ 2019-10-17 4:03 ` Javier F. Arias
2019-10-17 4:03 ` [PATCH v2 5/7] staging: rtl8723bs: Fix indentation warnings Javier F. Arias
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:03 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Remove commented code for a cleaner file.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 56 +++----------------
1 file changed, 9 insertions(+), 47 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 1bda534384a4..fea347e3a04c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -666,7 +666,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
u8 *pframe, *payload, *iv, *prwskey;
union pn48 dot11txpn;
- /* struct sta_info *stainfo; */
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
@@ -681,32 +680,12 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
/* 4 start to encrypt each fragment */
if (pattrib->encrypt == _TKIP_) {
-/*
- if (pattrib->psta)
{
- stainfo = pattrib->psta;
- }
- else
- {
- DBG_871X("%s, call rtw_get_stainfo()\n", __func__);
- stainfo =rtw_get_stainfo(&padapter->stapriv ,&pattrib->ra[0]);
- }
-*/
- /* if (stainfo!= NULL) */
- {
-/*
- if (!(stainfo->state &_FW_LINKED))
- {
- DBG_871X("%s, psta->state(0x%x) != _FW_LINKED\n", __func__, stainfo->state);
- return _FAIL;
- }
-*/
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo!= NULL!!!\n", __func__));
if (IS_MCAST(pattrib->ra))
prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
else
- /* prwskey =&stainfo->dot118021x_UncstKey.skey[0]; */
prwskey = pattrib->dot118021x_UncstKey.skey;
prwskeylen = 16;
@@ -747,13 +726,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
TKIP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
}
-/*
- else {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("rtw_tkip_encrypt: stainfo == NULL!!!\n"));
- DBG_871X("%s, psta ==NUL\n", __func__);
- res = _FAIL;
- }
-*/
}
return res;
@@ -777,7 +749,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
-/* struct recv_priv *precvpriv =&padapter->recvpriv; */
u32 res = _SUCCESS;
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
@@ -822,8 +793,6 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
no_gkey_bc_cnt = 0;
no_gkey_mc_cnt = 0;
- /* DBG_871X("rx bc/mc packets, to perform sw rtw_tkip_decrypt\n"); */
- /* prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; */
prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey;
prwskeylen = 16;
} else {
@@ -1435,7 +1404,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
aes128k128d(key, chain_buffer, aes_out);
for (i = 0; i < num_blocks; i++) {
- bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
+ bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);
payload_index += 16;
aes128k128d(key, chain_buffer, aes_out);
@@ -1446,7 +1415,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++) {
- padded_buffer[j] = pframe[payload_index++];/* padded_buffer[j] = message[payload_index++]; */
+ padded_buffer[j] = pframe[payload_index++];
}
bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(key, chain_buffer, aes_out);
@@ -1458,7 +1427,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
/* Insert MIC into payload */
for (j = 0; j < 8; j++)
- pframe[payload_index+j] = mic[j]; /* message[payload_index+j] = mic[j]; */
+ pframe[payload_index+j] = mic[j];
payload_index = hdrlen + 8;
for (i = 0; i < num_blocks; i++) {
@@ -1472,9 +1441,9 @@ static sint aes_cipher(u8 *key, uint hdrlen,
frtype
); /* add for CONFIG_IEEE80211W, none 11w also can use */
aes128k128d(key, ctr_preload, aes_out);
- bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);/* bitwise_xor(aes_out, &message[payload_index], chain_buffer); */
+ bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);
for (j = 0; j < 16; j++)
- pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<16;j++) message[payload_index++] = chain_buffer[j]; */
+ pframe[payload_index++] = chain_buffer[j];
}
if (payload_remainder > 0) {
@@ -1493,12 +1462,12 @@ static sint aes_cipher(u8 *key, uint hdrlen,
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < payload_remainder; j++)
- padded_buffer[j] = pframe[payload_index+j];/* padded_buffer[j] = message[payload_index+j]; */
+ padded_buffer[j] = pframe[payload_index+j];
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < payload_remainder; j++)
- pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<payload_remainder;j++) message[payload_index++] = chain_buffer[j]; */
+ pframe[payload_index++] = chain_buffer[j];
}
/* Encrypt the MIC */
@@ -1515,12 +1484,12 @@ static sint aes_cipher(u8 *key, uint hdrlen,
for (j = 0; j < 16; j++)
padded_buffer[j] = 0x00;
for (j = 0; j < 8; j++)
- padded_buffer[j] = pframe[j+hdrlen+8+plen];/* padded_buffer[j] = message[j+hdrlen+8+plen]; */
+ padded_buffer[j] = pframe[j+hdrlen+8+plen];
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < 8; j++)
- pframe[payload_index++] = chain_buffer[j];/* for (j = 0; j<8;j++) message[payload_index++] = chain_buffer[j]; */
+ pframe[payload_index++] = chain_buffer[j];
return _SUCCESS;
}
@@ -1537,12 +1506,10 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
u32 prwskeylen;
u8 *pframe, *prwskey; /* *payload,*iv */
u8 hw_hdr_offset = 0;
- /* struct sta_info *stainfo = NULL; */
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
-/* uint offset = 0; */
u32 res = _SUCCESS;
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
@@ -1558,7 +1525,6 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
if (IS_MCAST(pattrib->ra))
prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
else
- /* prwskey =&stainfo->dot118021x_UncstKey.skey[0]; */
prwskey = pattrib->dot118021x_UncstKey.skey;
prwskeylen = 16;
@@ -1602,7 +1568,6 @@ static sint aes_decipher(u8 *key, uint hdrlen,
u8 mic[8];
-/* uint offset = 0; */
uint frtype = GetFrameType(pframe);
uint frsubtype = GetFrameSubType(pframe);
@@ -1878,7 +1843,6 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
struct security_priv *psecuritypriv = &padapter->securitypriv;
-/* struct recv_priv *precvpriv =&padapter->recvpriv; */
u32 res = _SUCCESS;
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
@@ -1895,8 +1859,6 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
static u32 no_gkey_bc_cnt;
static u32 no_gkey_mc_cnt;
- /* DBG_871X("rx bc/mc packets, to perform sw rtw_aes_decrypt\n"); */
- /* prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey; */
if (psecuritypriv->binstallGrpkey == false) {
res = _FAIL;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 5/7] staging: rtl8723bs: Fix indentation warnings
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
` (3 preceding siblings ...)
2019-10-17 4:03 ` [PATCH v2 4/7] staging: rtl8723bs: Remove commented code Javier F. Arias
@ 2019-10-17 4:03 ` Javier F. Arias
2019-10-17 4:04 ` [PATCH v2 6/7] staging: rtl8723bs: Fix function call format Javier F. Arias
2019-10-17 4:05 ` [PATCH v2 7/7] staging: rtl8723bs: Change tabs for spaces Javier F. Arias
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:03 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Fix indentation warnings to improve the code formatting.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index fea347e3a04c..ea6e5bad2a51 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -1489,7 +1489,7 @@ static sint aes_cipher(u8 *key, uint hdrlen,
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, padded_buffer, chain_buffer);
for (j = 0; j < 8; j++)
- pframe[payload_index++] = chain_buffer[j];
+ pframe[payload_index++] = chain_buffer[j];
return _SUCCESS;
}
@@ -1625,7 +1625,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
payload_index = hdrlen + 8; /* 8 is for extiv */
for (i = 0; i < num_blocks; i++) {
- construct_ctr_preload(
+ construct_ctr_preload(
ctr_preload,
a4_exists,
qc_exists,
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 6/7] staging: rtl8723bs: Fix function call format
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
` (4 preceding siblings ...)
2019-10-17 4:03 ` [PATCH v2 5/7] staging: rtl8723bs: Fix indentation warnings Javier F. Arias
@ 2019-10-17 4:04 ` Javier F. Arias
2019-10-17 4:05 ` [PATCH v2 7/7] staging: rtl8723bs: Change tabs for spaces Javier F. Arias
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:04 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Fix function call format by following the coding style guidelines
for argument wrapping in function calls.
Issue found by checkpatch.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index ea6e5bad2a51..bf3fdf6d539b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -1549,7 +1549,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
}
static sint aes_decipher(u8 *key, uint hdrlen,
- u8 *pframe, uint plen)
+ u8 *pframe, uint plen)
{
static u8 message[MAX_MSG_SIZE];
uint qc_exists, a4_exists, i, j, payload_remainder,
@@ -1625,15 +1625,10 @@ static sint aes_decipher(u8 *key, uint hdrlen,
payload_index = hdrlen + 8; /* 8 is for extiv */
for (i = 0; i < num_blocks; i++) {
- construct_ctr_preload(
- ctr_preload,
- a4_exists,
- qc_exists,
- pframe,
- pn_vector,
- i + 1,
- frtype /* add for CONFIG_IEEE80211W, none 11w also can use */
- );
+ construct_ctr_preload(ctr_preload, a4_exists,
+ qc_exists, pframe,
+ pn_vector, i + 1,
+ frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
aes128k128d(key, ctr_preload, aes_out);
bitwise_xor(aes_out, &pframe[payload_index], chain_buffer);
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH v2 7/7] staging: rtl8723bs: Change tabs for spaces
2019-10-17 4:01 [PATCH v2 0/7] staging: rtl8723bs: Clean-up in rtw_security.c Javier F. Arias
` (5 preceding siblings ...)
2019-10-17 4:04 ` [PATCH v2 6/7] staging: rtl8723bs: Fix function call format Javier F. Arias
@ 2019-10-17 4:05 ` Javier F. Arias
6 siblings, 0 replies; 8+ messages in thread
From: Javier F. Arias @ 2019-10-17 4:05 UTC (permalink / raw)
To: gregkh; +Cc: outreachy-kernel
Change tabs for spaces when they are incorrectly used as separators.
Fix suggested by Julia Lawall.
Signed-off-by: Javier F. Arias <jarias.linux@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index bf3fdf6d539b..63b65359e37a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -1552,7 +1552,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen)
{
static u8 message[MAX_MSG_SIZE];
- uint qc_exists, a4_exists, i, j, payload_remainder,
+ uint qc_exists, a4_exists, i, j, payload_remainder,
num_blocks, payload_index;
sint res = _SUCCESS;
u8 pn_vector[6];
@@ -1568,8 +1568,8 @@ static sint aes_decipher(u8 *key, uint hdrlen,
u8 mic[8];
- uint frtype = GetFrameType(pframe);
- uint frsubtype = GetFrameSubType(pframe);
+ uint frtype = GetFrameType(pframe);
+ uint frsubtype = GetFrameSubType(pframe);
frsubtype = frsubtype>>4;
--
2.20.1
^ permalink raw reply related [flat|nested] 8+ messages in thread