mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
staging: r8188eu: convert type of second parameter of rtw_*_encrypt()
Convert the type of the second parameter of the rtw_*_encrypt() functions to struct xmit_frame. All callers of the functions cast the type to (u8 *) and in the functions it is casted back to the original type. Changing the type of the second parameter to struct xmit_frame avoids these unnecessary casts and improves readability. Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210829112555.8726-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
41a4f38a68
commit
45efafd4cc
@@ -5040,7 +5040,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short
|
||||
|
||||
pattrib->last_txcmdsz = pattrib->pktlen;
|
||||
|
||||
rtw_wep_encrypt(padapter, (u8 *)pmgntframe);
|
||||
rtw_wep_encrypt(padapter, pmgntframe);
|
||||
DBG_88E("%s\n", __func__);
|
||||
dump_mgntframe(padapter, pmgntframe);
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ static void arcfour_encrypt(struct arc4context *parc4ctx, u8 *dest, u8 *src, u32
|
||||
/*
|
||||
Need to consider the fragment situation
|
||||
*/
|
||||
void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
void rtw_wep_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)
|
||||
{ /* exclude ICV */
|
||||
union {
|
||||
__le32 f0;
|
||||
@@ -91,17 +91,15 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
u8 *pframe, *payload, *iv; /* wepkey */
|
||||
u8 wepkey[16];
|
||||
u8 hw_hdr_offset = 0;
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
struct pkt_attrib *pattrib = &pxmitframe->attrib;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
|
||||
if (!((struct xmit_frame *)pxmitframe)->buf_addr)
|
||||
if (!pxmitframe->buf_addr)
|
||||
return;
|
||||
|
||||
hw_hdr_offset = TXDESC_SIZE +
|
||||
(((struct xmit_frame *)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ);
|
||||
|
||||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
|
||||
hw_hdr_offset = TXDESC_SIZE + pxmitframe->pkt_offset * PACKET_OFFSET_SZ;
|
||||
pframe = pxmitframe->buf_addr + hw_hdr_offset;
|
||||
|
||||
/* start to encrypt each fragment */
|
||||
if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) {
|
||||
@@ -502,7 +500,7 @@ static void phase2(u8 *rc4key, const u8 *tk, const u16 *p1k, u16 iv16)
|
||||
}
|
||||
|
||||
/* The hlen isn't include the IV */
|
||||
u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
u32 rtw_tkip_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)
|
||||
{ /* exclude ICV */
|
||||
u16 pnl;
|
||||
u32 pnh;
|
||||
@@ -519,17 +517,17 @@ 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 pkt_attrib *pattrib = &pxmitframe->attrib;
|
||||
struct security_priv *psecuritypriv = &padapter->securitypriv;
|
||||
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
|
||||
u32 res = _SUCCESS;
|
||||
|
||||
if (!((struct xmit_frame *)pxmitframe)->buf_addr)
|
||||
if (!pxmitframe->buf_addr)
|
||||
return _FAIL;
|
||||
|
||||
hw_hdr_offset = TXDESC_SIZE +
|
||||
(((struct xmit_frame *)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ);
|
||||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
|
||||
hw_hdr_offset = TXDESC_SIZE + pxmitframe->pkt_offset * PACKET_OFFSET_SZ;
|
||||
pframe = pxmitframe->buf_addr + hw_hdr_offset;
|
||||
|
||||
/* 4 start to encrypt each fragment */
|
||||
if (pattrib->encrypt == _TKIP_) {
|
||||
if (pattrib->psta)
|
||||
@@ -1154,7 +1152,7 @@ static int aes_cipher(u8 *key, uint hdrlen, u8 *pframe, uint plen)
|
||||
return _SUCCESS;
|
||||
}
|
||||
|
||||
u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
u32 rtw_aes_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe)
|
||||
{ /* exclude ICV */
|
||||
|
||||
/*static*/
|
||||
@@ -1165,20 +1163,18 @@ u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
||||
u8 *pframe, *prwskey; /* *payload,*iv */
|
||||
u8 hw_hdr_offset = 0;
|
||||
struct sta_info *stainfo;
|
||||
struct pkt_attrib *pattrib = &((struct xmit_frame *)pxmitframe)->attrib;
|
||||
struct pkt_attrib *pattrib = &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)
|
||||
if (!pxmitframe->buf_addr)
|
||||
return _FAIL;
|
||||
|
||||
hw_hdr_offset = TXDESC_SIZE +
|
||||
(((struct xmit_frame *)pxmitframe)->pkt_offset * PACKET_OFFSET_SZ);
|
||||
|
||||
pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
|
||||
hw_hdr_offset = TXDESC_SIZE + pxmitframe->pkt_offset * PACKET_OFFSET_SZ;
|
||||
pframe = pxmitframe->buf_addr + hw_hdr_offset;
|
||||
|
||||
/* 4 start to encrypt each fragment */
|
||||
if (pattrib->encrypt == _AES_) {
|
||||
|
||||
@@ -683,13 +683,13 @@ static s32 xmitframe_swencrypt(struct adapter *padapter, struct xmit_frame *pxmi
|
||||
switch (pattrib->encrypt) {
|
||||
case _WEP40_:
|
||||
case _WEP104_:
|
||||
rtw_wep_encrypt(padapter, (u8 *)pxmitframe);
|
||||
rtw_wep_encrypt(padapter, pxmitframe);
|
||||
break;
|
||||
case _TKIP_:
|
||||
rtw_tkip_encrypt(padapter, (u8 *)pxmitframe);
|
||||
rtw_tkip_encrypt(padapter, pxmitframe);
|
||||
break;
|
||||
case _AES_:
|
||||
rtw_aes_encrypt(padapter, (u8 *)pxmitframe);
|
||||
rtw_aes_encrypt(padapter, pxmitframe);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -330,9 +330,9 @@ void rtw_secmicappend(struct mic_data *pmicdata, u8 *src, u32 nBytes);
|
||||
void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst);
|
||||
void rtw_seccalctkipmic(u8 *key, u8 *header, u8 *data, u32 data_len,
|
||||
u8 *Miccode, u8 priority);
|
||||
u32 rtw_aes_encrypt(struct adapter *padapter, u8 *pxmitframe);
|
||||
u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe);
|
||||
void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe);
|
||||
u32 rtw_aes_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe);
|
||||
u32 rtw_tkip_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe);
|
||||
void rtw_wep_encrypt(struct adapter *padapter, struct xmit_frame *pxmitframe);
|
||||
u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe);
|
||||
u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe);
|
||||
void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe);
|
||||
|
||||
Reference in New Issue
Block a user