Commit | Line | Data |
---|---|---|
3c2a0909 S |
1 | /* |
2 | * Fundamental types and constants relating to WPA | |
3 | * | |
4c205efb | 4 | * Copyright (C) 1999-2018, Broadcom Corporation |
3c2a0909 S |
5 | * |
6 | * Unless you and Broadcom execute a separate written software license | |
7 | * agreement governing use of this software, this software is licensed to you | |
8 | * under the terms of the GNU General Public License version 2 (the "GPL"), | |
9 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the | |
10 | * following added to such license: | |
11 | * | |
12 | * As a special exception, the copyright holders of this software give you | |
13 | * permission to link this software with independent modules, and to copy and | |
14 | * distribute the resulting executable under terms of your choice, provided that | |
15 | * you also meet, for each linked independent module, the terms and conditions of | |
16 | * the license of that module. An independent module is a module which is not | |
17 | * derived from this software. The special exception does not apply to any | |
18 | * modifications of the software. | |
19 | * | |
20 | * Notwithstanding the above, under no circumstances may you combine this | |
21 | * software in any way with any other Broadcom software provided under a license | |
22 | * other than the GPL, without Broadcom's express prior written consent. | |
23 | * | |
24 | * | |
25 | * <<Broadcom-WL-IPTag/Open:>> | |
26 | * | |
4c205efb | 27 | * $Id: wpa.h 700076 2017-05-17 14:42:22Z $ |
3c2a0909 S |
28 | */ |
29 | ||
30 | #ifndef _proto_wpa_h_ | |
31 | #define _proto_wpa_h_ | |
32 | ||
33 | #include <typedefs.h> | |
34 | #include <ethernet.h> | |
35 | ||
36 | ||
37 | /* This marks the start of a packed structure section. */ | |
38 | #include <packed_section_start.h> | |
39 | ||
40 | /* Reason Codes */ | |
41 | ||
42 | /* 13 through 23 taken from IEEE Std 802.11i-2004 */ | |
43 | #define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */ | |
44 | #define DOT11_RC_MIC_FAILURE 14 /* Michael failure */ | |
45 | #define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */ | |
46 | #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */ | |
47 | #define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from | |
48 | * (re-)assoc. request/probe response | |
49 | */ | |
50 | #define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */ | |
51 | #define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */ | |
52 | #define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */ | |
53 | #define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */ | |
54 | #define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */ | |
55 | #define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */ | |
56 | ||
57 | #define WPA2_PMKID_LEN 16 | |
58 | ||
59 | /* WPA IE fixed portion */ | |
60 | typedef BWL_PRE_PACKED_STRUCT struct | |
61 | { | |
62 | uint8 tag; /* TAG */ | |
63 | uint8 length; /* TAG length */ | |
64 | uint8 oui[3]; /* IE OUI */ | |
65 | uint8 oui_type; /* OUI type */ | |
66 | BWL_PRE_PACKED_STRUCT struct { | |
67 | uint8 low; | |
68 | uint8 high; | |
69 | } BWL_POST_PACKED_STRUCT version; /* IE version */ | |
70 | } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t; | |
71 | #define WPA_IE_OUITYPE_LEN 4 | |
72 | #define WPA_IE_FIXED_LEN 8 | |
73 | #define WPA_IE_TAG_FIXED_LEN 6 | |
74 | ||
75 | #define BIP_OUI_TYPE WPA2_OUI "\x06" | |
76 | ||
77 | typedef BWL_PRE_PACKED_STRUCT struct { | |
78 | uint8 tag; /* TAG */ | |
79 | uint8 length; /* TAG length */ | |
80 | BWL_PRE_PACKED_STRUCT struct { | |
81 | uint8 low; | |
82 | uint8 high; | |
83 | } BWL_POST_PACKED_STRUCT version; /* IE version */ | |
84 | } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t; | |
85 | #define WPA_RSN_IE_FIXED_LEN 4 | |
86 | #define WPA_RSN_IE_TAG_FIXED_LEN 2 | |
87 | typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN]; | |
88 | ||
89 | #define WFA_OSEN_IE_FIXED_LEN 6 | |
90 | ||
91 | /* WPA suite/multicast suite */ | |
92 | typedef BWL_PRE_PACKED_STRUCT struct | |
93 | { | |
94 | uint8 oui[3]; | |
95 | uint8 type; | |
96 | } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t; | |
97 | #define WPA_SUITE_LEN 4 | |
98 | ||
99 | /* WPA unicast suite list/key management suite list */ | |
100 | typedef BWL_PRE_PACKED_STRUCT struct | |
101 | { | |
102 | BWL_PRE_PACKED_STRUCT struct { | |
103 | uint8 low; | |
104 | uint8 high; | |
105 | } BWL_POST_PACKED_STRUCT count; | |
106 | wpa_suite_t list[1]; | |
107 | } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t; | |
108 | #define WPA_IE_SUITE_COUNT_LEN 2 | |
109 | typedef BWL_PRE_PACKED_STRUCT struct | |
110 | { | |
111 | BWL_PRE_PACKED_STRUCT struct { | |
112 | uint8 low; | |
113 | uint8 high; | |
114 | } BWL_POST_PACKED_STRUCT count; | |
115 | wpa_pmkid_t list[1]; | |
116 | } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t; | |
117 | ||
118 | /* WPA cipher suites */ | |
119 | #define WPA_CIPHER_NONE 0 /* None */ | |
120 | #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */ | |
121 | #define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */ | |
122 | #define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */ | |
123 | #define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */ | |
124 | #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */ | |
125 | #define WPA_CIPHER_BIP 6 /* WEP (104-bit) */ | |
126 | #define WPA_CIPHER_TPK 7 /* Group addressed traffic not allowed */ | |
127 | #ifdef BCMCCX | |
128 | #define WPA_CIPHER_CKIP 8 /* KP with no MIC */ | |
129 | #define WPA_CIPHER_CKIP_MMH 9 /* KP with MIC ("CKIP/MMH", "CKIP+CMIC") */ | |
130 | #define WPA_CIPHER_WEP_MMH 10 /* MIC with no KP ("WEP/MMH", "CMIC") */ | |
131 | ||
132 | #define IS_CCX_CIPHER(cipher) ((cipher) == WPA_CIPHER_CKIP || \ | |
133 | (cipher) == WPA_CIPHER_CKIP_MMH || \ | |
134 | (cipher) == WPA_CIPHER_WEP_MMH) | |
135 | #endif /* BCMCCX */ | |
136 | ||
137 | #define WPA_CIPHER_AES_GCM 8 /* AES (GCM) */ | |
138 | #define WPA_CIPHER_AES_GCM256 9 /* AES (GCM256) */ | |
139 | ||
140 | #ifdef BCMWAPI_WAI | |
141 | #define WAPI_CIPHER_NONE WPA_CIPHER_NONE | |
142 | #define WAPI_CIPHER_SMS4 11 | |
143 | ||
144 | #define WAPI_CSE_WPI_SMS4 1 | |
145 | #endif /* BCMWAPI_WAI */ | |
146 | ||
147 | #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \ | |
148 | (cipher) == WPA_CIPHER_WEP_40 || \ | |
149 | (cipher) == WPA_CIPHER_WEP_104 || \ | |
150 | (cipher) == WPA_CIPHER_TKIP || \ | |
151 | (cipher) == WPA_CIPHER_AES_OCB || \ | |
152 | (cipher) == WPA_CIPHER_AES_CCM || \ | |
153 | (cipher) == WPA_CIPHER_AES_GCM || \ | |
154 | (cipher) == WPA_CIPHER_AES_GCM256 || \ | |
155 | (cipher) == WPA_CIPHER_TPK) | |
156 | ||
157 | #ifdef BCMWAPI_WAI | |
158 | #define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \ | |
159 | (cipher) == WAPI_CSE_WPI_SMS4) | |
160 | ||
161 | /* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */ | |
162 | #define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \ | |
163 | WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE) | |
164 | ||
165 | #define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \ | |
166 | WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE) | |
167 | #endif /* BCMWAPI_WAI */ | |
168 | ||
169 | /* WPA TKIP countermeasures parameters */ | |
170 | #define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */ | |
171 | #define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */ | |
172 | ||
173 | /* RSN IE defines */ | |
174 | #define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */ | |
175 | ||
176 | /* RSN Capabilities defined in 802.11i */ | |
177 | #define RSN_CAP_PREAUTH 0x0001 | |
178 | #define RSN_CAP_NOPAIRWISE 0x0002 | |
179 | #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C | |
180 | #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2 | |
181 | #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030 | |
182 | #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4 | |
183 | #define RSN_CAP_1_REPLAY_CNTR 0 | |
184 | #define RSN_CAP_2_REPLAY_CNTRS 1 | |
185 | #define RSN_CAP_4_REPLAY_CNTRS 2 | |
186 | #define RSN_CAP_16_REPLAY_CNTRS 3 | |
187 | #define RSN_CAP_MFPR 0x0040 | |
188 | #define RSN_CAP_MFPC 0x0080 | |
189 | #define RSN_CAP_SPPC 0x0400 | |
190 | #define RSN_CAP_SPPR 0x0800 | |
191 | ||
192 | /* WPA capabilities defined in 802.11i */ | |
193 | #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS | |
194 | #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS | |
195 | #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT | |
196 | #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK | |
197 | ||
198 | /* WPA capabilities defined in 802.11zD9.0 */ | |
199 | #define WPA_CAP_PEER_KEY_ENABLE (0x1 << 1) /* bit 9 */ | |
200 | ||
201 | /* WPA Specific defines */ | |
202 | #define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */ | |
203 | #define WPA_PMKID_CNT_LEN 2 /* Length of RSN PMKID count (2 octests) */ | |
204 | ||
205 | #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH | |
206 | ||
207 | #define WPA2_PMKID_COUNT_LEN 2 | |
208 | ||
209 | #ifdef BCMWAPI_WAI | |
210 | #define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH | |
211 | ||
212 | /* Other WAI definition */ | |
213 | #define WAPI_WAI_REQUEST 0x00F1 | |
214 | #define WAPI_UNICAST_REKEY 0x00F2 | |
215 | #define WAPI_STA_AGING 0x00F3 | |
216 | #define WAPI_MUTIL_REKEY 0x00F4 | |
217 | #define WAPI_STA_STATS 0x00F5 | |
218 | ||
219 | #define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */ | |
220 | #define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */ | |
221 | #endif /* BCMWAPI_WAI */ | |
222 | ||
223 | /* This marks the end of a packed structure section. */ | |
224 | #include <packed_section_end.h> | |
225 | ||
226 | #endif /* _proto_wpa_h_ */ |