提交 ec278fa2 编写于 作者: B Bartlomiej Zolnierkiewicz 提交者: Greg Kroah-Hartman

Staging: rt28x0: fix comments in common/*.c files

Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 9f548a2a
...@@ -113,13 +113,13 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -113,13 +113,13 @@ VOID MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ)); NdisZeroMemory(&Frame, sizeof(FRAME_ADDBA_REQ));
if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) { if (MlmeAddBAReqSanity(pAd, Elem->Msg, Elem->MsgLen, Addr)) {
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) { if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("BA - MlmeADDBAAction() allocate memory failed \n")); ("BA - MlmeADDBAAction() allocate memory failed \n"));
return; return;
} }
// 1. find entry /* 1. find entry */
Idx = Idx =
pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];
if (Idx == 0) { if (Idx == 0) {
...@@ -200,27 +200,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -200,27 +200,27 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
FRAME_BAR FrameBar; FRAME_BAR FrameBar;
pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg; pInfo = (MLME_DELBA_REQ_STRUCT *) Elem->Msg;
// must send back DELBA /* must send back DELBA */
NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ)); NdisZeroMemory(&Frame, sizeof(FRAME_DELBA_REQ));
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator)); ("==> MlmeDELBAAction(), Initiator(%d) \n", pInfo->Initiator));
if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) { if (MlmeDelBAReqSanity(pAd, Elem->Msg, Elem->MsgLen)) {
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) { if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_ERROR, DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeDELBAAction() allocate memory failed 1. \n")); ("BA - MlmeDELBAAction() allocate memory failed 1. \n"));
return; return;
} }
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); //Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer2); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) { if (NStatus != NDIS_STATUS_SUCCESS) {
MlmeFreeMemory(pAd, pOutBuffer); MlmeFreeMemory(pAd, pOutBuffer);
DBGPRINT(RT_DEBUG_ERROR, DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeDELBAAction() allocate memory failed 2. \n")); ("BA - MlmeDELBAAction() allocate memory failed 2. \n"));
return; return;
} }
// SEND BAR (Send BAR to refresh peer reordering buffer.) /* SEND BAR (Send BAR to refresh peer reordering buffer.) */
Idx = Idx =
pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID]; pAd->MacTab.Content[pInfo->Wcid].BAOriWcidArray[pInfo->TID];
...@@ -228,12 +228,12 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -228,12 +228,12 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
pAd->MacTab.Content[pInfo->Wcid].Addr, pAd->MacTab.Content[pInfo->Wcid].Addr,
pAd->CurrentAddress); pAd->CurrentAddress);
FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL funciton. FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL funciton. */
FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; // make sure sequence not clear in DEL funciton. FrameBar.StartingSeq.field.StartSeq = pAd->MacTab.Content[pInfo->Wcid].TxSeq[pInfo->TID]; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.TID = pInfo->TID; // make sure sequence not clear in DEL funciton. FrameBar.BarControl.TID = pInfo->TID; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.ACKPolicy = IMMED_BA; // make sure sequence not clear in DEL funciton. FrameBar.BarControl.ACKPolicy = IMMED_BA; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.Compressed = 1; // make sure sequence not clear in DEL funciton. FrameBar.BarControl.Compressed = 1; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.MTID = 0; // make sure sequence not clear in DEL funciton. FrameBar.BarControl.MTID = 0; /* make sure sequence not clear in DEL funciton. */
MakeOutgoingFrame(pOutBuffer2, &FrameLen, MakeOutgoingFrame(pOutBuffer2, &FrameLen,
sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS); sizeof(FRAME_BAR), &FrameBar, END_OF_ARGS);
...@@ -242,7 +242,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -242,7 +242,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n")); ("BA - MlmeDELBAAction() . Send BAR to refresh peer reordering buffer \n"));
// SEND DELBA FRAME /* SEND DELBA FRAME */
FrameLen = 0; FrameLen = 0;
{ {
...@@ -263,7 +263,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -263,7 +263,7 @@ VOID MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
Frame.Action = DELBA; Frame.Action = DELBA;
Frame.DelbaParm.Initiator = pInfo->Initiator; Frame.DelbaParm.Initiator = pInfo->Initiator;
Frame.DelbaParm.TID = pInfo->TID; Frame.DelbaParm.TID = pInfo->TID;
Frame.ReasonCode = 39; // Time Out Frame.ReasonCode = 39; /* Time Out */
*(USHORT *) (&Frame.DelbaParm) = *(USHORT *) (&Frame.DelbaParm) =
cpu2le16(*(USHORT *) (&Frame.DelbaParm)); cpu2le16(*(USHORT *) (&Frame.DelbaParm));
Frame.ReasonCode = cpu2le16(Frame.ReasonCode); Frame.ReasonCode = cpu2le16(Frame.ReasonCode);
...@@ -288,8 +288,8 @@ VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -288,8 +288,8 @@ VOID MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) VOID MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
{ {
//PUCHAR pOutBuffer = NULL; /*PUCHAR pOutBuffer = NULL; */
//Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 /*Return the receiving frame except the MSB of category filed set to 1. 7.3.1.11 */
} }
VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) VOID PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
...@@ -347,20 +347,20 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd, ...@@ -347,20 +347,20 @@ static VOID respond_ht_information_exchange_action(IN PRTMP_ADAPTER pAd,
FRAME_HT_INFO HTINFOframe, *pFrame; FRAME_HT_INFO HTINFOframe, *pFrame;
UCHAR *pAddr; UCHAR *pAddr;
// 2. Always send back ADDBA Response /* 2. Always send back ADDBA Response */
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) { if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("ACTION - respond_ht_information_exchange_action() allocate memory failed \n")); ("ACTION - respond_ht_information_exchange_action() allocate memory failed \n"));
return; return;
} }
// get RA /* get RA */
pFrame = (FRAME_HT_INFO *) & Elem->Msg[0]; pFrame = (FRAME_HT_INFO *) & Elem->Msg[0];
pAddr = pFrame->Hdr.Addr2; pAddr = pFrame->Hdr.Addr2;
NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO)); NdisZeroMemory(&HTINFOframe, sizeof(FRAME_HT_INFO));
// 2-1. Prepare ADDBA Response frame. /* 2-1. Prepare ADDBA Response frame. */
{ {
if (ADHOC_ON(pAd)) if (ADHOC_ON(pAd))
ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr, ActHeaderInit(pAd, &HTINFOframe.Hdr, pAddr,
...@@ -400,21 +400,21 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -400,21 +400,21 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
("ACTION - HT Notify Channel bandwidth action----> \n")); ("ACTION - HT Notify Channel bandwidth action----> \n"));
if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) { if (pAd->StaActive.SupportedPhyInfo.bHtEnable == FALSE) {
// Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps /* Note, this is to patch DIR-1353 AP. When the AP set to Wep, it will use legacy mode. But AP still keeps */
// sending BW_Notify Action frame, and cause us to linkup and linkdown. /* sending BW_Notify Action frame, and cause us to linkup and linkdown. */
// In legacy mode, don't need to parse HT action frame. /* In legacy mode, don't need to parse HT action frame. */
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n", ("ACTION -Ignore HT Notify Channel BW when link as legacy mode. BW = %d---> \n",
Elem->Msg[LENGTH_802_11 + 2])); Elem->Msg[LENGTH_802_11 + 2]));
break; break;
} }
if (Elem->Msg[LENGTH_802_11 + 2] == 0) // 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. if (Elem->Msg[LENGTH_802_11 + 2] == 0) /* 7.4.8.2. if value is 1, keep the same as supported channel bandwidth. */
pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0; pAd->MacTab.Content[Elem->Wcid].HTPhyMode.field.BW = 0;
break; break;
case SMPS_ACTION: case SMPS_ACTION:
// 7.3.1.25 /* 7.3.1.25 */
DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n")); DBGPRINT(RT_DEBUG_TRACE, ("ACTION - SMPS action----> \n"));
if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) { if (((Elem->Msg[LENGTH_802_11 + 2] & 0x1) == 0)) {
pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE; pAd->MacTab.Content[Elem->Wcid].MmpsMode = MMPS_ENABLE;
...@@ -427,7 +427,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -427,7 +427,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("Aid(%d) MIMO PS = %d\n", Elem->Wcid, ("Aid(%d) MIMO PS = %d\n", Elem->Wcid,
pAd->MacTab.Content[Elem->Wcid].MmpsMode)); pAd->MacTab.Content[Elem->Wcid].MmpsMode));
// rt2860c : add something for smps change. /* rt2860c : add something for smps change. */
break; break;
case SETPCO_ACTION: case SETPCO_ACTION:
...@@ -441,7 +441,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem) ...@@ -441,7 +441,7 @@ VOID PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem)
pHT_info = pHT_info =
(HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 + (HT_INFORMATION_OCTET *) & Elem->Msg[LENGTH_802_11 +
2]; 2];
// 7.4.8.10 /* 7.4.8.10 */
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("ACTION - HT Information Exchange action----> \n")); ("ACTION - HT Information Exchange action----> \n"));
if (pHT_info->Request) { if (pHT_info->Request) {
...@@ -512,7 +512,7 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ...@@ -512,7 +512,7 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)
ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE); ASSERT(pBAEntry->Wcid < MAX_LEN_OF_MAC_TABLE);
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); /*Get an unused nonpaged memory */
if (NStatus != NDIS_STATUS_SUCCESS) { if (NStatus != NDIS_STATUS_SUCCESS) {
DBGPRINT(RT_DEBUG_ERROR, DBGPRINT(RT_DEBUG_ERROR,
("BA - MlmeADDBAAction() allocate memory failed \n")); ("BA - MlmeADDBAAction() allocate memory failed \n"));
...@@ -524,17 +524,17 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry) ...@@ -524,17 +524,17 @@ VOID SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry)
BarHeaderInit(pAd, &FrameBar, pEntry->Addr, BarHeaderInit(pAd, &FrameBar, pEntry->Addr,
pAd->CurrentAddress); pAd->CurrentAddress);
FrameBar.StartingSeq.field.FragNum = 0; // make sure sequence not clear in DEL function. FrameBar.StartingSeq.field.FragNum = 0; /* make sure sequence not clear in DEL function. */
FrameBar.StartingSeq.field.StartSeq = Sequence; // make sure sequence not clear in DEL funciton. FrameBar.StartingSeq.field.StartSeq = Sequence; /* make sure sequence not clear in DEL funciton. */
FrameBar.BarControl.TID = TID; // make sure sequence not clear in DEL funciton. FrameBar.BarControl.TID = TID; /* make sure sequence not clear in DEL funciton. */
MakeOutgoingFrame(pOutBuffer, &FrameLen, MakeOutgoingFrame(pOutBuffer, &FrameLen,
sizeof(FRAME_BAR), &FrameBar, sizeof(FRAME_BAR), &FrameBar,
END_OF_ARGS); END_OF_ARGS);
//if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) /*if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET))) */
if (1) // Now we always send BAR. if (1) /* Now we always send BAR. */
{ {
//MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); /*MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen); */
MiniportMMRequest(pAd, MiniportMMRequest(pAd,
(MGMT_USE_QUEUE_FLAG | (MGMT_USE_QUEUE_FLAG |
MapUserPriorityToAccessCategory MapUserPriorityToAccessCategory
......
...@@ -277,7 +277,7 @@ void construct_mic_header2(unsigned char *mic_header2, ...@@ -277,7 +277,7 @@ void construct_mic_header2(unsigned char *mic_header2,
mic_header2[4] = mpdu[20]; mic_header2[4] = mpdu[20];
mic_header2[5] = mpdu[21]; mic_header2[5] = mpdu[21];
// In Sequence Control field, mute sequence numer bits (12-bit) /* In Sequence Control field, mute sequence numer bits (12-bit) */
mic_header2[6] = mpdu[22] & 0x0f; /* SC */ mic_header2[6] = mpdu[22] & 0x0f; /* SC */
mic_header2[7] = 0x00; /* mpdu[23]; */ mic_header2[7] = 0x00; /* mpdu[23]; */
...@@ -403,7 +403,7 @@ void construct_ctr_preload(unsigned char *ctr_preload, ...@@ -403,7 +403,7 @@ void construct_ctr_preload(unsigned char *ctr_preload,
for (i = 8; i < 14; i++) for (i = 8; i < 14; i++)
ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */ ctr_preload[i] = pn_vector[13 - i]; /* ctr_preload[8:13] = PN[5:0] */
#endif #endif
ctr_preload[14] = (unsigned char)(c / 256); // Ctr ctr_preload[14] = (unsigned char)(c / 256); /* Ctr */
ctr_preload[15] = (unsigned char)(c % 256); ctr_preload[15] = (unsigned char)(c % 256);
} }
...@@ -477,12 +477,12 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -477,12 +477,12 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
PN[4] = *(pData + HeaderLen + 6); PN[4] = *(pData + HeaderLen + 6);
PN[5] = *(pData + HeaderLen + 7); PN[5] = *(pData + HeaderLen + 7);
payload_len = DataByteCnt - HeaderLen - 8 - 8; // 8 bytes for CCMP header , 8 bytes for MIC payload_len = DataByteCnt - HeaderLen - 8 - 8; /* 8 bytes for CCMP header , 8 bytes for MIC */
payload_remainder = (payload_len) % 16; payload_remainder = (payload_len) % 16;
num_blocks = (payload_len) / 16; num_blocks = (payload_len) / 16;
// Find start of payload /* Find start of payload */
payload_index = HeaderLen + 8; //IV+EIV payload_index = HeaderLen + 8; /*IV+EIV */
for (i = 0; i < num_blocks; i++) { for (i = 0; i < num_blocks; i++) {
construct_ctr_preload(ctr_preload, construct_ctr_preload(ctr_preload,
...@@ -495,10 +495,10 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -495,10 +495,10 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
payload_index += 16; payload_index += 16;
} }
// /* */
// If there is a short final block, then pad it /* If there is a short final block, then pad it */
// encrypt it and copy the unpadded part back /* encrypt it and copy the unpadded part back */
// /* */
if (payload_remainder > 0) { if (payload_remainder > 0) {
construct_ctr_preload(ctr_preload, construct_ctr_preload(ctr_preload,
a4_exists, a4_exists,
...@@ -515,9 +515,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -515,9 +515,9 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
payload_remainder); payload_remainder);
payload_index += payload_remainder; payload_index += payload_remainder;
} }
// /* */
// Descrypt the MIC /* Descrypt the MIC */
// /* */
construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0); construct_ctr_preload(ctr_preload, a4_exists, qc_exists, pData, PN, 0);
NdisZeroMemory(padded_buffer, 16); NdisZeroMemory(padded_buffer, 16);
NdisMoveMemory(padded_buffer, pData + payload_index, 8); NdisMoveMemory(padded_buffer, pData + payload_index, 8);
...@@ -528,15 +528,15 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -528,15 +528,15 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
NdisMoveMemory(TrailMIC, chain_buffer, 8); NdisMoveMemory(TrailMIC, chain_buffer, 8);
// /* */
// Calculate MIC /* Calculate MIC */
// /* */
//Force the protected frame bit on /*Force the protected frame bit on */
*(pData + 1) = *(pData + 1) | 0x40; *(pData + 1) = *(pData + 1) | 0x40;
// Find start of payload /* Find start of payload */
// Because the CCMP header has been removed /* Because the CCMP header has been removed */
payload_index = HeaderLen; payload_index = HeaderLen;
construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN); construct_mic_iv(mic_iv, qc_exists, a4_exists, pData, payload_len, PN);
...@@ -551,14 +551,14 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -551,14 +551,14 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
bitwise_xor(aes_out, mic_header2, chain_buffer); bitwise_xor(aes_out, mic_header2, chain_buffer);
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
// iterate through each 16 byte payload block /* iterate through each 16 byte payload block */
for (i = 0; i < num_blocks; i++) { for (i = 0; i < num_blocks; i++) {
bitwise_xor(aes_out, pData + payload_index, chain_buffer); bitwise_xor(aes_out, pData + payload_index, chain_buffer);
payload_index += 16; payload_index += 16;
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
} }
// Add on the final payload block if it needs padding /* Add on the final payload block if it needs padding */
if (payload_remainder > 0) { if (payload_remainder > 0) {
NdisZeroMemory(padded_buffer, 16); NdisZeroMemory(padded_buffer, 16);
NdisMoveMemory(padded_buffer, pData + payload_index, NdisMoveMemory(padded_buffer, pData + payload_index,
...@@ -567,13 +567,13 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd, ...@@ -567,13 +567,13 @@ BOOLEAN RTMPSoftDecryptAES(IN PRTMP_ADAPTER pAd,
bitwise_xor(aes_out, padded_buffer, chain_buffer); bitwise_xor(aes_out, padded_buffer, chain_buffer);
aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out); aes128k128d(pWpaKey[KeyID].Key, chain_buffer, aes_out);
} }
// aes_out contains padded mic, discard most significant /* aes_out contains padded mic, discard most significant */
// 8 bytes to generate 64 bit MIC /* 8 bytes to generate 64 bit MIC */
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
MIC[i] = aes_out[i]; MIC[i] = aes_out[i];
if (!NdisEqualMemory(MIC, TrailMIC, 8)) { if (!NdisEqualMemory(MIC, TrailMIC, 8)) {
DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); //MIC error. DBGPRINT(RT_DEBUG_ERROR, ("RTMPSoftDecryptAES, MIC Error !\n")); /*MIC error. */
return FALSE; return FALSE;
} }
...@@ -1208,27 +1208,27 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, ...@@ -1208,27 +1208,27 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
{ {
UCHAR A[8], BIN[16], BOUT[16]; UCHAR A[8], BIN[16], BOUT[16];
UCHAR R[512]; UCHAR R[512];
INT num_blocks = p_len / 8; // unit:64bits INT num_blocks = p_len / 8; /* unit:64bits */
INT i, j; INT i, j;
aes_context aesctx; aes_context aesctx;
UCHAR xor; UCHAR xor;
rt_aes_set_key(&aesctx, key, 128); rt_aes_set_key(&aesctx, key, 128);
// Init IA /* Init IA */
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
A[i] = 0xa6; A[i] = 0xa6;
//Input plaintext /*Input plaintext */
for (i = 0; i < num_blocks; i++) { for (i = 0; i < num_blocks; i++) {
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
R[8 * (i + 1) + j] = plaintext[8 * i + j]; R[8 * (i + 1) + j] = plaintext[8 * i + j];
} }
// Key Mix /* Key Mix */
for (j = 0; j < 6; j++) { for (j = 0; j < 6; j++) {
for (i = 1; i <= num_blocks; i++) { for (i = 1; i <= num_blocks; i++) {
//phase 1 /*phase 1 */
NdisMoveMemory(BIN, A, 8); NdisMoveMemory(BIN, A, 8);
NdisMoveMemory(&BIN[8], &R[8 * i], 8); NdisMoveMemory(&BIN[8], &R[8 * i], 8);
rt_aes_encrypt(&aesctx, BIN, BOUT); rt_aes_encrypt(&aesctx, BIN, BOUT);
...@@ -1240,7 +1240,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key, ...@@ -1240,7 +1240,7 @@ VOID AES_GTK_KEY_WRAP(IN UCHAR * key,
} }
} }
// Output ciphertext /* Output ciphertext */
NdisMoveMemory(ciphertext, A, 8); NdisMoveMemory(ciphertext, A, 8);
for (i = 1; i <= num_blocks; i++) { for (i = 1; i <= num_blocks; i++) {
...@@ -1273,7 +1273,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, ...@@ -1273,7 +1273,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
INT i, j; INT i, j;
aes_context aesctx; aes_context aesctx;
UCHAR *R; UCHAR *R;
INT num_blocks = c_len / 8; // unit:64bits INT num_blocks = c_len / 8; /* unit:64bits */
os_alloc_mem(NULL, (PUCHAR *) & R, 512); os_alloc_mem(NULL, (PUCHAR *) & R, 512);
...@@ -1283,9 +1283,9 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, ...@@ -1283,9 +1283,9 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
return; return;
} }
/* End of if */ /* End of if */
// Initialize /* Initialize */
NdisMoveMemory(A, ciphertext, 8); NdisMoveMemory(A, ciphertext, 8);
//Input plaintext /*Input plaintext */
for (i = 0; i < (c_len - 8); i++) { for (i = 0; i < (c_len - 8); i++) {
R[i] = ciphertext[i + 8]; R[i] = ciphertext[i + 8];
} }
...@@ -1304,7 +1304,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key, ...@@ -1304,7 +1304,7 @@ VOID AES_GTK_KEY_UNWRAP(IN UCHAR * key,
} }
} }
// OUTPUT /* OUTPUT */
for (i = 0; i < c_len; i++) { for (i = 0; i < c_len; i++) {
plaintext[i] = R[i]; plaintext[i] = R[i];
} }
......
...@@ -95,8 +95,8 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band) ...@@ -95,8 +95,8 @@ INT RT_CfgSetCountryRegion(IN PRTMP_ADAPTER pAd, IN PSTRING arg, IN INT band)
regionMax = REGION_MAXIMUM_A_BAND; regionMax = REGION_MAXIMUM_A_BAND;
} }
// TODO: Is it neccesay for following check??? /* TODO: Is it neccesay for following check??? */
// Country can be set only when EEPROM not programmed /* Country can be set only when EEPROM not programmed */
if (*pCountryRegion & 0x80) { if (*pCountryRegion & 0x80) {
DBGPRINT(RT_DEBUG_ERROR, DBGPRINT(RT_DEBUG_ERROR,
("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n")); ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n"));
...@@ -154,7 +154,7 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg) ...@@ -154,7 +154,7 @@ INT RT_CfgSetShortSlot(IN PRTMP_ADAPTER pAd, IN PSTRING arg)
else if (ShortSlot == 0) else if (ShortSlot == 0)
pAd->CommonCfg.bUseShortSlotTime = FALSE; pAd->CommonCfg.bUseShortSlotTime = FALSE;
else else
return FALSE; //Invalid argument return FALSE; /*Invalid argument */
return TRUE; return TRUE;
} }
...@@ -176,29 +176,29 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd, ...@@ -176,29 +176,29 @@ INT RT_CfgSetWepKey(IN PRTMP_ADAPTER pAd,
UCHAR CipherAlg = CIPHER_NONE; UCHAR CipherAlg = CIPHER_NONE;
BOOLEAN bKeyIsHex = FALSE; BOOLEAN bKeyIsHex = FALSE;
// TODO: Shall we do memset for the original key info?? /* TODO: Shall we do memset for the original key info?? */
memset(pSharedKey, 0, sizeof(CIPHER_KEY)); memset(pSharedKey, 0, sizeof(CIPHER_KEY));
KeyLen = strlen(keyString); KeyLen = strlen(keyString);
switch (KeyLen) { switch (KeyLen) {
case 5: //wep 40 Ascii type case 5: /*wep 40 Ascii type */
case 13: //wep 104 Ascii type case 13: /*wep 104 Ascii type */
bKeyIsHex = FALSE; bKeyIsHex = FALSE;
pSharedKey->KeyLen = KeyLen; pSharedKey->KeyLen = KeyLen;
NdisMoveMemory(pSharedKey->Key, keyString, KeyLen); NdisMoveMemory(pSharedKey->Key, keyString, KeyLen);
break; break;
case 10: //wep 40 Hex type case 10: /*wep 40 Hex type */
case 26: //wep 104 Hex type case 26: /*wep 104 Hex type */
for (i = 0; i < KeyLen; i++) { for (i = 0; i < KeyLen; i++) {
if (!isxdigit(*(keyString + i))) if (!isxdigit(*(keyString + i)))
return FALSE; //Not Hex value; return FALSE; /*Not Hex value; */
} }
bKeyIsHex = TRUE; bKeyIsHex = TRUE;
pSharedKey->KeyLen = KeyLen / 2; pSharedKey->KeyLen = KeyLen / 2;
AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen); AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
break; break;
default: //Invalid argument default: /*Invalid argument */
DBGPRINT(RT_DEBUG_TRACE, DBGPRINT(RT_DEBUG_TRACE,
("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n",
keyIdx, keyString)); keyIdx, keyString));
......
...@@ -65,8 +65,8 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) ...@@ -65,8 +65,8 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType)
return 0; return 0;
} else } else
DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n")); DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
#endif // RTMP_EFUSE_SUPPORT // #endif /* RTMP_EFUSE_SUPPORT // */
#endif // RT30xx // #endif /* RT30xx // */
switch (infType) { switch (infType) {
#ifdef RTMP_PCI_SUPPORT #ifdef RTMP_PCI_SUPPORT
...@@ -74,13 +74,13 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType) ...@@ -74,13 +74,13 @@ INT RtmpChipOpsEepromHook(IN RTMP_ADAPTER * pAd, IN INT infType)
pChipOps->eeinit = NULL; pChipOps->eeinit = NULL;
pChipOps->eeread = rtmp_ee_prom_read16; pChipOps->eeread = rtmp_ee_prom_read16;
break; break;
#endif // RTMP_PCI_SUPPORT // #endif /* RTMP_PCI_SUPPORT // */
#ifdef RTMP_USB_SUPPORT #ifdef RTMP_USB_SUPPORT
case RTMP_DEV_INF_USB: case RTMP_DEV_INF_USB:
pChipOps->eeinit = NULL; pChipOps->eeinit = NULL;
pChipOps->eeread = RTUSBReadEEPROM16; pChipOps->eeread = RTUSBReadEEPROM16;
break; break;
#endif // RTMP_USB_SUPPORT // #endif /* RTMP_USB_SUPPORT // */
default: default:
DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n")); DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n"));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册