summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8723bs/core/rtw_security.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rtl8723bs/core/rtw_security.c')
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_security.c283
1 files changed, 92 insertions, 191 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index a311595deafb..7823055ed32d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -29,63 +29,6 @@ const char *security_type_str(u8 value)
return NULL;
}
-#ifdef DBG_SW_SEC_CNT
-#define WEP_SW_ENC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->wep_sw_enc_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->wep_sw_enc_cnt_mc++; \
- else \
- sec->wep_sw_enc_cnt_uc++;
-
-#define WEP_SW_DEC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->wep_sw_dec_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->wep_sw_dec_cnt_mc++; \
- else \
- sec->wep_sw_dec_cnt_uc++;
-
-#define TKIP_SW_ENC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->tkip_sw_enc_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->tkip_sw_enc_cnt_mc++; \
- else \
- sec->tkip_sw_enc_cnt_uc++;
-
-#define TKIP_SW_DEC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->tkip_sw_dec_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->tkip_sw_dec_cnt_mc++; \
- else \
- sec->tkip_sw_dec_cnt_uc++;
-
-#define AES_SW_ENC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->aes_sw_enc_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->aes_sw_enc_cnt_mc++; \
- else \
- sec->aes_sw_enc_cnt_uc++;
-
-#define AES_SW_DEC_CNT_INC(sec, ra) \
- if (is_broadcast_mac_addr(ra)) \
- sec->aes_sw_dec_cnt_bc++; \
- else if (is_multicast_mac_addr(ra)) \
- sec->aes_sw_dec_cnt_mc++; \
- else \
- sec->aes_sw_dec_cnt_uc++;
-#else
-#define WEP_SW_ENC_CNT_INC(sec, ra)
-#define WEP_SW_DEC_CNT_INC(sec, ra)
-#define TKIP_SW_ENC_CNT_INC(sec, ra)
-#define TKIP_SW_DEC_CNT_INC(sec, ra)
-#define AES_SW_ENC_CNT_INC(sec, ra)
-#define AES_SW_DEC_CNT_INC(sec, ra)
-#endif /* DBG_SW_SEC_CNT */
-
/* WEP related ===== */
struct arc4context {
@@ -148,7 +91,7 @@ static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32
dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx);
}
-static sint bcrc32initialized;
+static signed int bcrc32initialized;
static u32 crc32_table[256];
@@ -162,7 +105,7 @@ static void crc32_init(void)
if (bcrc32initialized == 1)
return;
else {
- sint i, j;
+ signed int i, j;
u32 c;
u8 *p = (u8 *)&c, *p1;
u8 k;
@@ -184,7 +127,7 @@ static void crc32_init(void)
}
}
-static __le32 getcrc32(u8 *buf, sint len)
+static __le32 getcrc32(u8 *buf, signed int len)
{
u8 *p;
u32 crc;
@@ -209,7 +152,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
unsigned char crc[4];
struct arc4context mycontext;
- sint curfragnum, length;
+ signed int curfragnum, length;
u32 keylength;
u8 *pframe, *payload, *iv; /* wepkey */
@@ -256,8 +199,6 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
}
}
-
- WEP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
}
}
@@ -266,7 +207,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
/* exclude ICV */
u8 crc[4];
struct arc4context mycontext;
- sint length;
+ signed int length;
u32 keylength;
u8 *pframe, *payload, *iv, wepkey[16];
u8 keyindex;
@@ -295,18 +236,6 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
/* calculate icv and compare the icv */
*((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]));
- }
-
- WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
}
}
@@ -319,7 +248,7 @@ static u32 secmicgetuint32(u8 *p)
u32 res = 0;
for (i = 0; i < 4; i++)
- res |= ((u32)(*p++)) << (8*i);
+ res |= ((u32)(*p++)) << (8 * i);
return res;
}
@@ -397,7 +326,7 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
rtw_secmicappendbyte(pmicdata, 0);
/* The appendByte function has already computed the result. */
secmicputuint32(dst, pmicdata->L);
- secmicputuint32(dst+4, pmicdata->R);
+ secmicputuint32(dst + 4, pmicdata->R);
/* Reset to the empty message. */
secmicclear(pmicdata);
}
@@ -413,15 +342,15 @@ void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_cod
priority[0] = pri;
/* Michael MIC pseudo header: DA, SA, 3 x 0, Priority */
- if (header[1]&1) { /* ToDS == 1 */
+ if (header[1] & 1) { /* ToDS == 1 */
rtw_secmicappend(&micdata, &header[16], 6); /* DA */
- if (header[1]&2) /* From Ds == 1 */
+ if (header[1] & 2) /* From Ds == 1 */
rtw_secmicappend(&micdata, &header[24], 6);
else
rtw_secmicappend(&micdata, &header[10], 6);
} else { /* ToDS == 0 */
rtw_secmicappend(&micdata, &header[4], 6); /* DA */
- if (header[1]&2) /* From Ds == 1 */
+ if (header[1] & 2) /* From Ds == 1 */
rtw_secmicappend(&micdata, &header[16], 6);
else
rtw_secmicappend(&micdata, &header[10], 6);
@@ -549,7 +478,7 @@ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in R
*/
static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
{
- sint i;
+ signed int i;
/* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */
p1k[0] = Lo16(iv32);
@@ -597,7 +526,7 @@ static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
*/
static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
{
- sint i;
+ signed int i;
u16 PPK[6]; /* temporary key for mixing */
/* Note: all adds in the PPK[] equations below are mod 2**16 */
@@ -651,7 +580,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
u8 crc[4];
u8 hw_hdr_offset = 0;
struct arc4context mycontext;
- sint curfragnum, length;
+ signed int curfragnum, length;
u8 *pframe, *payload, *iv, *prwskey;
union pn48 dot11txpn;
@@ -670,8 +599,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
if (pattrib->encrypt == _TKIP_) {
{
- 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
@@ -692,7 +619,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
if ((curfragnum+1) == pattrib->nr_frags) { /* 4 the last fragment */
length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
- RT_TRACE(_module_rtl871x_security_c_, _drv_info_, ("pattrib->iv_len =%x, pattrib->icv_len =%x\n", pattrib->iv_len, pattrib->icv_len));
*((__le32 *)crc) = getcrc32(payload, length);/* modified by Amy*/
arcfour_init(&mycontext, rc4key, 16);
@@ -710,8 +636,6 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
}
}
-
- TKIP_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
}
}
return res;
@@ -727,7 +651,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
u8 ttkey[16];
u8 crc[4];
struct arc4context mycontext;
- sint length;
+ signed int length;
u8 *pframe, *payload, *iv, *prwskey;
union pn48 dot11txpn;
@@ -760,8 +684,11 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
- DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
- FUNC_ADPT_ARG(padapter), no_gkey_bc_cnt, no_gkey_mc_cnt);
+ netdev_dbg(padapter->pnetdev,
+ FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_ARG(padapter),
+ no_gkey_bc_cnt,
+ no_gkey_mc_cnt);
}
start = jiffies;
no_gkey_bc_cnt = 0;
@@ -771,8 +698,11 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
}
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
- DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
- FUNC_ADPT_ARG(padapter), no_gkey_bc_cnt, no_gkey_mc_cnt);
+ netdev_dbg(padapter->pnetdev,
+ FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_ARG(padapter),
+ no_gkey_bc_cnt,
+ no_gkey_mc_cnt);
}
start = 0;
no_gkey_bc_cnt = 0;
@@ -802,20 +732,10 @@ 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_,
- ("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]));
+ if (crc[3] != payload[length - 1] || crc[2] != payload[length - 2] ||
+ crc[1] != payload[length - 3] || crc[0] != payload[length - 4])
res = _FAIL;
- }
-
- TKIP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
} else {
- RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("%s: stainfo == NULL!!!\n", __func__));
res = _FAIL;
}
}
@@ -874,31 +794,31 @@ exit:
static void bitwise_xor(u8 *ina, u8 *inb, u8 *out);
static void construct_mic_iv(u8 *mic_header1,
- sint qc_exists,
- sint a4_exists,
+ signed int qc_exists,
+ signed int a4_exists,
u8 *mpdu,
uint payload_length,
u8 *pn_vector,
uint frtype); /* add for CONFIG_IEEE80211W, none 11w also can use */
static void construct_mic_header1(u8 *mic_header1,
- sint header_length,
+ signed int header_length,
u8 *mpdu,
uint frtype); /* for CONFIG_IEEE80211W, none 11w also can use */
static void construct_mic_header2(u8 *mic_header2,
u8 *mpdu,
- sint a4_exists,
- sint qc_exists);
+ signed int a4_exists,
+ signed int qc_exists);
static void construct_ctr_preload(u8 *ctr_preload,
- sint a4_exists,
- sint qc_exists,
+ signed int a4_exists,
+ signed int qc_exists,
u8 *mpdu,
u8 *pn_vector,
- sint c,
+ signed int c,
uint frtype); /* for CONFIG_IEEE80211W, none 11w also can use */
static void xor_128(u8 *a, u8 *b, u8 *out);
static void xor_32(u8 *a, u8 *b, u8 *out);
static u8 sbox(u8 a);
-static void next_key(u8 *key, sint round);
+static void next_key(u8 *key, signed int round);
static void byte_sub(u8 *in, u8 *out);
static void shift_row(u8 *in, u8 *out);
static void mix_column(u8 *in, u8 *out);
@@ -912,7 +832,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
/****************************************/
static void xor_128(u8 *a, u8 *b, u8 *out)
{
- sint i;
+ signed int i;
for (i = 0; i < 16; i++)
out[i] = a[i] ^ b[i];
@@ -921,7 +841,7 @@ static void xor_128(u8 *a, u8 *b, u8 *out)
static void xor_32(u8 *a, u8 *b, u8 *out)
{
- sint i;
+ signed int i;
for (i = 0; i < 4; i++)
out[i] = a[i] ^ b[i];
@@ -930,11 +850,11 @@ static void xor_32(u8 *a, u8 *b, u8 *out)
static u8 sbox(u8 a)
{
- return sbox_table[(sint)a];
+ return sbox_table[(signed int)a];
}
-static void next_key(u8 *key, sint round)
+static void next_key(u8 *key, signed int round)
{
u8 rcon;
u8 sbox_key[4];
@@ -961,7 +881,7 @@ static void next_key(u8 *key, sint round)
static void byte_sub(u8 *in, u8 *out)
{
- sint i;
+ signed int i;
for (i = 0; i < 16; i++)
out[i] = sbox(in[i]);
@@ -990,7 +910,7 @@ static void shift_row(u8 *in, u8 *out)
static void mix_column(u8 *in, u8 *out)
{
- sint i;
+ signed int i;
u8 add1b[4];
u8 add1bf7[4];
u8 rotl[4];
@@ -1047,8 +967,8 @@ static void mix_column(u8 *in, u8 *out)
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
{
- sint round;
- sint i;
+ signed int round;
+ signed int i;
u8 intermediatea[16];
u8 intermediateb[16];
u8 round_key[16];
@@ -1084,14 +1004,14 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
/* nonce */
/************************************************/
static void construct_mic_iv(u8 *mic_iv,
- sint qc_exists,
- sint a4_exists,
+ signed int qc_exists,
+ signed int a4_exists,
u8 *mpdu,
uint payload_length,
u8 *pn_vector,
uint frtype) /* add for CONFIG_IEEE80211W, none 11w also can use */
{
- sint i;
+ signed int i;
mic_iv[0] = 0x59;
@@ -1128,7 +1048,7 @@ static void construct_mic_iv(u8 *mic_iv,
/* Build AAD SC, A1, A2 */
/************************************************/
static void construct_mic_header1(u8 *mic_header1,
- sint header_length,
+ signed int header_length,
u8 *mpdu,
uint frtype) /* for CONFIG_IEEE80211W, none 11w also can use */
{
@@ -1163,10 +1083,10 @@ static void construct_mic_header1(u8 *mic_header1,
/************************************************/
static void construct_mic_header2(u8 *mic_header2,
u8 *mpdu,
- sint a4_exists,
- sint qc_exists)
+ signed int a4_exists,
+ signed int qc_exists)
{
- sint i;
+ signed int i;
for (i = 0; i < 16; i++)
mic_header2[i] = 0x00;
@@ -1208,14 +1128,14 @@ static void construct_mic_header2(u8 *mic_header2,
/* nonce */
/************************************************/
static void construct_ctr_preload(u8 *ctr_preload,
- sint a4_exists,
- sint qc_exists,
+ signed int a4_exists,
+ signed int qc_exists,
u8 *mpdu,
u8 *pn_vector,
- sint c,
+ signed int c,
uint frtype) /* for CONFIG_IEEE80211W, none 11w also can use */
{
- sint i = 0;
+ signed int i = 0;
for (i = 0; i < 16; i++)
ctr_preload[i] = 0x00;
@@ -1250,13 +1170,13 @@ static void construct_ctr_preload(u8 *ctr_preload,
/************************************/
static void bitwise_xor(u8 *ina, u8 *inb, u8 *out)
{
- sint i;
+ signed int i;
for (i = 0; i < 16; i++)
out[i] = ina[i] ^ inb[i];
}
-static sint aes_cipher(u8 *key, uint hdrlen,
+static signed int aes_cipher(u8 *key, uint hdrlen,
u8 *pframe, uint plen)
{
uint qc_exists, a4_exists, i, j, payload_remainder,
@@ -1428,7 +1348,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
/* unsigned char message[MAX_MSG_SIZE]; */
/* Intermediate Buffers */
- sint curfragnum, length;
+ signed int curfragnum, length;
u8 *pframe, *prwskey; /* *payload,*iv */
u8 hw_hdr_offset = 0;
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
@@ -1445,8 +1365,6 @@ 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_, ("%s: stainfo!= NULL!!!\n", __func__));
-
if (IS_MCAST(pattrib->ra))
prwskey = psecuritypriv->dot118021XGrpKey[psecuritypriv->dot118021XGrpKeyid].skey;
else
@@ -1465,19 +1383,17 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
pframe = (u8 *)round_up((SIZE_PTR)(pframe), 4);
}
}
-
- AES_SW_ENC_CNT_INC(psecuritypriv, pattrib->ra);
}
return res;
}
-static sint aes_decipher(u8 *key, uint hdrlen,
+static signed int 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,
num_blocks, payload_index;
- sint res = _SUCCESS;
+ signed int res = _SUCCESS;
u8 pn_vector[6];
u8 mic_iv[16];
u8 mic_header1[16];
@@ -1677,21 +1593,8 @@ 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]));
- 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]);
+ if (pframe[hdrlen + 8 + plen - 8 + i] != message[hdrlen + 8 + plen - 8 + i])
res = _FAIL;
- }
}
return res;
}
@@ -1704,7 +1607,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
/* Intermediate Buffers */
- sint length;
+ signed int length;
u8 *pframe, *prwskey; /* *payload,*iv */
struct sta_info *stainfo;
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
@@ -1716,10 +1619,6 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (prxattrib->encrypt == _AES_) {
stainfo = rtw_get_stainfo(&padapter->stapriv, &prxattrib->ta[0]);
if (stainfo) {
- RT_TRACE(_module_rtl871x_security_c_,
- _drv_err_,
- ("%s: stainfo!= NULL!!!\n", __func__));
-
if (IS_MCAST(prxattrib->ra)) {
static unsigned long start;
static u32 no_gkey_bc_cnt;
@@ -1738,8 +1637,11 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
if (jiffies_to_msecs(jiffies - start) > 1000) {
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
- DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
- FUNC_ADPT_ARG(padapter), no_gkey_bc_cnt, no_gkey_mc_cnt);
+ netdev_dbg(padapter->pnetdev,
+ FUNC_ADPT_FMT " no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_ARG(padapter),
+ no_gkey_bc_cnt,
+ no_gkey_mc_cnt);
}
start = jiffies;
no_gkey_bc_cnt = 0;
@@ -1750,8 +1652,11 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
}
if (no_gkey_bc_cnt || no_gkey_mc_cnt) {
- DBG_871X_LEVEL(_drv_always_, FUNC_ADPT_FMT" gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
- FUNC_ADPT_ARG(padapter), no_gkey_bc_cnt, no_gkey_mc_cnt);
+ netdev_dbg(padapter->pnetdev,
+ FUNC_ADPT_FMT " gkey installed. no_gkey_bc_cnt:%u, no_gkey_mc_cnt:%u\n",
+ FUNC_ADPT_ARG(padapter),
+ no_gkey_bc_cnt,
+ no_gkey_mc_cnt);
}
start = 0;
no_gkey_bc_cnt = 0;
@@ -1759,8 +1664,6 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
prwskey = psecuritypriv->dot118021XGrpKey[prxattrib->key_index].skey;
if (psecuritypriv->dot118021XGrpKeyid != prxattrib->key_index) {
- DBG_871X("not match packet_index =%d, install_index =%d\n"
- , prxattrib->key_index, psecuritypriv->dot118021XGrpKeyid);
res = _FAIL;
goto exit;
}
@@ -1772,11 +1675,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
res = aes_decipher(prwskey, prxattrib->hdrlen, pframe, length);
- AES_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra);
} else {
- RT_TRACE(_module_rtl871x_security_c_,
- _drv_err_,
- ("%s: stainfo == NULL!!!\n", __func__));
res = _FAIL;
}
}
@@ -1800,10 +1699,9 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
ori_len = pattrib->pkt_len-WLAN_HDR_A3_LEN+BIP_AAD_SIZE;
BIP_AAD = rtw_zmalloc(ori_len);
- if (BIP_AAD == NULL) {
- DBG_871X("BIP AAD allocate fail\n");
+ if (!BIP_AAD)
return _FAIL;
- }
+
/* PKT start */
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
/* mapping to wlan header */
@@ -1820,17 +1718,15 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
memcpy(&le_tmp64, p+4, 6);
temp_ipn = le64_to_cpu(le_tmp64);
/* BIP packet number should bigger than previous BIP packet */
- if (temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx) {
- DBG_871X("replay BIP packet\n");
+ if (temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx)
goto BIP_exit;
- }
+
/* copy key index */
memcpy(&le_tmp, p+2, 2);
keyid = le16_to_cpu(le_tmp);
- if (keyid != padapter->securitypriv.dot11wBIPKeyid) {
- DBG_871X("BIP key index error!\n");
+ if (keyid != padapter->securitypriv.dot11wBIPKeyid)
goto BIP_exit;
- }
+
/* clear the MIC field of MME to zero */
memset(p+2+len-8, 0, 8);
@@ -1851,7 +1747,6 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
pmlmeext->mgnt_80211w_IPN_rx = temp_ipn;
res = _SUCCESS;
} else {
- DBG_871X("BIP MIC error!\n");
}
} else {
@@ -2080,10 +1975,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 pt[16], u8 ct[16])
s3 = GETU32(pt + 12) ^ rk[3];
#define ROUND(i, d, s) \
-d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
-d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
-d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
-d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]
+ do { \
+ d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \
+ d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \
+ d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \
+ d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3]; \
+ } while (0)
/* Nr - 1 full rounds: */
r = Nr >> 1;
@@ -2241,7 +2138,7 @@ int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
void rtw_sec_restore_wep_key(struct adapter *adapter)
{
struct security_priv *securitypriv = &(adapter->securitypriv);
- sint keyid;
+ signed int keyid;
if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) || (_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) {
for (keyid = 0; keyid < 4; keyid++) {
@@ -2264,13 +2161,17 @@ u8 rtw_handle_tkip_countermeasure(struct adapter *adapter, const char *caller)
unsigned long passing_ms = jiffies_to_msecs(jiffies - securitypriv->btkip_countermeasure_time);
if (passing_ms > 60*1000) {
- DBG_871X_LEVEL(_drv_always_, "%s(%s) countermeasure time:%lus > 60s\n",
- caller, ADPT_ARG(adapter), passing_ms/1000);
+ netdev_dbg(adapter->pnetdev,
+ "%s(%s) countermeasure time:%lus > 60s\n",
+ caller, ADPT_ARG(adapter),
+ passing_ms / 1000);
securitypriv->btkip_countermeasure = false;
securitypriv->btkip_countermeasure_time = 0;
} else {
- DBG_871X_LEVEL(_drv_always_, "%s(%s) countermeasure time:%lus < 60s\n",
- caller, ADPT_ARG(adapter), passing_ms/1000);
+ netdev_dbg(adapter->pnetdev,
+ "%s(%s) countermeasure time:%lus < 60s\n",
+ caller, ADPT_ARG(adapter),
+ passing_ms / 1000);
status = _FAIL;
}
}