[ar7] let 802.1q tagged frames go in and out from cpmac (#6730)
[openwrt.git] / package / broadcom-wl / src / driver / proto / wpa.h
1 /*
2 * Fundamental types and constants relating to WPA
3 *
4 * Copyright 2007, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
8 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
9 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
10 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
11 *
12 */
13
14 #ifndef _proto_wpa_h_
15 #define _proto_wpa_h_
16
17 #include <typedefs.h>
18 #include <proto/ethernet.h>
19
20 /* enable structure packing */
21 #if defined(__GNUC__)
22 #define PACKED __attribute__((packed))
23 #else
24 #pragma pack(1)
25 #define PACKED
26 #endif
27
28 /* Reason Codes */
29
30 /* 13 through 23 taken from IEEE Std 802.11i-2004 */
31 #define DOT11_RC_INVALID_WPA_IE 13 /* Invalid info. element */
32 #define DOT11_RC_MIC_FAILURE 14 /* Michael failure */
33 #define DOT11_RC_4WH_TIMEOUT 15 /* 4-way handshake timeout */
34 #define DOT11_RC_GTK_UPDATE_TIMEOUT 16 /* Group key update timeout */
35 #define DOT11_RC_WPA_IE_MISMATCH 17 /* WPA IE in 4-way handshake differs from
36 * (re-)assoc. request/probe response
37 */
38 #define DOT11_RC_INVALID_MC_CIPHER 18 /* Invalid multicast cipher */
39 #define DOT11_RC_INVALID_UC_CIPHER 19 /* Invalid unicast cipher */
40 #define DOT11_RC_INVALID_AKMP 20 /* Invalid authenticated key management protocol */
41 #define DOT11_RC_BAD_WPA_VERSION 21 /* Unsupported WPA version */
42 #define DOT11_RC_INVALID_WPA_CAP 22 /* Invalid WPA IE capabilities */
43 #define DOT11_RC_8021X_AUTH_FAIL 23 /* 802.1X authentication failure */
44
45 #define WPA2_PMKID_LEN 16
46
47 /* WPA IE fixed portion */
48 typedef struct
49 {
50 uint8 tag; /* TAG */
51 uint8 length; /* TAG length */
52 uint8 oui[3]; /* IE OUI */
53 uint8 oui_type; /* OUI type */
54 struct {
55 uint8 low;
56 uint8 high;
57 } PACKED version; /* IE version */
58 } PACKED wpa_ie_fixed_t;
59 #define WPA_IE_OUITYPE_LEN 4
60 #define WPA_IE_FIXED_LEN 8
61 #define WPA_IE_TAG_FIXED_LEN 6
62
63 #ifdef BCMWPA2
64 typedef struct {
65 uint8 tag; /* TAG */
66 uint8 length; /* TAG length */
67 struct {
68 uint8 low;
69 uint8 high;
70 } PACKED version; /* IE version */
71 } PACKED wpa_rsn_ie_fixed_t;
72 #define WPA_RSN_IE_FIXED_LEN 4
73 #define WPA_RSN_IE_TAG_FIXED_LEN 2
74 typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
75 #endif
76
77 /* WPA suite/multicast suite */
78 typedef struct
79 {
80 uint8 oui[3];
81 uint8 type;
82 } PACKED wpa_suite_t, wpa_suite_mcast_t;
83 #define WPA_SUITE_LEN 4
84
85 /* WPA unicast suite list/key management suite list */
86 typedef struct
87 {
88 struct {
89 uint8 low;
90 uint8 high;
91 } PACKED count;
92 wpa_suite_t list[1];
93 } PACKED wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
94 #define WPA_IE_SUITE_COUNT_LEN 2
95 #ifdef BCMWPA2
96 typedef struct
97 {
98 struct {
99 uint8 low;
100 uint8 high;
101 } PACKED count;
102 wpa_pmkid_t list[1];
103 } PACKED wpa_pmkid_list_t;
104 #endif
105
106 /* WPA cipher suites */
107 #define WPA_CIPHER_NONE 0 /* None */
108 #define WPA_CIPHER_WEP_40 1 /* WEP (40-bit) */
109 #define WPA_CIPHER_TKIP 2 /* TKIP: default for WPA */
110 #define WPA_CIPHER_AES_OCB 3 /* AES (OCB) */
111 #define WPA_CIPHER_AES_CCM 4 /* AES (CCM) */
112 #define WPA_CIPHER_WEP_104 5 /* WEP (104-bit) */
113
114 #define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
115 (cipher) == WPA_CIPHER_WEP_40 || \
116 (cipher) == WPA_CIPHER_WEP_104 || \
117 (cipher) == WPA_CIPHER_TKIP || \
118 (cipher) == WPA_CIPHER_AES_OCB || \
119 (cipher) == WPA_CIPHER_AES_CCM)
120
121 /* WPA TKIP countermeasures parameters */
122 #define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
123 #define WPA_TKIP_CM_BLOCK 60 /* countermeasures active window (seconds) */
124
125 /* RSN IE defines */
126 #define RSN_CAP_LEN 2 /* Length of RSN capabilities field (2 octets) */
127
128 /* RSN Capabilities defined in 802.11i */
129 #define RSN_CAP_PREAUTH 0x0001
130 #define RSN_CAP_NOPAIRWISE 0x0002
131 #define RSN_CAP_PTK_REPLAY_CNTR_MASK 0x000C
132 #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT 2
133 #define RSN_CAP_GTK_REPLAY_CNTR_MASK 0x0030
134 #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT 4
135 #define RSN_CAP_1_REPLAY_CNTR 0
136 #define RSN_CAP_2_REPLAY_CNTRS 1
137 #define RSN_CAP_4_REPLAY_CNTRS 2
138 #define RSN_CAP_16_REPLAY_CNTRS 3
139
140 /* WPA capabilities defined in 802.11i */
141 #define WPA_CAP_4_REPLAY_CNTRS RSN_CAP_4_REPLAY_CNTRS
142 #define WPA_CAP_16_REPLAY_CNTRS RSN_CAP_16_REPLAY_CNTRS
143 #define WPA_CAP_REPLAY_CNTR_SHIFT RSN_CAP_PTK_REPLAY_CNTR_SHIFT
144 #define WPA_CAP_REPLAY_CNTR_MASK RSN_CAP_PTK_REPLAY_CNTR_MASK
145
146 /* WPA Specific defines */
147 #define WPA_CAP_LEN RSN_CAP_LEN /* Length of RSN capabilities in RSN IE (2 octets) */
148
149 #define WPA_CAP_WPA2_PREAUTH RSN_CAP_PREAUTH
150
151
152 #undef PACKED
153 #if !defined(__GNUC__)
154 #pragma pack()
155 #endif
156
157 #endif /* _proto_wpa_h_ */
This page took 0.059082 seconds and 5 git commands to generate.