rtl8188eu: Fix some sparse warnings

The driver did not work on PowerPC, which is big endian. This patch
fixes all the sparse warnings concerning improper use of __le16 and __le32
variables.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-01-27 23:14:58 -06:00
parent 77e8b5de91
commit 7c7f632ac7
25 changed files with 502 additions and 684 deletions

View file

@ -139,7 +139,7 @@ exit:
;
}
static u32 getcrc32(u8 *buf, sint len)
static __le32 getcrc32(u8 *buf, sint len)
{
u8 *p;
u32 crc;
@ -153,7 +153,7 @@ static u32 getcrc32(u8 *buf, sint len)
crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8);
}
;
return ~crc; /* transmit complement, per CRC-32 spec */
return cpu_to_le32(~crc); /* transmit complement, per CRC-32 spec */
}
@ -212,7 +212,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));
*((__le32 *)crc)=getcrc32(payload,length);
arcfour_init(&mycontext, wepkey,3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length);
@ -222,7 +222,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
else
{
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));
*((__le32 *)crc)=getcrc32(payload,length);
arcfour_init(&mycontext, wepkey,3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4);
@ -275,7 +275,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
arcfour_encrypt(&mycontext, payload, payload, length);
//calculate icv and compare the icv
*((u32 *)crc)=le32_to_cpu(getcrc32(payload,length-4));
*((__le32 *)crc)=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])
{
@ -734,7 +734,7 @@ 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));
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
*((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/
arcfour_init(&mycontext, rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length);
@ -743,7 +743,7 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
}
else{
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
*((u32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/
*((__le32 *)crc)=getcrc32(payload,length);/* modified by Amy*/
arcfour_init(&mycontext,rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4);
@ -866,7 +866,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)
arcfour_init(&mycontext, rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length);
*((u32 *)crc)=le32_to_cpu(getcrc32(payload,length-4));
*((__le32 *)crc)=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])
{
@ -2896,7 +2896,7 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem,
* OMAC1 was standardized with the name CMAC by NIST in a Special Publication
* (SP) 800-38B.
*/ //modify for CONFIG_IEEE80211W
int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac)
{
return omac1_aes_128_vector(key, 1, &data, &data_len, mac);
}