Commit 95bfb1ae authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: rxtx.c s_vFillTxKey clean up format and white space.

Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5fb8e412
...@@ -190,7 +190,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, ...@@ -190,7 +190,7 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf; struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf;
u32 dwRevIVCounter; u32 dwRevIVCounter;
//Fill TXKEY /* Fill TXKEY */
if (pTransmitKey == NULL) if (pTransmitKey == NULL)
return; return;
...@@ -199,55 +199,66 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, ...@@ -199,55 +199,66 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf,
pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf; pDevice->byKeyIndex = pTransmitKey->dwKeyIndex & 0xf;
if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) {
if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN ){ if (pTransmitKey->uKeyLength == WLAN_WEP232_KEYLEN) {
memcpy(pDevice->abyPRNG, (u8 *)&(dwRevIVCounter), 3); memcpy(pDevice->abyPRNG, (u8 *)&dwRevIVCounter, 3);
memcpy(pDevice->abyPRNG+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); memcpy(pDevice->abyPRNG + 3, pTransmitKey->abyKey,
pTransmitKey->uKeyLength);
} else { } else {
memcpy(pbyBuf, (u8 *)&(dwRevIVCounter), 3); memcpy(pbyBuf, (u8 *)&dwRevIVCounter, 3);
memcpy(pbyBuf+3, pTransmitKey->abyKey, pTransmitKey->uKeyLength); memcpy(pbyBuf + 3, pTransmitKey->abyKey,
if(pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) { pTransmitKey->uKeyLength);
memcpy(pbyBuf+8, (u8 *)&(dwRevIVCounter), 3); if (pTransmitKey->uKeyLength == WLAN_WEP40_KEYLEN) {
memcpy(pbyBuf+11, pTransmitKey->abyKey, pTransmitKey->uKeyLength); memcpy(pbyBuf+8, (u8 *)&dwRevIVCounter, 3);
memcpy(pbyBuf+11, pTransmitKey->abyKey,
pTransmitKey->uKeyLength);
} }
memcpy(pDevice->abyPRNG, pbyBuf, 16); memcpy(pDevice->abyPRNG, pbyBuf, 16);
} }
// Append IV after Mac Header /* Append IV after Mac Header */
*pdwIV &= WEP_IV_MASK;//00000000 11111111 11111111 11111111 *pdwIV &= WEP_IV_MASK;
*pdwIV |= (u32)pDevice->byKeyIndex << 30; *pdwIV |= (u32)pDevice->byKeyIndex << 30;
*pdwIV = cpu_to_le32(*pdwIV); *pdwIV = cpu_to_le32(*pdwIV);
pDevice->dwIVCounter++; pDevice->dwIVCounter++;
if (pDevice->dwIVCounter > WEP_IV_MASK) { if (pDevice->dwIVCounter > WEP_IV_MASK)
pDevice->dwIVCounter = 0; pDevice->dwIVCounter = 0;
}
} else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) { } else if (pTransmitKey->byCipherSuite == KEY_CTL_TKIP) {
pTransmitKey->wTSC15_0++; pTransmitKey->wTSC15_0++;
if (pTransmitKey->wTSC15_0 == 0) { if (pTransmitKey->wTSC15_0 == 0)
pTransmitKey->dwTSC47_16++; pTransmitKey->dwTSC47_16++;
}
TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr, TKIPvMixKey(pTransmitKey->abyKey, pDevice->abyCurrentNetAddr,
pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16, pDevice->abyPRNG); pTransmitKey->wTSC15_0, pTransmitKey->dwTSC47_16,
pDevice->abyPRNG);
memcpy(pbyBuf, pDevice->abyPRNG, 16); memcpy(pbyBuf, pDevice->abyPRNG, 16);
// Make IV
/* Make IV */
memcpy(pdwIV, pDevice->abyPRNG, 3); memcpy(pdwIV, pDevice->abyPRNG, 3);
*(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) &
// Append IV&ExtIV after Mac Header 0xc0) | 0x20);
/* Append IV&ExtIV after Mac Header */
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n",
*pdwExtIV); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
"vFillTxKey()---- pdwExtIV: %x\n", *pdwExtIV);
} else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) {
pTransmitKey->wTSC15_0++; pTransmitKey->wTSC15_0++;
if (pTransmitKey->wTSC15_0 == 0) { if (pTransmitKey->wTSC15_0 == 0)
pTransmitKey->dwTSC47_16++; pTransmitKey->dwTSC47_16++;
}
memcpy(pbyBuf, pTransmitKey->abyKey, 16); memcpy(pbyBuf, pTransmitKey->abyKey, 16);
// Make IV /* Make IV */
*pdwIV = 0; *pdwIV = 0;
*(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV *(pbyIVHead+3) = (u8)(((pDevice->byKeyIndex << 6) &
0xc0) | 0x20);
*pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0)); *pdwIV |= cpu_to_le16((u16)(pTransmitKey->wTSC15_0));
//Append IV&ExtIV after Mac Header
/* Append IV&ExtIV after Mac Header */
*pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16);
if (!mic_hdr) if (!mic_hdr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment