linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key
@ 2013-10-15 20:46 Malcolm Priestley
  2013-10-16 19:46 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Malcolm Priestley @ 2013-10-15 20:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key
  2013-10-15 20:46 [PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key Malcolm Priestley
@ 2013-10-16 19:46 ` Greg KH
  2013-10-16 21:25   ` Malcolm
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2013-10-16 19:46 UTC (permalink / raw)
  To: Malcolm Priestley; +Cc: linux-wireless

On Tue, Oct 15, 2013 at 09:46:49PM +0100, Malcolm Priestley wrote:
> 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@gmail.com>

This patch causes a bunch of compiler warnings to get spit out by the
compiler, so I can't take it.

Please fix them up and resend.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key
  2013-10-16 19:46 ` Greg KH
@ 2013-10-16 21:25   ` Malcolm
  0 siblings, 0 replies; 3+ messages in thread
From: Malcolm @ 2013-10-16 21:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-wireless


On 16/10/13 20:46, Greg KH wrote:
> On Tue, Oct 15, 2013 at 09:46:49PM +0100, Malcolm Priestley wrote:
>> 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@gmail.com>
> This patch causes a bunch of compiler warnings to get spit out by the
> compiler, so I can't take it.
>
> Please fix them up and resend.
hmm for some reason I am not getting them on gcc 4.8.1

Anyway, I will drop this patch for now. It requires changes elsewhere.

Malcolm

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-10-16 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-15 20:46 [PATCH 2/2] staging: vt6656: rxtx change u32 [4] aWTxKey to u8[16] tx_key Malcolm Priestley
2013-10-16 19:46 ` Greg KH
2013-10-16 21:25   ` Malcolm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).