2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 * Purpose: Implement functions for 802.11i Key management
37 /*--------------------- Export Definitions -------------------------*/
38 #define MAX_GROUP_KEY 4
39 #define MAX_KEY_TABLE 11
40 #define MAX_KEY_LEN 32
41 #define AES_KEY_LEN 16
43 #define AUTHENTICATOR_KEY 0x10000000
44 #define USE_KEYRSC 0x20000000
45 #define PAIRWISE_KEY 0x40000000
46 #define TRANSMIT_KEY 0x80000000
48 #define GROUP_KEY 0x00000000
50 #define KEY_CTL_WEP 0x00
51 #define KEY_CTL_NONE 0x01
52 #define KEY_CTL_TKIP 0x02
53 #define KEY_CTL_CCMP 0x03
54 #define KEY_CTL_INVALID 0xFF
56 typedef struct tagSKeyItem {
58 unsigned long uKeyLength;
59 unsigned char abyKey[MAX_KEY_LEN];
61 unsigned long dwTSC47_16;
62 unsigned short wTSC15_0;
63 unsigned char byCipherSuite;
64 unsigned char byReserved0;
65 unsigned long dwKeyIndex;
67 } SKeyItem, *PSKeyItem; //64
69 typedef struct tagSKeyTable {
70 unsigned char abyBSSID[ETH_ALEN]; //6
71 unsigned char byReserved0[2]; //8
73 SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328
74 unsigned long dwGTKeyIndex; // GroupTransmitKey Index
76 //2006-1116-01,<Modify> by NomadZhao
78 unsigned short wKeyCtl; // for address of wKeyCtl at align 4
80 unsigned char byReserved1[6];
81 } SKeyTable, *PSKeyTable; //348
83 typedef struct tagSKeyManagement {
84 SKeyTable KeyTable[MAX_KEY_TABLE];
85 } SKeyManagement, *PSKeyManagement;
87 /*--------------------- Export Types ------------------------------*/
89 /*--------------------- Export Macros ------------------------------*/
91 /*--------------------- Export Classes ----------------------------*/
93 /*--------------------- Export Variables --------------------------*/
95 /*--------------------- Export Functions --------------------------*/
97 void KeyvInitTable(PSKeyManagement pTable, void __iomem *dwIoBase);
100 PSKeyManagement pTable,
101 unsigned char *pbyBSSID,
102 unsigned long dwKeyIndex,
107 PSKeyManagement pTable,
108 unsigned char *pbyBSSID,
109 unsigned long dwKeyIndex,
110 unsigned long uKeyLength,
112 unsigned char *pbyKey,
113 unsigned char byKeyDecMode,
114 void __iomem *dwIoBase,
115 unsigned char byLocalID
118 bool KeybSetDefaultKey(
119 PSKeyManagement pTable,
120 unsigned long dwKeyIndex,
121 unsigned long uKeyLength,
123 unsigned char *pbyKey,
124 unsigned char byKeyDecMode,
125 void __iomem *dwIoBase,
126 unsigned char byLocalID
130 PSKeyManagement pTable,
131 unsigned char *pbyBSSID,
132 unsigned long dwKeyIndex,
133 void __iomem *dwIoBase
136 bool KeybGetTransmitKey(
137 PSKeyManagement pTable,
138 unsigned char *pbyBSSID,
139 unsigned long dwKeyType,
143 bool KeybCheckPairewiseKey(
144 PSKeyManagement pTable,
148 bool KeybRemoveAllKey(
149 PSKeyManagement pTable,
150 unsigned char *pbyBSSID,
151 void __iomem *dwIoBase
154 void KeyvRemoveWEPKey(
155 PSKeyManagement pTable,
156 unsigned long dwKeyIndex,
157 void __iomem *dwIoBase
160 void KeyvRemoveAllWEPKey(
161 PSKeyManagement pTable,
162 void __iomem *dwIoBase
165 bool KeybSetAllGroupKey(
166 PSKeyManagement pTable,
167 unsigned long dwKeyIndex,
168 unsigned long uKeyLength,
170 unsigned char *pbyKey,
171 unsigned char byKeyDecMode,
172 void __iomem *dwIoBase,
173 unsigned char byLocalID