]>
Commit | Line | Data |
---|---|---|
5449c685 FB |
1 | /* |
2 | * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. | |
3 | * All rights reserved. | |
4 | * | |
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. | |
9 | * | |
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. | |
14 | * | |
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. | |
18 | * | |
19 | * | |
20 | * File: key.h | |
21 | * | |
22 | * Purpose: Implement functions for 802.11i Key management | |
23 | * | |
24 | * Author: Jerry Chen | |
25 | * | |
26 | * Date: May 29, 2003 | |
27 | * | |
28 | */ | |
29 | ||
5449c685 FB |
30 | #ifndef __KEY_H__ |
31 | #define __KEY_H__ | |
32 | ||
5449c685 | 33 | #include "ttype.h" |
5449c685 | 34 | #include "tether.h" |
5449c685 | 35 | #include "80211mgr.h" |
5449c685 FB |
36 | |
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 | |
42 | ||
5449c685 FB |
43 | #define AUTHENTICATOR_KEY 0x10000000 |
44 | #define USE_KEYRSC 0x20000000 | |
45 | #define PAIRWISE_KEY 0x40000000 | |
46 | #define TRANSMIT_KEY 0x80000000 | |
47 | ||
48 | #define GROUP_KEY 0x00000000 | |
49 | ||
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 | |
55 | ||
5449c685 FB |
56 | typedef struct tagSKeyItem |
57 | { | |
d82adcab JP |
58 | bool bKeyValid; |
59 | unsigned long uKeyLength; | |
60 | unsigned char abyKey[MAX_KEY_LEN]; | |
61 | QWORD KeyRSC; | |
62 | unsigned long dwTSC47_16; | |
63 | unsigned short wTSC15_0; | |
64 | unsigned char byCipherSuite; | |
65 | unsigned char byReserved0; | |
66 | unsigned long dwKeyIndex; | |
67 | void *pvKeyTable; | |
a884847a | 68 | } SKeyItem, *PSKeyItem; //64 |
5449c685 FB |
69 | |
70 | typedef struct tagSKeyTable | |
71 | { | |
d82adcab JP |
72 | unsigned char abyBSSID[ETH_ALEN]; //6 |
73 | unsigned char byReserved0[2]; //8 | |
74 | SKeyItem PairwiseKey; | |
75 | SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 | |
76 | unsigned long dwGTKeyIndex; // GroupTransmitKey Index | |
77 | bool bInUse; | |
78 | //2006-1116-01,<Modify> by NomadZhao | |
79 | //unsigned short wKeyCtl; | |
80 | //bool bSoftWEP; | |
81 | bool bSoftWEP; | |
82 | unsigned short wKeyCtl; // for address of wKeyCtl at align 4 | |
83 | ||
84 | unsigned char byReserved1[6]; | |
a884847a | 85 | } SKeyTable, *PSKeyTable; //348 |
5449c685 FB |
86 | |
87 | typedef struct tagSKeyManagement | |
88 | { | |
d82adcab JP |
89 | SKeyTable KeyTable[MAX_KEY_TABLE]; |
90 | } SKeyManagement, *PSKeyManagement; | |
5449c685 FB |
91 | |
92 | /*--------------------- Export Types ------------------------------*/ | |
93 | ||
94 | /*--------------------- Export Macros ------------------------------*/ | |
95 | ||
96 | /*--------------------- Export Classes ----------------------------*/ | |
97 | ||
98 | /*--------------------- Export Variables --------------------------*/ | |
99 | ||
100 | /*--------------------- Export Functions --------------------------*/ | |
5449c685 | 101 | |
412b2d08 | 102 | void KeyvInitTable(PSKeyManagement pTable, unsigned long dwIoBase); |
5449c685 | 103 | |
7b6a0013 | 104 | bool KeybGetKey( |
d82adcab JP |
105 | PSKeyManagement pTable, |
106 | unsigned char *pbyBSSID, | |
107 | unsigned long dwKeyIndex, | |
108 | PSKeyItem *pKey | |
109 | ); | |
5449c685 | 110 | |
7b6a0013 | 111 | bool KeybSetKey( |
d82adcab JP |
112 | PSKeyManagement pTable, |
113 | unsigned char *pbyBSSID, | |
114 | unsigned long dwKeyIndex, | |
115 | unsigned long uKeyLength, | |
116 | PQWORD pKeyRSC, | |
117 | unsigned char *pbyKey, | |
118 | unsigned char byKeyDecMode, | |
119 | unsigned long dwIoBase, | |
120 | unsigned char byLocalID | |
121 | ); | |
5449c685 | 122 | |
7b6a0013 | 123 | bool KeybSetDefaultKey( |
d82adcab JP |
124 | PSKeyManagement pTable, |
125 | unsigned long dwKeyIndex, | |
126 | unsigned long uKeyLength, | |
127 | PQWORD pKeyRSC, | |
128 | unsigned char *pbyKey, | |
129 | unsigned char byKeyDecMode, | |
130 | unsigned long dwIoBase, | |
131 | unsigned char byLocalID | |
132 | ); | |
5449c685 | 133 | |
7b6a0013 | 134 | bool KeybRemoveKey( |
d82adcab JP |
135 | PSKeyManagement pTable, |
136 | unsigned char *pbyBSSID, | |
137 | unsigned long dwKeyIndex, | |
138 | unsigned long dwIoBase | |
139 | ); | |
5449c685 | 140 | |
7b6a0013 | 141 | bool KeybGetTransmitKey( |
d82adcab JP |
142 | PSKeyManagement pTable, |
143 | unsigned char *pbyBSSID, | |
144 | unsigned long dwKeyType, | |
145 | PSKeyItem *pKey | |
146 | ); | |
5449c685 | 147 | |
7b6a0013 | 148 | bool KeybCheckPairewiseKey( |
d82adcab JP |
149 | PSKeyManagement pTable, |
150 | PSKeyItem *pKey | |
151 | ); | |
5449c685 | 152 | |
7b6a0013 | 153 | bool KeybRemoveAllKey( |
d82adcab JP |
154 | PSKeyManagement pTable, |
155 | unsigned char *pbyBSSID, | |
156 | unsigned long dwIoBase | |
157 | ); | |
5449c685 | 158 | |
6b35b7b3 | 159 | void KeyvRemoveWEPKey( |
d82adcab JP |
160 | PSKeyManagement pTable, |
161 | unsigned long dwKeyIndex, | |
162 | unsigned long dwIoBase | |
163 | ); | |
5449c685 | 164 | |
6b35b7b3 | 165 | void KeyvRemoveAllWEPKey( |
d82adcab JP |
166 | PSKeyManagement pTable, |
167 | unsigned long dwIoBase | |
168 | ); | |
169 | ||
170 | bool KeybSetAllGroupKey( | |
171 | PSKeyManagement pTable, | |
172 | unsigned long dwKeyIndex, | |
173 | unsigned long uKeyLength, | |
174 | PQWORD pKeyRSC, | |
175 | unsigned char *pbyKey, | |
176 | unsigned char byKeyDecMode, | |
177 | unsigned long dwIoBase, | |
178 | unsigned char byLocalID | |
179 | ); | |
5449c685 | 180 | |
5449c685 | 181 | #endif // __KEY_H__ |