diff options
Diffstat (limited to 'drivers/staging/rtl8712/rtl871x_security.c')
-rw-r--r-- | drivers/staging/rtl8712/rtl871x_security.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/staging/rtl8712/rtl871x_security.c b/drivers/staging/rtl8712/rtl871x_security.c index 56d36f6f9c46..7bc74d7d8a3a 100644 --- a/drivers/staging/rtl8712/rtl871x_security.c +++ b/drivers/staging/rtl8712/rtl871x_security.c @@ -165,7 +165,7 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) { /* exclude ICV */ unsigned char crc[4]; struct arc4context mycontext; - u32 curfragnum, length, keylength; + u32 curfragnum, length, keylength, pki; u8 *pframe, *payload, *iv; /*,*wepkey*/ u8 wepkey[16]; struct pkt_attrib *pattrib = &((struct xmit_frame *) @@ -178,8 +178,8 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + TXDESC_OFFSET; /*start to encrypt each fragment*/ if ((pattrib->encrypt == _WEP40_) || (pattrib->encrypt == _WEP104_)) { - keylength = psecuritypriv->DefKeylen[psecuritypriv-> - PrivacyKeyIndex]; + pki = psecuritypriv->PrivacyKeyIndex; + keylength = psecuritypriv->DefKeylen[pki]; for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) { iv = pframe + pattrib->hdrlen; @@ -189,9 +189,10 @@ void r8712_wep_encrypt(struct _adapter *padapter, u8 *pxmitframe) keylength); payload = pframe + pattrib->iv_len + pattrib->hdrlen; if ((curfragnum + 1) == pattrib->nr_frags) { - length = pattrib->last_txcmdsz - pattrib-> - hdrlen - pattrib->iv_len - - pattrib->icv_len; + length = pattrib->last_txcmdsz - + pattrib->hdrlen - + pattrib->iv_len - + pattrib->icv_len; *((__le32 *)crc) = cpu_to_le32(getcrc32( payload, length)); arcfour_init(&mycontext, wepkey, 3 + keylength); @@ -606,8 +607,8 @@ u32 r8712_tkip_encrypt(struct _adapter *padapter, u8 *pxmitframe) GET_TKIP_PN(iv, txpn); pnl = (u16)(txpn.val); pnh = (u32)(txpn.val >> 16); - phase1((u16 *)&ttkey[0], prwskey, &pattrib-> - ta[0], pnh); + phase1((u16 *)&ttkey[0], prwskey, + &pattrib->ta[0], pnh); phase2(&rc4key[0], prwskey, (u16 *)&ttkey[0], pnl); if ((curfragnum + 1) == pattrib->nr_frags) { @@ -997,8 +998,9 @@ static void construct_mic_header2(u8 *mic_header2, u8 *mpdu, sint a4_exists, /* Builds the last MIC header block from */ /* header fields. */ /************************************************/ -static void construct_ctr_preload(u8 *ctr_preload, sint a4_exists, sint qc_exists, - u8 *mpdu, u8 *pn_vector, sint c) +static void construct_ctr_preload(u8 *ctr_preload, + sint a4_exists, sint qc_exists, + u8 *mpdu, u8 *pn_vector, sint c) { sint i; @@ -1067,16 +1069,16 @@ static sint aes_cipher(u8 *key, uint hdrlen, if ((frtype == WIFI_DATA_CFACK) || (frtype == WIFI_DATA_CFPOLL) || (frtype == WIFI_DATA_CFACKPOLL)) { - qc_exists = 1; - if (hdrlen != WLAN_HDR_A3_QOS_LEN) - hdrlen += 2; + qc_exists = 1; + if (hdrlen != WLAN_HDR_A3_QOS_LEN) + hdrlen += 2; } else if ((frsubtype == 0x08) || (frsubtype == 0x09) || (frsubtype == 0x0a) || (frsubtype == 0x0b)) { - if (hdrlen != WLAN_HDR_A3_QOS_LEN) - hdrlen += 2; - qc_exists = 1; + if (hdrlen != WLAN_HDR_A3_QOS_LEN) + hdrlen += 2; + qc_exists = 1; } else { qc_exists = 0; } @@ -1184,15 +1186,15 @@ u32 r8712_aes_encrypt(struct _adapter *padapter, u8 *pxmitframe) pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - aes_cipher(prwskey, pattrib-> - hdrlen, pframe, length); + aes_cipher(prwskey, pattrib->hdrlen, + pframe, length); } else { length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - aes_cipher(prwskey, pattrib-> - hdrlen, pframe, length); + aes_cipher(prwskey, pattrib->hdrlen, + pframe, length); pframe += pxmitpriv->frag_len; pframe = (u8 *)RND4((addr_t)(pframe)); } @@ -1405,7 +1407,7 @@ u32 r8712_aes_decrypt(struct _adapter *padapter, u8 *precvframe) void r8712_use_tkipkey_handler(struct timer_list *t) { struct _adapter *padapter = - from_timer(padapter, t, securitypriv.tkip_timer); + from_timer(padapter, t, securitypriv.tkip_timer); padapter->securitypriv.busetkipkey = true; } |