Staging: vt6655: Fixed ERROR: do not use C99 // comments in vt6655/aes_ccmp.c
This patch fixes ERROR: do not use C99 // comments found by checkpatch in vt6655/aes_ccmp.c. Signed-off-by: Tülin İzer <tulinizer@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c52011c91d
commit
600816cc92
@ -205,7 +205,7 @@ void AESv128(unsigned char *key, unsigned char *data, unsigned char *ciphertext)
|
|||||||
SubBytes(ciphertext, TmpdataA);
|
SubBytes(ciphertext, TmpdataA);
|
||||||
ShiftRows(TmpdataA, TmpdataB);
|
ShiftRows(TmpdataA, TmpdataB);
|
||||||
xor_128(TmpdataB, abyRoundKey, ciphertext);
|
xor_128(TmpdataB, abyRoundKey, ciphertext);
|
||||||
} else // round 1 ~ 9
|
} else /* round 1 ~ 9 */
|
||||||
{
|
{
|
||||||
SubBytes(ciphertext, TmpdataA);
|
SubBytes(ciphertext, TmpdataA);
|
||||||
ShiftRows(TmpdataA, TmpdataB);
|
ShiftRows(TmpdataA, TmpdataB);
|
||||||
@ -249,7 +249,7 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
unsigned char *pbyIV;
|
unsigned char *pbyIV;
|
||||||
unsigned char *pbyPayload;
|
unsigned char *pbyPayload;
|
||||||
unsigned short wHLen = 22;
|
unsigned short wHLen = 22;
|
||||||
unsigned short wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;//8 is IV, 8 is MIC, 4 is CRC
|
unsigned short wPayloadSize = wFrameSize - 8 - 8 - 4 - WLAN_HDR_ADDR3_LEN;/* 8 is IV, 8 is MIC, 4 is CRC */
|
||||||
bool bA4 = false;
|
bool bA4 = false;
|
||||||
unsigned char byTmp;
|
unsigned char byTmp;
|
||||||
unsigned short wCnt;
|
unsigned short wCnt;
|
||||||
@ -259,13 +259,13 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
|
if (WLAN_GET_FC_TODS(*(unsigned short *)pbyFrame) &&
|
||||||
WLAN_GET_FC_FROMDS(*(unsigned short *)pbyFrame)) {
|
WLAN_GET_FC_FROMDS(*(unsigned short *)pbyFrame)) {
|
||||||
bA4 = true;
|
bA4 = true;
|
||||||
pbyIV += 6; // 6 is 802.11 address4
|
pbyIV += 6; /* 6 is 802.11 address4 */
|
||||||
wHLen += 6;
|
wHLen += 6;
|
||||||
wPayloadSize -= 6;
|
wPayloadSize -= 6;
|
||||||
}
|
}
|
||||||
pbyPayload = pbyIV + 8; //IV-length
|
pbyPayload = pbyIV + 8; /* IV-length */
|
||||||
|
|
||||||
abyNonce[0] = 0x00; //now is 0, if Qos here will be priority
|
abyNonce[0] = 0x00; /* now is 0, if Qos here will be priority */
|
||||||
memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
|
memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
|
||||||
abyNonce[7] = pbyIV[7];
|
abyNonce[7] = pbyIV[7];
|
||||||
abyNonce[8] = pbyIV[6];
|
abyNonce[8] = pbyIV[6];
|
||||||
@ -274,13 +274,13 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
abyNonce[11] = pbyIV[1];
|
abyNonce[11] = pbyIV[1];
|
||||||
abyNonce[12] = pbyIV[0];
|
abyNonce[12] = pbyIV[0];
|
||||||
|
|
||||||
//MIC_IV
|
/* MIC_IV */
|
||||||
MIC_IV[0] = 0x59;
|
MIC_IV[0] = 0x59;
|
||||||
memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13);
|
memcpy(&(MIC_IV[1]), &(abyNonce[0]), 13);
|
||||||
MIC_IV[14] = (unsigned char)(wPayloadSize >> 8);
|
MIC_IV[14] = (unsigned char)(wPayloadSize >> 8);
|
||||||
MIC_IV[15] = (unsigned char)(wPayloadSize & 0xff);
|
MIC_IV[15] = (unsigned char)(wPayloadSize & 0xff);
|
||||||
|
|
||||||
//MIC_HDR1
|
/* MIC_HDR1 */
|
||||||
MIC_HDR1[0] = (unsigned char)(wHLen >> 8);
|
MIC_HDR1[0] = (unsigned char)(wHLen >> 8);
|
||||||
MIC_HDR1[1] = (unsigned char)(wHLen & 0xff);
|
MIC_HDR1[1] = (unsigned char)(wHLen & 0xff);
|
||||||
byTmp = (unsigned char)(pMACHeader->wFrameCtl & 0xff);
|
byTmp = (unsigned char)(pMACHeader->wFrameCtl & 0xff);
|
||||||
@ -291,7 +291,7 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
|
memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
|
||||||
memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
|
memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
|
||||||
|
|
||||||
//MIC_HDR2
|
/* MIC_HDR2 */
|
||||||
memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
|
memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
|
||||||
byTmp = (unsigned char)(pMACHeader->wSeqCtl & 0xff);
|
byTmp = (unsigned char)(pMACHeader->wSeqCtl & 0xff);
|
||||||
MIC_HDR2[6] = byTmp & 0x0f;
|
MIC_HDR2[6] = byTmp & 0x0f;
|
||||||
@ -309,7 +309,7 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
MIC_HDR2[14] = 0x00;
|
MIC_HDR2[14] = 0x00;
|
||||||
MIC_HDR2[15] = 0x00;
|
MIC_HDR2[15] = 0x00;
|
||||||
|
|
||||||
//CCMP
|
/* CCMP */
|
||||||
AESv128(pbyRxKey, MIC_IV, abyMIC);
|
AESv128(pbyRxKey, MIC_IV, abyMIC);
|
||||||
for (kk = 0; kk < 16; kk++) {
|
for (kk = 0; kk < 16; kk++) {
|
||||||
abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk];
|
abyTmp[kk] = MIC_HDR1[kk] ^ abyMIC[kk];
|
||||||
@ -341,9 +341,9 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
memcpy(pbyPayload, abyPlainText, 16);
|
memcpy(pbyPayload, abyPlainText, 16);
|
||||||
wCnt++;
|
wCnt++;
|
||||||
pbyPayload += 16;
|
pbyPayload += 16;
|
||||||
} //for wPayloadSize
|
} /* for wPayloadSize */
|
||||||
|
|
||||||
//last payload
|
/* last payload */
|
||||||
memcpy(&(abyLastCipher[0]), pbyPayload, jj);
|
memcpy(&(abyLastCipher[0]), pbyPayload, jj);
|
||||||
for (ii = jj; ii < 16; ii++) {
|
for (ii = jj; ii < 16; ii++) {
|
||||||
abyLastCipher[ii] = 0x00;
|
abyLastCipher[ii] = 0x00;
|
||||||
@ -359,7 +359,7 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
memcpy(pbyPayload, abyPlainText, jj);
|
memcpy(pbyPayload, abyPlainText, jj);
|
||||||
pbyPayload += jj;
|
pbyPayload += jj;
|
||||||
|
|
||||||
//for MIC calculation
|
/* for MIC calculation */
|
||||||
for (ii = jj; ii < 16; ii++) {
|
for (ii = jj; ii < 16; ii++) {
|
||||||
abyPlainText[ii] = 0x00;
|
abyPlainText[ii] = 0x00;
|
||||||
}
|
}
|
||||||
@ -368,8 +368,8 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
}
|
}
|
||||||
AESv128(pbyRxKey, abyTmp, abyMIC);
|
AESv128(pbyRxKey, abyTmp, abyMIC);
|
||||||
|
|
||||||
//=>above is the calculate MIC
|
/* =>above is the calculate MIC */
|
||||||
//--------------------------------------------
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
wCnt = 0;
|
wCnt = 0;
|
||||||
abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
|
abyCTRPLD[14] = (unsigned char)(wCnt >> 8);
|
||||||
@ -378,8 +378,8 @@ bool AESbGenCCMP(unsigned char *pbyRxKey, unsigned char *pbyFrame, unsigned shor
|
|||||||
for (kk = 0; kk < 8; kk++) {
|
for (kk = 0; kk < 8; kk++) {
|
||||||
abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk];
|
abyTmp[kk] = abyTmp[kk] ^ pbyPayload[kk];
|
||||||
}
|
}
|
||||||
//=>above is the dec-MIC from packet
|
/* =>above is the dec-MIC from packet */
|
||||||
//--------------------------------------------
|
/* -------------------------------------------- */
|
||||||
|
|
||||||
if (!memcmp(abyMIC, abyTmp, 8)) {
|
if (!memcmp(abyMIC, abyTmp, 8)) {
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user