Search Linux Wireless

[PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace 4 x u32 aWTxKey with u8 array of 16 bytes tx_key.

Replaces pbyBuf in s_vFillTxKey and connects pbyTxBufferAddr
directly to tx_key without a cast elsewhere in structure.

Signed-off-by: Malcolm Priestley <tvboxspy@xxxxxxxxx>
---
 drivers/staging/vt6656/rxtx.c | 23 ++++++++++++-----------
 drivers/staging/vt6656/rxtx.h |  2 +-
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index 35a3ddb..7ca1c26 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -185,7 +185,6 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
 	PSKeyItem pTransmitKey, u8 *pbyHdrBuf, u16 wPayloadLen,
 	struct vnt_mic_hdr *mic_hdr)
 {
-	u8 *pbyBuf = (u8 *)&fifo_head->adwTxKey[0];
 	u32 *pdwIV = (u32 *)pbyIVHead;
 	u32 *pdwExtIV = (u32 *)((u8 *)pbyIVHead + 4);
 	struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
@@ -206,16 +205,18 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
 			memcpy(pDevice->abyPRNG + 3, pTransmitKey->abyKey,
 						pTransmitKey->uKeyLength);
 		} else {
-			memcpy(pbyBuf, (u8 *)&dwRevIVCounter, 3);
-			memcpy(pbyBuf + 3, pTransmitKey->abyKey,
+			memcpy(fifo_head->tx_key, (u8 *)&dwRevIVCounter, 3);
+			memcpy(&fifo_head->tx_key[3], pTransmitKey->abyKey,
 						pTransmitKey->uKeyLength);
 			if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
-				memcpy(pbyBuf+8, (u8 *)&dwRevIVCounter, 3);
-			memcpy(pbyBuf+11, pTransmitKey->abyKey,
+				memcpy(&fifo_head->tx_key[8],
+						(u8 *)&dwRevIVCounter, 3);
+				memcpy(&fifo_head->tx_key[11],
+					pTransmitKey->abyKey,
 						pTransmitKey->uKeyLength);
 			}
 
-			memcpy(pDevice->abyPRNG, pbyBuf, 16);
+			memcpy(pDevice->abyPRNG, fifo_head->tx_key, 16);
 		}
 		/* Append IV after Mac Header */
 		*pdwIV &= WEP_IV_MASK;
@@ -235,7 +236,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
 		TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
 			pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16,
 							pDevice->abyPRNG);
-		memcpy(pbyBuf, pDevice->abyPRNG, 16);
+		memcpy(fifo_head->tx_key, pDevice->abyPRNG, 16);
 
 		/* Make IV */
 		memcpy(pdwIV, pDevice->abyPRNG, 3);
@@ -254,7 +255,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice,
 		if (pTransmitKey->wTSC15_0 == 0)
 			pTransmitKey->dwTSC47_16++;
 
-		memcpy(pbyBuf, pTransmitKey->abyKey, 16);
+		memcpy(fifo_head->tx_key, pTransmitKey->abyKey, 16);
 
 		/* Make IV */
 		*pdwIV = 0;
@@ -1103,7 +1104,7 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType,
         pTxBufHead->wFIFOCtl |= (FIFOCTL_RTS | FIFOCTL_LRETRY);
     }
 
-    pbyTxBufferAddr = (u8 *) &(pTxBufHead->adwTxKey[0]);
+	pbyTxBufferAddr = pTxBufHead->tx_key;
 	wTxBufSize = sizeof(struct vnt_tx_fifo_head);
 
     if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet
@@ -1419,7 +1420,7 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice,
 	pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
     cbFrameBodySize = pPacket->cbPayloadLen;
 	pTxBufHead = &pTX_Buffer->fifo_head;
-	pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0];
+	pbyTxBufferAddr = pTxBufHead->tx_key;
 	wTxBufSize = sizeof(struct vnt_tx_fifo_head);
 
     if (pDevice->byBBType == BB_TYPE_11A) {
@@ -1791,7 +1792,7 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb)
 
 	pTX_Buffer = (struct vnt_tx_buffer *)&pContext->Data[0];
 	pTxBufHead = &pTX_Buffer->fifo_head;
-	pbyTxBufferAddr = (u8 *)&pTxBufHead->adwTxKey[0];
+	pbyTxBufferAddr = pTxBufHead->tx_key;
 	wTxBufSize = sizeof(struct vnt_tx_fifo_head);
 
     if (pDevice->byBBType == BB_TYPE_11A) {
diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h
index eecbe89..b2dbc09 100644
--- a/drivers/staging/vt6656/rxtx.h
+++ b/drivers/staging/vt6656/rxtx.h
@@ -215,7 +215,7 @@ union vnt_tx_head {
 };
 
 struct vnt_tx_fifo_head {
-	u32 adwTxKey[4];
+	u8 tx_key[16];
 	u16 wFIFOCtl;
 	u16 wTimeStamp;
 	u16 wFragCtl;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux