VOID AsicUpdateWdsEncryption(RTMP_ADAPTER *pAd, UCHAR wcid) { UINT WdsIdex; PMAC_TABLE_ENTRY pEntry = NULL; RT_802_11_WDS_ENTRY *wds_entry; struct wifi_dev *wdev; do { if (wcid >= MAX_LEN_OF_MAC_TABLE) break; pEntry = &pAd->MacTab.Content[wcid]; if (pAd->WdsTab.WdsEntry[pEntry->func_tb_idx].Valid != TRUE) break; if (!IS_ENTRY_WDS(pEntry)) break; WdsIdex = pEntry->func_tb_idx; wds_entry = &pAd->WdsTab.WdsEntry[WdsIdex]; wdev = &wds_entry->wdev; if (((wdev->WepStatus == Ndis802_11WEPEnabled) || (wdev->WepStatus == Ndis802_11TKIPEnable) || (wdev->WepStatus == Ndis802_11AESEnable)) && (wds_entry->WdsKey.KeyLen > 0)) { INT DefaultKeyId = 0; if (wdev->WepStatus == Ndis802_11WEPEnabled) DefaultKeyId = wds_entry->KeyIdx; if (!VAILD_KEY_INDEX(DefaultKeyId)) break; /* Update key into Asic Pairwise key table */ RTMP_ASIC_PAIRWISE_KEY_TABLE( pAd, pEntry->wcid, &wds_entry->WdsKey); /* update WCID attribute table and IVEIV table for this entry */ RTMP_SET_WCID_SEC_INFO( pAd, MAIN_MBSSID + MIN_NET_DEVICE_FOR_WDS, DefaultKeyId, wds_entry->WdsKey.CipherAlg, pEntry->wcid, PAIRWISEKEY); #ifdef MT_MAC if (pAd->chipCap.hif_type == HIF_MT) CmdProcAddRemoveKey(pAd, 0, pEntry->func_tb_idx, DefaultKeyId, pEntry->wcid, PAIRWISEKEYTABLE, &wds_entry->WdsKey, pEntry->Addr); #endif /* MT_MAC */ } } while (FALSE); return; }
VOID AsicUpdateWdsEncryption( IN PRTMP_ADAPTER pAd, IN UCHAR wcid) { UINT WdsIdex; PMAC_TABLE_ENTRY pEntry = NULL; do { if (wcid >= MAX_LEN_OF_MAC_TABLE) break; pEntry = &pAd->MacTab.Content[wcid]; if (pAd->WdsTab.WdsEntry[pEntry->MatchWDSTabIdx].Valid != TRUE) break; if (!IS_ENTRY_WDS(pEntry)) break; WdsIdex = pEntry->MatchWDSTabIdx; if (((pAd->WdsTab.WdsEntry[WdsIdex].WepStatus == Ndis802_11Encryption1Enabled) || (pAd->WdsTab.WdsEntry[WdsIdex].WepStatus == Ndis802_11Encryption2Enabled) || (pAd->WdsTab.WdsEntry[WdsIdex].WepStatus == Ndis802_11Encryption3Enabled)) && (pAd->WdsTab.WdsEntry[WdsIdex].WdsKey.KeyLen > 0)) { INT DefaultKeyId = 0; if (pAd->WdsTab.WdsEntry[WdsIdex].WepStatus == Ndis802_11Encryption1Enabled) DefaultKeyId = pAd->WdsTab.WdsEntry[pEntry->MatchWDSTabIdx].KeyIdx; if (!VAILD_KEY_INDEX(DefaultKeyId)) break; /* Update key into Asic Pairwise key table */ RTMP_ASIC_PAIRWISE_KEY_TABLE( pAd, pEntry->Aid, &pAd->WdsTab.WdsEntry[pEntry->MatchWDSTabIdx].WdsKey); /* update WCID attribute table and IVEIV table for this entry */ RTMP_SET_WCID_SEC_INFO( pAd, MAIN_MBSSID + MIN_NET_DEVICE_FOR_WDS, DefaultKeyId, pAd->WdsTab.WdsEntry[pEntry->MatchWDSTabIdx].WdsKey.CipherAlg, pEntry->Aid, PAIRWISEKEY); } } while (FALSE); return; }
VOID WpaStaPairwiseKeySetting( IN PRTMP_ADAPTER pAd) { PCIPHER_KEY pSharedKey; PMAC_TABLE_ENTRY pEntry; pEntry = &pAd->MacTab.Content[BSSID_WCID]; /* Pairwise key shall use key#0 */ pSharedKey = &pAd->SharedKey[BSS0][0]; NdisMoveMemory(pAd->StaCfg.PTK, pEntry->PTK, LEN_PTK); /* Prepare pair-wise key information into shared key table */ NdisZeroMemory(pSharedKey, sizeof(CIPHER_KEY)); pSharedKey->KeyLen = LEN_TK; NdisMoveMemory(pSharedKey->Key, &pAd->StaCfg.PTK[32], LEN_TK); NdisMoveMemory(pSharedKey->RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_MIC); NdisMoveMemory(pSharedKey->TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_MIC], LEN_TKIP_MIC); /* Decide its ChiperAlg */ if (pAd->StaCfg.PairCipher == Ndis802_11Encryption2Enabled) pSharedKey->CipherAlg = CIPHER_TKIP; else if (pAd->StaCfg.PairCipher == Ndis802_11Encryption3Enabled) pSharedKey->CipherAlg = CIPHER_AES; else pSharedKey->CipherAlg = CIPHER_NONE; /* Update these related information to MAC_TABLE_ENTRY */ NdisMoveMemory(pEntry->PairwiseKey.Key, &pAd->StaCfg.PTK[32], LEN_TK); NdisMoveMemory(pEntry->PairwiseKey.RxMic, &pAd->StaCfg.PTK[48], LEN_TKIP_MIC); NdisMoveMemory(pEntry->PairwiseKey.TxMic, &pAd->StaCfg.PTK[48+LEN_TKIP_MIC], LEN_TKIP_MIC); pEntry->PairwiseKey.CipherAlg = pSharedKey->CipherAlg; /* Update pairwise key information to ASIC Shared Key Table */ RTMP_ASIC_SHARED_KEY_TABLE(pAd, BSS0, 0, pSharedKey); /* Update ASIC WCID attribute table and IVEIV table */ RTMP_SET_WCID_SEC_INFO(pAd, BSS0, 0, pSharedKey->CipherAlg, BSSID_WCID, SHAREDKEYTABLE); RTMP_SET_PORT_SECURED(pAd); DBGPRINT(RT_DEBUG_TRACE, ("%s : AID(%d) port secured\n", __FUNCTION__, pEntry->Aid)); }