mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-06-23 16:44:20 +00:00
rtl8188eu: Replace wrapper for memcpy
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
120368c717
commit
529328fd3d
30 changed files with 921 additions and 927 deletions
|
@ -203,8 +203,8 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
|
|||
for(curfragnum=0;curfragnum<pattrib->nr_frags;curfragnum++)
|
||||
{
|
||||
iv=pframe+pattrib->hdrlen;
|
||||
_rtw_memcpy(&wepkey[0], iv, 3);
|
||||
_rtw_memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength);
|
||||
memcpy(&wepkey[0], iv, 3);
|
||||
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength);
|
||||
payload=pframe+pattrib->iv_len+pattrib->hdrlen;
|
||||
|
||||
if((curfragnum+1)==pattrib->nr_frags)
|
||||
|
@ -263,9 +263,9 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
|
|||
//keyindex=(iv[3]&0x3);
|
||||
keyindex = prxattrib->key_index;
|
||||
keylength=psecuritypriv->dot11DefKeylen[keyindex];
|
||||
_rtw_memcpy(&wepkey[0], iv, 3);
|
||||
//_rtw_memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength);
|
||||
_rtw_memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0],keylength);
|
||||
memcpy(&wepkey[0], iv, 3);
|
||||
//memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[psecuritypriv->dot11PrivacyKeyIndex].skey[0],keylength);
|
||||
memcpy(&wepkey[3], &psecuritypriv->dot11DefKey[keyindex].skey[0],keylength);
|
||||
length= ((union recv_frame *)precvframe)->u.hdr.len-prxattrib->hdrlen-prxattrib->iv_len;
|
||||
|
||||
payload=pframe+prxattrib->iv_len+prxattrib->hdrlen;
|
||||
|
@ -1821,7 +1821,7 @@ static sint aes_decipher(u8 *key, uint hdrlen,
|
|||
|
||||
//start to calculate the mic
|
||||
if((hdrlen +plen+8) <= MAX_MSG_SIZE)
|
||||
_rtw_memcpy((void *)message, pframe, (hdrlen +plen+8)); //8 is for ext iv len
|
||||
memcpy((void *)message, pframe, (hdrlen +plen+8)); //8 is for ext iv len
|
||||
|
||||
|
||||
pn_vector[0]=pframe[hdrlen];
|
||||
|
@ -2071,7 +2071,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
|
|||
//mapping to wlan header
|
||||
pwlanhdr = (struct rtw_ieee80211_hdr *)pframe;
|
||||
//save the frame body + MME
|
||||
_rtw_memcpy(BIP_AAD+BIP_AAD_SIZE, pframe+WLAN_HDR_A3_LEN, pattrib->pkt_len-WLAN_HDR_A3_LEN);
|
||||
memcpy(BIP_AAD+BIP_AAD_SIZE, pframe+WLAN_HDR_A3_LEN, pattrib->pkt_len-WLAN_HDR_A3_LEN);
|
||||
//find MME IE pointer
|
||||
p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, _MME_IE_, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN);
|
||||
//Baron
|
||||
|
@ -2080,7 +2080,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
|
|||
u16 keyid=0;
|
||||
u64 temp_ipn=0;
|
||||
//save packet number
|
||||
_rtw_memcpy(&temp_ipn, p+4, 6);
|
||||
memcpy(&temp_ipn, p+4, 6);
|
||||
temp_ipn = le64_to_cpu(temp_ipn);
|
||||
//BIP packet number should bigger than previous BIP packet
|
||||
if(temp_ipn <= pmlmeext->mgnt_80211w_IPN_rx)
|
||||
|
@ -2089,7 +2089,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
|
|||
goto BIP_exit;
|
||||
}
|
||||
//copy key index
|
||||
_rtw_memcpy(&keyid, p+2, 2);
|
||||
memcpy(&keyid, p+2, 2);
|
||||
keyid = le16_to_cpu(keyid);
|
||||
if(keyid != padapter->securitypriv.dot11wBIPKeyid)
|
||||
{
|
||||
|
@ -2100,12 +2100,12 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
|
|||
_rtw_memset(p+2+len-8, 0, 8);
|
||||
|
||||
//conscruct AAD, copy frame control field
|
||||
_rtw_memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2);
|
||||
memcpy(BIP_AAD, &pwlanhdr->frame_ctl, 2);
|
||||
ClearRetry(BIP_AAD);
|
||||
ClearPwrMgt(BIP_AAD);
|
||||
ClearMData(BIP_AAD);
|
||||
//conscruct AAD, copy address 1 to address 3
|
||||
_rtw_memcpy(BIP_AAD+2, pwlanhdr->addr1, 18);
|
||||
memcpy(BIP_AAD+2, pwlanhdr->addr1, 18);
|
||||
|
||||
if(omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
|
||||
, BIP_AAD, ori_len, mic))
|
||||
|
@ -2231,7 +2231,7 @@ static int sha256_process(struct sha256_state *md, unsigned char *in,
|
|||
inlen -= block_size;
|
||||
} else {
|
||||
n = MIN(inlen, (block_size - md->curlen));
|
||||
_rtw_memcpy(md->buf + md->curlen, in, n);
|
||||
memcpy(md->buf + md->curlen, in, n);
|
||||
md->curlen += n;
|
||||
in += n;
|
||||
inlen -= n;
|
||||
|
@ -2387,7 +2387,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
|||
|
||||
/* start out by storing key in ipad */
|
||||
_rtw_memset(k_pad, 0, sizeof(k_pad));
|
||||
_rtw_memcpy(k_pad, key, key_len);
|
||||
memcpy(k_pad, key, key_len);
|
||||
/* XOR key with ipad values */
|
||||
for (i = 0; i < 64; i++)
|
||||
k_pad[i] ^= 0x36;
|
||||
|
@ -2402,7 +2402,7 @@ static void hmac_sha256_vector(u8 *key, size_t key_len, size_t num_elem,
|
|||
sha256_vector(1 + num_elem, _addr, _len, mac);
|
||||
|
||||
_rtw_memset(k_pad, 0, sizeof(k_pad));
|
||||
_rtw_memcpy(k_pad, key, key_len);
|
||||
memcpy(k_pad, key, key_len);
|
||||
/* XOR key with opad values */
|
||||
for (i = 0; i < 64; i++)
|
||||
k_pad[i] ^= 0x5c;
|
||||
|
@ -2457,7 +2457,7 @@ static void sha256_prf(u8 *key, size_t key_len, char *label,
|
|||
pos += SHA256_MAC_LEN;
|
||||
} else {
|
||||
hmac_sha256_vector(key, key_len, 4, addr, len, hash);
|
||||
_rtw_memcpy(&buf[pos], hash, plen);
|
||||
memcpy(&buf[pos], hash, plen);
|
||||
break;
|
||||
}
|
||||
counter++;
|
||||
|
@ -2893,13 +2893,13 @@ void wpa_tdls_generate_tpk(struct adapter *padapter, struct sta_info *psta)
|
|||
*/
|
||||
|
||||
if (os_memcmp(myid(&(padapter->eeprompriv)), psta->hwaddr, ETH_ALEN) < 0) {
|
||||
_rtw_memcpy(data, myid(&(padapter->eeprompriv)), ETH_ALEN);
|
||||
_rtw_memcpy(data + ETH_ALEN, psta->hwaddr, ETH_ALEN);
|
||||
memcpy(data, myid(&(padapter->eeprompriv)), ETH_ALEN);
|
||||
memcpy(data + ETH_ALEN, psta->hwaddr, ETH_ALEN);
|
||||
} else {
|
||||
_rtw_memcpy(data, psta->hwaddr, ETH_ALEN);
|
||||
_rtw_memcpy(data + ETH_ALEN, myid(&(padapter->eeprompriv)), ETH_ALEN);
|
||||
memcpy(data, psta->hwaddr, ETH_ALEN);
|
||||
memcpy(data + ETH_ALEN, myid(&(padapter->eeprompriv)), ETH_ALEN);
|
||||
}
|
||||
_rtw_memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
|
||||
memcpy(data + 2 * ETH_ALEN, get_bssid(pmlmepriv), ETH_ALEN);
|
||||
|
||||
sha256_prf(key_input, SHA256_MAC_LEN, "TDLS PMK", data, sizeof(data), (u8 *) &psta->tpk, sizeof(psta->tpk));
|
||||
|
||||
|
@ -2936,24 +2936,24 @@ int wpa_tdls_ftie_mic(u8 *kck, u8 trans_seq,
|
|||
pos = buf;
|
||||
_lnkid = (struct wpa_tdls_lnkid *) lnkid;
|
||||
/* 1) TDLS initiator STA MAC address */
|
||||
_rtw_memcpy(pos, _lnkid->init_sta, ETH_ALEN);
|
||||
memcpy(pos, _lnkid->init_sta, ETH_ALEN);
|
||||
pos += ETH_ALEN;
|
||||
/* 2) TDLS responder STA MAC address */
|
||||
_rtw_memcpy(pos, _lnkid->resp_sta, ETH_ALEN);
|
||||
memcpy(pos, _lnkid->resp_sta, ETH_ALEN);
|
||||
pos += ETH_ALEN;
|
||||
/* 3) Transaction Sequence number */
|
||||
*pos++ = trans_seq;
|
||||
/* 4) Link Identifier IE */
|
||||
_rtw_memcpy(pos, lnkid, 2 + lnkid[1]);
|
||||
memcpy(pos, lnkid, 2 + lnkid[1]);
|
||||
pos += 2 + lnkid[1];
|
||||
/* 5) RSN IE */
|
||||
_rtw_memcpy(pos, rsnie, 2 + rsnie[1]);
|
||||
memcpy(pos, rsnie, 2 + rsnie[1]);
|
||||
pos += 2 + rsnie[1];
|
||||
/* 6) Timeout Interval IE */
|
||||
_rtw_memcpy(pos, timeoutie, 2 + timeoutie[1]);
|
||||
memcpy(pos, timeoutie, 2 + timeoutie[1]);
|
||||
pos += 2 + timeoutie[1];
|
||||
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
|
||||
_rtw_memcpy(pos, ftie, 2 + ftie[1]);
|
||||
memcpy(pos, ftie, 2 + ftie[1]);
|
||||
_ftie = (struct wpa_tdls_ftie *) pos;
|
||||
_rtw_memset(_ftie->mic, 0, TDLS_MIC_LEN);
|
||||
pos += 2 + ftie[1];
|
||||
|
@ -2986,24 +2986,24 @@ int tdls_verify_mic(u8 *kck, u8 trans_seq,
|
|||
|
||||
pos = buf;
|
||||
/* 1) TDLS initiator STA MAC address */
|
||||
_rtw_memcpy(pos, lnkid + ETH_ALEN + 2, ETH_ALEN);
|
||||
memcpy(pos, lnkid + ETH_ALEN + 2, ETH_ALEN);
|
||||
pos += ETH_ALEN;
|
||||
/* 2) TDLS responder STA MAC address */
|
||||
_rtw_memcpy(pos, lnkid + 2 * ETH_ALEN + 2, ETH_ALEN);
|
||||
memcpy(pos, lnkid + 2 * ETH_ALEN + 2, ETH_ALEN);
|
||||
pos += ETH_ALEN;
|
||||
/* 3) Transaction Sequence number */
|
||||
*pos++ = trans_seq;
|
||||
/* 4) Link Identifier IE */
|
||||
_rtw_memcpy(pos, lnkid, 2 + 18);
|
||||
memcpy(pos, lnkid, 2 + 18);
|
||||
pos += 2 + 18;
|
||||
/* 5) RSN IE */
|
||||
_rtw_memcpy(pos, rsnie, 2 + *(rsnie+1));
|
||||
memcpy(pos, rsnie, 2 + *(rsnie+1));
|
||||
pos += 2 + *(rsnie+1);
|
||||
/* 6) Timeout Interval IE */
|
||||
_rtw_memcpy(pos, timeoutie, 2 + *(timeoutie+1));
|
||||
memcpy(pos, timeoutie, 2 + *(timeoutie+1));
|
||||
pos += 2 + *(timeoutie+1);
|
||||
/* 7) FTIE, with the MIC field of the FTIE set to 0 */
|
||||
_rtw_memcpy(pos, ftie, 2 + *(ftie+1));
|
||||
memcpy(pos, ftie, 2 + *(ftie+1));
|
||||
pos += 2;
|
||||
tmp_ftie = (u8 *) (pos+2);
|
||||
_rtw_memset(tmp_ftie, 0, 16);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue