mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-06-23 08:34:20 +00:00
rtl8188eu: Remove _func_enter_ and _func_exit_ statements
Kernel tracing is more effective. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
86fdc52e9a
commit
e91077579f
29 changed files with 671 additions and 746 deletions
|
@ -41,7 +41,7 @@ static void arcfour_init(struct arc4context *parc4ctx, u8 *key, u32 key_len)
|
|||
u32 stateindex;
|
||||
u8 *state;
|
||||
u32 counter;
|
||||
_func_enter_;
|
||||
|
||||
state = parc4ctx->state;
|
||||
parc4ctx->x = 0;
|
||||
parc4ctx->y = 0;
|
||||
|
@ -58,7 +58,7 @@ _func_enter_;
|
|||
if (++keyindex >= key_len)
|
||||
keyindex = 0;
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static u32 arcfour_byte(struct arc4context *parc4ctx)
|
||||
|
@ -67,7 +67,7 @@ static u32 arcfour_byte(struct arc4context *parc4ctx)
|
|||
u32 y;
|
||||
u32 sx, sy;
|
||||
u8 *state;
|
||||
_func_enter_;
|
||||
|
||||
state = parc4ctx->state;
|
||||
x = (parc4ctx->x + 1) & 0xff;
|
||||
sx = state[x];
|
||||
|
@ -77,17 +77,17 @@ _func_enter_;
|
|||
parc4ctx->y = y;
|
||||
state[y] = (u8)sx;
|
||||
state[x] = (u8)sy;
|
||||
_func_exit_;
|
||||
|
||||
return state[(sx + sy) & 0xff];
|
||||
}
|
||||
|
||||
static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32 len)
|
||||
{
|
||||
u32 i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
dest[i] = src[i] ^ (unsigned char)arcfour_byte(parc4ctx);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static int bcrc32initialized;
|
||||
|
@ -102,9 +102,8 @@ static u8 crc32_reverseBit(u8 data)
|
|||
|
||||
static void crc32_init(void)
|
||||
{
|
||||
_func_enter_;
|
||||
if (bcrc32initialized == 1) {
|
||||
goto exit;
|
||||
return;
|
||||
} else {
|
||||
int i, j;
|
||||
u32 c;
|
||||
|
@ -126,15 +125,13 @@ _func_enter_;
|
|||
}
|
||||
bcrc32initialized = 1;
|
||||
}
|
||||
exit:
|
||||
_func_exit_;
|
||||
}
|
||||
|
||||
static __le32 getcrc32(u8 *buf, int len)
|
||||
{
|
||||
u8 *p;
|
||||
u32 crc;
|
||||
_func_enter_;
|
||||
|
||||
if (bcrc32initialized == 0)
|
||||
crc32_init();
|
||||
|
||||
|
@ -142,7 +139,7 @@ _func_enter_;
|
|||
|
||||
for (p = buf; len > 0; ++p, --len)
|
||||
crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8);
|
||||
_func_exit_;
|
||||
|
||||
return cpu_to_le32(~crc); /* transmit complement, per CRC-32 spec */
|
||||
}
|
||||
|
||||
|
@ -165,7 +162,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return;
|
||||
|
@ -206,7 +203,7 @@ _func_enter_;
|
|||
}
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
|
||||
|
@ -221,7 +218,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
struct rx_pkt_attrib *prxattrib = &(((union recv_frame *)precvframe)->u.hdr.attrib);
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
|
||||
|
@ -252,7 +249,7 @@ _func_enter_;
|
|||
&crc, &payload[length-4]));
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -263,10 +260,10 @@ static u32 secmicgetuint32(u8 *p)
|
|||
{
|
||||
s32 i;
|
||||
u32 res = 0;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
res |= ((u32)(*p++)) << (8*i);
|
||||
_func_exit_;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -274,39 +271,39 @@ static void secmicputuint32(u8 *p, u32 val)
|
|||
/* Convert from Us3232 to Byte[] in a portable way */
|
||||
{
|
||||
long i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
*p++ = (u8) (val & 0xff);
|
||||
val >>= 8;
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void secmicclear(struct mic_data *pmicdata)
|
||||
{
|
||||
/* Reset the state to the empty message. */
|
||||
_func_enter_;
|
||||
|
||||
pmicdata->L = pmicdata->K0;
|
||||
pmicdata->R = pmicdata->K1;
|
||||
pmicdata->nBytesInM = 0;
|
||||
pmicdata->M = 0;
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key)
|
||||
{
|
||||
/* Set the key */
|
||||
_func_enter_;
|
||||
|
||||
pmicdata->K0 = secmicgetuint32(key);
|
||||
pmicdata->K1 = secmicgetuint32(key + 4);
|
||||
/* and reset the message */
|
||||
secmicclear(pmicdata);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_secmicappendbyte(struct mic_data *pmicdata, u8 b)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
/* Append the byte to our word-sized buffer */
|
||||
pmicdata->M |= ((unsigned long)b) << (8*pmicdata->nBytesInM);
|
||||
pmicdata->nBytesInM++;
|
||||
|
@ -325,23 +322,23 @@ _func_enter_;
|
|||
pmicdata->M = 0;
|
||||
pmicdata->nBytesInM = 0;
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nbytes)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
/* This is simple */
|
||||
while (nbytes > 0) {
|
||||
rtw_secmicappendbyte(pmicdata, *src++);
|
||||
nbytes--;
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
/* Append the minimum padding */
|
||||
rtw_secmicappendbyte(pmicdata, 0x5a);
|
||||
rtw_secmicappendbyte(pmicdata, 0);
|
||||
|
@ -356,14 +353,14 @@ _func_enter_;
|
|||
secmicputuint32(dst+4, pmicdata->R);
|
||||
/* Reset to the empty message. */
|
||||
secmicclear(pmicdata);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len, u8 *mic_code, u8 pri)
|
||||
{
|
||||
struct mic_data micdata;
|
||||
u8 priority[4] = {0x0, 0x0, 0x0, 0x0};
|
||||
_func_enter_;
|
||||
|
||||
rtw_secmicsetkey(&micdata, key);
|
||||
priority[0] = pri;
|
||||
|
||||
|
@ -386,7 +383,7 @@ _func_enter_;
|
|||
rtw_secmicappend(&micdata, data, data_len);
|
||||
|
||||
rtw_secgetmic(&micdata, mic_code);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -505,7 +502,7 @@ static const unsigned short Sbox1[2][256] = { /* Sbox for hash (can be in ROM)
|
|||
static void phase1(u16 *p1k, const u8 *tk, const u8 *ta, u32 iv32)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
/* Initialize the 80 bits of P1K[] from IV32 and TA[0..5] */
|
||||
p1k[0] = Lo16(iv32);
|
||||
p1k[1] = Hi16(iv32);
|
||||
|
@ -523,7 +520,7 @@ _func_enter_;
|
|||
p1k[4] += _S_(p1k[3] ^ TK16((i&1)+0));
|
||||
p1k[4] += (unsigned short)i; /* avoid "slide attacks" */
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -553,7 +550,7 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
|
|||
{
|
||||
int i;
|
||||
u16 PPK[6]; /* temporary key for mixing */
|
||||
_func_enter_;
|
||||
|
||||
/* Note: all adds in the PPK[] equations below are mod 2**16 */
|
||||
for (i = 0; i < 5; i++)
|
||||
PPK[i] = p1k[i]; /* first, copy P1K to PPK */
|
||||
|
@ -590,7 +587,7 @@ _func_enter_;
|
|||
rc4key[4+2*i] = Lo8(PPK[i]);
|
||||
rc4key[5+2*i] = Hi8(PPK[i]);
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/* The hlen isn't include the IV */
|
||||
|
@ -612,7 +609,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
@ -672,7 +669,7 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -694,7 +691,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
|
||||
|
@ -747,7 +744,7 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
@ -821,19 +818,19 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext);
|
|||
static void xor_128(u8 *a, u8 *b, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = a[i] ^ b[i];
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void xor_32(u8 *a, u8 *b, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
out[i] = a[i] ^ b[i];
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static u8 sbox(u8 a)
|
||||
|
@ -849,7 +846,7 @@ static void next_key(u8 *key, int round)
|
|||
0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||
0x1b, 0x36, 0x36, 0x36
|
||||
};
|
||||
_func_enter_;
|
||||
|
||||
sbox_key[0] = sbox(key[13]);
|
||||
sbox_key[1] = sbox(key[14]);
|
||||
sbox_key[2] = sbox(key[15]);
|
||||
|
@ -863,21 +860,21 @@ _func_enter_;
|
|||
xor_32(&key[4], &key[0], &key[4]);
|
||||
xor_32(&key[8], &key[4], &key[8]);
|
||||
xor_32(&key[12], &key[8], &key[12]);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void byte_sub(u8 *in, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = sbox(in[i]);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void shift_row(u8 *in, u8 *out)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
out[0] = in[0];
|
||||
out[1] = in[5];
|
||||
out[2] = in[10];
|
||||
|
@ -894,7 +891,7 @@ _func_enter_;
|
|||
out[13] = in[1];
|
||||
out[14] = in[6];
|
||||
out[15] = in[11];
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void mix_column(u8 *in, u8 *out)
|
||||
|
@ -908,7 +905,7 @@ static void mix_column(u8 *in, u8 *out)
|
|||
u8 rotr[4];
|
||||
u8 temp[4];
|
||||
u8 tempb[4];
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0 ; i < 4; i++) {
|
||||
if ((in[i] & 0x80) == 0x80)
|
||||
add1b[i] = 0x1b;
|
||||
|
@ -952,7 +949,7 @@ _func_enter_;
|
|||
xor_32(add1bf7, rotr, temp);
|
||||
xor_32(swap_halfs, rotl, tempb);
|
||||
xor_32(temp, tempb, out);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
|
||||
|
@ -962,7 +959,7 @@ static void aes128k128d(u8 *key, u8 *data, u8 *ciphertext)
|
|||
u8 intermediatea[16];
|
||||
u8 intermediateb[16];
|
||||
u8 round_key[16];
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
round_key[i] = key[i];
|
||||
for (round = 0; round < 11; round++) {
|
||||
|
@ -984,7 +981,7 @@ _func_enter_;
|
|||
next_key(round_key, round);
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -995,7 +992,7 @@ static void construct_mic_iv(u8 *mic_iv, int qc_exists, int a4_exists, u8 *mpdu,
|
|||
uint payload_length, u8 *pn_vector)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
mic_iv[0] = 0x59;
|
||||
if (qc_exists && a4_exists)
|
||||
mic_iv[1] = mpdu[30] & 0x0f; /* QoS_TC */
|
||||
|
@ -1009,7 +1006,7 @@ _func_enter_;
|
|||
mic_iv[i] = pn_vector[13 - i]; /* mic_iv[8:13] = PN[5:0] */
|
||||
mic_iv[14] = (unsigned char) (payload_length / 256);
|
||||
mic_iv[15] = (unsigned char) (payload_length % 256);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1019,7 +1016,7 @@ _func_exit_;
|
|||
/************************************************/
|
||||
static void construct_mic_header1(u8 *mic_header1, int header_length, u8 *mpdu)
|
||||
{
|
||||
_func_enter_;
|
||||
|
||||
mic_header1[0] = (u8)((header_length - 2) / 256);
|
||||
mic_header1[1] = (u8)((header_length - 2) % 256);
|
||||
mic_header1[2] = mpdu[0] & 0xcf; /* Mute CF poll & CF ack bits */
|
||||
|
@ -1036,7 +1033,7 @@ _func_enter_;
|
|||
mic_header1[13] = mpdu[13];
|
||||
mic_header1[14] = mpdu[14];
|
||||
mic_header1[15] = mpdu[15];
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1047,7 +1044,7 @@ _func_exit_;
|
|||
static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, int a4_exists, int qc_exists)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
mic_header2[i] = 0x00;
|
||||
|
||||
|
@ -1079,7 +1076,7 @@ _func_enter_;
|
|||
mic_header2[15] = mpdu[31] & 0x00;
|
||||
}
|
||||
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/************************************************/
|
||||
|
@ -1090,7 +1087,7 @@ _func_exit_;
|
|||
static void construct_ctr_preload(u8 *ctr_preload, int a4_exists, int qc_exists, u8 *mpdu, u8 *pn_vector, int c)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
ctr_preload[i] = 0x00;
|
||||
i = 0;
|
||||
|
@ -1107,7 +1104,7 @@ _func_enter_;
|
|||
ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
|
||||
ctr_preload[14] = (unsigned char) (c / 256); /* Ctr */
|
||||
ctr_preload[15] = (unsigned char) (c % 256);
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
/************************************/
|
||||
|
@ -1117,10 +1114,10 @@ _func_exit_;
|
|||
static void bitwise_xor(u8 *ina, u8 *inb, u8 *out)
|
||||
{
|
||||
int i;
|
||||
_func_enter_;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
out[i] = ina[i] ^ inb[i];
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
||||
static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
|
||||
|
@ -1142,7 +1139,7 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
|
|||
uint frtype = GetFrameType(pframe);
|
||||
uint frsubtype = GetFrameSubType(pframe);
|
||||
|
||||
_func_enter_;
|
||||
|
||||
frsubtype = frsubtype>>4;
|
||||
|
||||
_rtw_memset((void *)mic_iv, 0, 16);
|
||||
|
@ -1253,7 +1250,7 @@ _func_enter_;
|
|||
bitwise_xor(aes_out, padded_buffer, chain_buffer);
|
||||
for (j = 0; j < 8; j++)
|
||||
pframe[payload_index++] = chain_buffer[j];
|
||||
_func_exit_;
|
||||
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -1274,7 +1271,7 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
|
||||
/* uint offset = 0; */
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
|
||||
|
||||
if (((struct xmit_frame *)pxmitframe)->buf_addr == NULL)
|
||||
return _FAIL;
|
||||
|
@ -1318,7 +1315,7 @@ _func_enter_;
|
|||
}
|
||||
|
||||
|
||||
_func_exit_;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1344,7 +1341,7 @@ static int aes_decipher(u8 *key, uint hdrlen,
|
|||
/* uint offset = 0; */
|
||||
uint frtype = GetFrameType(pframe);
|
||||
uint frsubtype = GetFrameSubType(pframe);
|
||||
_func_enter_;
|
||||
|
||||
frsubtype = frsubtype>>4;
|
||||
|
||||
_rtw_memset((void *)mic_iv, 0, 16);
|
||||
|
@ -1514,7 +1511,7 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1527,7 +1524,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
struct rx_pkt_attrib *prxattrib = &((union recv_frame *)precvframe)->u.hdr.attrib;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
u32 res = _SUCCESS;
|
||||
_func_enter_;
|
||||
|
||||
pframe = (unsigned char *)((union recv_frame *)precvframe)->u.hdr.rx_data;
|
||||
/* 4 start to encrypt each fragment */
|
||||
if ((prxattrib->encrypt == _AES_)) {
|
||||
|
@ -1559,7 +1556,7 @@ _func_enter_;
|
|||
res = _FAIL;
|
||||
}
|
||||
}
|
||||
_func_exit_;
|
||||
|
||||
exit:
|
||||
return res;
|
||||
}
|
||||
|
@ -1767,7 +1764,7 @@ void rtw_use_tkipkey_handler(void *FunctionContext)
|
|||
{
|
||||
struct adapter *padapter = (struct adapter *)FunctionContext;
|
||||
|
||||
_func_enter_;
|
||||
|
||||
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("^^^rtw_use_tkipkey_handler ^^^\n"));
|
||||
|
||||
|
@ -1775,5 +1772,5 @@ _func_enter_;
|
|||
|
||||
RT_TRACE(_module_rtl871x_security_c_, _drv_err_, ("^^^rtw_use_tkipkey_handler padapter->securitypriv.busetkipkey=%d^^^\n", padapter->securitypriv.busetkipkey));
|
||||
|
||||
_func_exit_;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue