2009-06-13 05:38:31 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* File: key.h
|
|
|
|
*
|
|
|
|
* Purpose: Implement functions for 802.11i Key management
|
|
|
|
*
|
|
|
|
* Author: Jerry Chen
|
|
|
|
*
|
|
|
|
* Date: May 29, 2003
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __KEY_H__
|
|
|
|
#define __KEY_H__
|
|
|
|
|
|
|
|
#include "tether.h"
|
|
|
|
#include "80211mgr.h"
|
|
|
|
|
|
|
|
#define MAX_GROUP_KEY 4
|
|
|
|
#define MAX_KEY_TABLE 11
|
|
|
|
#define MAX_KEY_LEN 32
|
|
|
|
#define AES_KEY_LEN 16
|
|
|
|
|
|
|
|
#define AUTHENTICATOR_KEY 0x10000000
|
|
|
|
#define USE_KEYRSC 0x20000000
|
|
|
|
#define PAIRWISE_KEY 0x40000000
|
|
|
|
#define TRANSMIT_KEY 0x80000000
|
|
|
|
|
|
|
|
#define GROUP_KEY 0x00000000
|
|
|
|
|
|
|
|
#define KEY_CTL_WEP 0x00
|
|
|
|
#define KEY_CTL_NONE 0x01
|
|
|
|
#define KEY_CTL_TKIP 0x02
|
|
|
|
#define KEY_CTL_CCMP 0x03
|
|
|
|
#define KEY_CTL_INVALID 0xFF
|
|
|
|
|
|
|
|
typedef struct tagSKeyItem
|
|
|
|
{
|
2013-02-12 18:36:28 -07:00
|
|
|
bool bKeyValid;
|
2012-11-11 08:49:59 -07:00
|
|
|
u32 uKeyLength;
|
2013-02-25 18:32:51 -07:00
|
|
|
u8 abyKey[MAX_KEY_LEN];
|
2012-11-28 14:11:02 -07:00
|
|
|
u64 KeyRSC;
|
2013-02-25 18:32:53 -07:00
|
|
|
u32 dwTSC47_16;
|
2013-02-25 18:32:52 -07:00
|
|
|
u16 wTSC15_0;
|
2013-02-25 18:32:51 -07:00
|
|
|
u8 byCipherSuite;
|
|
|
|
u8 byReserved0;
|
2013-02-25 18:32:53 -07:00
|
|
|
u32 dwKeyIndex;
|
2010-05-01 11:25:00 -06:00
|
|
|
void *pvKeyTable;
|
2009-08-12 15:54:06 -06:00
|
|
|
} SKeyItem, *PSKeyItem; //64
|
2009-06-13 05:38:31 -06:00
|
|
|
|
|
|
|
typedef struct tagSKeyTable
|
|
|
|
{
|
2013-02-25 18:32:51 -07:00
|
|
|
u8 abyBSSID[ETH_ALEN]; /* 6 */
|
|
|
|
u8 byReserved0[2]; //8
|
2009-06-13 05:38:31 -06:00
|
|
|
SKeyItem PairwiseKey;
|
|
|
|
SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
|
2013-02-25 18:32:53 -07:00
|
|
|
u32 dwGTKeyIndex; // GroupTransmitKey Index
|
2013-02-12 18:36:28 -07:00
|
|
|
bool bInUse;
|
2013-02-25 18:32:52 -07:00
|
|
|
u16 wKeyCtl;
|
2013-02-12 18:36:28 -07:00
|
|
|
bool bSoftWEP;
|
2013-02-25 18:32:51 -07:00
|
|
|
u8 byReserved1[6];
|
2009-08-12 15:54:06 -06:00
|
|
|
} SKeyTable, *PSKeyTable; //352
|
2009-06-13 05:38:31 -06:00
|
|
|
|
|
|
|
typedef struct tagSKeyManagement
|
|
|
|
{
|
|
|
|
SKeyTable KeyTable[MAX_KEY_TABLE];
|
2009-08-12 15:54:06 -06:00
|
|
|
} SKeyManagement, *PSKeyManagement;
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2012-12-10 15:12:07 -07:00
|
|
|
void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable);
|
|
|
|
|
|
|
|
int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex,
|
|
|
|
PSKeyItem *pKey);
|
|
|
|
|
|
|
|
int KeybSetKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID,
|
|
|
|
u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey,
|
|
|
|
u8 byKeyDecMode);
|
|
|
|
|
|
|
|
int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable,
|
|
|
|
u8 *pbyBSSID, u32 dwKeyIndex);
|
|
|
|
|
|
|
|
int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable,
|
|
|
|
u8 *pbyBSSID);
|
|
|
|
|
|
|
|
int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType,
|
|
|
|
PSKeyItem *pKey);
|
|
|
|
|
|
|
|
int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable,
|
|
|
|
u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey,
|
|
|
|
u8 byKeyDecMode);
|
|
|
|
|
|
|
|
int KeybSetAllGroupKey(struct vnt_private *, PSKeyManagement pTable,
|
|
|
|
u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey,
|
|
|
|
u8 byKeyDecMode);
|
2009-06-13 05:38:31 -06:00
|
|
|
|
2010-05-01 16:12:26 -06:00
|
|
|
#endif /* __KEY_H__ */
|