diff options
Diffstat (limited to 'drivers/staging/vt6656/key.c')
-rw-r--r-- | drivers/staging/vt6656/key.c | 111 |
1 files changed, 7 insertions, 104 deletions
diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 416175e8ba53..205590b0e9c8 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -42,24 +42,9 @@ #include "rndis.h" #include "control.h" -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ - -/*--------------------- Static Variables --------------------------*/ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; -/*--------------------- Static Functions --------------------------*/ - -/*--------------------- Export Variables --------------------------*/ - -/*--------------------- Static Definitions -------------------------*/ - -/*--------------------- Static Classes ----------------------------*/ -/*--------------------- Static Variables --------------------------*/ - -/*--------------------- Static Functions --------------------------*/ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, PSKeyManagement pTable) { @@ -79,7 +64,7 @@ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, pTable->KeyTable[i].bInUse = false; pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].bSoftWEP = false; - pbyData[wLength++] = (BYTE) i; + pbyData[wLength++] = (u8) i; //MACvDisableKeyEntry(pDevice, i); } } @@ -95,10 +80,6 @@ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, } - -/*--------------------- Export Functions --------------------------*/ - - /* * Description: Init Key management table * @@ -130,9 +111,9 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) pTable->KeyTable[i].wKeyCtl = 0; pTable->KeyTable[i].dwGTKeyIndex = 0; pTable->KeyTable[i].bSoftWEP = false; - pbyData[i] = (BYTE) i; + pbyData[i] = (u8) i; } - pbyData[i] = (BYTE) i; + pbyData[i] = (u8) i; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_CLRKEYENTRY, 0, @@ -146,7 +127,6 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) return; } - /* * Description: Get Key from table * @@ -197,7 +177,6 @@ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, return (false); } - /* * Description: Set Key to table * @@ -272,7 +251,7 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, if (uKeyLength == WLAN_WEP104_KEYLEN) pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ @@ -340,7 +319,7 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, if (uKeyLength == WLAN_WEP104_KEYLEN) pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (PDWORD)pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[j].wKeyCtl, j, uKeyIdx, pbyBSSID, (u32 *)pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ @@ -370,7 +349,6 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (false); } - /* * Description: Remove Key from table * @@ -445,10 +423,8 @@ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, s_vCheckKeyTableValid(pDevice,pTable); return bReturnValue; - } - /* * Description: Remove Key from table * @@ -483,45 +459,6 @@ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, } /* - * Description: Remove WEP Key from table - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if success otherwise false - * - */ -void KeyvRemoveWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u32 dwKeyIndex) -{ - - if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { - pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; - if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { - // remove Group transmit key - pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0; - } - } - } - s_vCheckKeyTableValid(pDevice, pTable); - } - return; -} - -void KeyvRemoveAllWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable) -{ - int i; - - for (i = 0; i < MAX_GROUP_KEY; i++) - KeyvRemoveWEPKey(pDevice, pTable, i); -} - -/* * Description: Get Transmit Key from table * * Parameters: @@ -557,7 +494,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (true); } else { @@ -599,35 +535,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, return (false); } - -/* - * Description: Check Pairwise Key - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if found otherwise false - * - */ -int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) -{ - int i; - - *pKey = NULL; - - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { - *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (true); - } - } - return (false); -} - /* * Description: Set Key to table * @@ -707,18 +614,16 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (PDWORD) pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl, MAX_KEY_TABLE-1, uKeyIdx, pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID, (u32 *) pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ else pKey->KeyRSC = *KeyRSC; - pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n", pKey->bKeyValid); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); @@ -737,7 +642,6 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (true); } - /* * Description: Set Key to table * @@ -766,7 +670,6 @@ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", dwKeyIndex); - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key return (false); } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { @@ -805,7 +708,7 @@ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, pKey->abyKey[15] |= 0x80; } - MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (PDWORD) pKey->abyKey); + MACvSetKeyEntry(pDevice, pTable->KeyTable[i].wKeyCtl, i, uKeyIdx, pTable->KeyTable[i].abyBSSID, (u32 *) pKey->abyKey); if ((dwKeyIndex & USE_KEYRSC) == 0) pKey->KeyRSC = 0; /* RSC set by NIC */ |