get rid of $Id$ - it has never helped us and it has broken too many patches ;)
[openwrt.git] / package / broadcom-wl / src / include / proto / wpa.h
1 /*
2  * Fundamental types and constants relating to WPA
3  *
4  * Copyright 2006, 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 /* 10 and 11 are from TGh. */
31 #define DOT11_RC_BAD_PC                 10      /* Unacceptable power capability element */
32 #define DOT11_RC_BAD_CHANNELS           11      /* Unacceptable supported channels element */
33 /* 12 is unused */
34 /* 13 through 23 taken from P802.11i/D3.0, November 2002 */
35 #define DOT11_RC_INVALID_WPA_IE         13      /* Invalid info. element */
36 #define DOT11_RC_MIC_FAILURE            14      /* Michael failure */
37 #define DOT11_RC_4WH_TIMEOUT            15      /* 4-way handshake timeout */
38 #define DOT11_RC_GTK_UPDATE_TIMEOUT     16      /* Group key update timeout */
39 #define DOT11_RC_WPA_IE_MISMATCH        17      /* WPA IE in 4-way handshake differs from
40                                                  * (re-)assoc. request/probe response
41                                                  */
42 #define DOT11_RC_INVALID_MC_CIPHER      18      /* Invalid multicast cipher */
43 #define DOT11_RC_INVALID_UC_CIPHER      19      /* Invalid unicast cipher */
44 #define DOT11_RC_INVALID_AKMP           20      /* Invalid authenticated key management protocol */
45 #define DOT11_RC_BAD_WPA_VERSION        21      /* Unsupported WPA version */
46 #define DOT11_RC_INVALID_WPA_CAP        22      /* Invalid WPA IE capabilities */
47 #define DOT11_RC_8021X_AUTH_FAIL        23      /* 802.1X authentication failure */
48
49 #define WPA2_PMKID_LEN  16
50
51 /* WPA IE fixed portion */
52 typedef struct
53 {
54         uint8 tag;      /* TAG */
55         uint8 length;   /* TAG length */
56         uint8 oui[3];   /* IE OUI */
57         uint8 oui_type; /* OUI type */
58         struct {
59                 uint8 low;
60                 uint8 high;
61         } PACKED version;       /* IE version */
62 } PACKED wpa_ie_fixed_t;
63 #define WPA_IE_OUITYPE_LEN      4
64 #define WPA_IE_FIXED_LEN        8
65 #define WPA_IE_TAG_FIXED_LEN    6
66
67 #ifdef BCMWPA2
68 typedef struct {
69         uint8 tag;      /* TAG */
70         uint8 length;   /* TAG length */
71         struct {
72                 uint8 low;
73                 uint8 high;
74         } PACKED version;       /* IE version */
75 } PACKED wpa_rsn_ie_fixed_t;
76 #define WPA_RSN_IE_FIXED_LEN    4
77 #define WPA_RSN_IE_TAG_FIXED_LEN        2
78 typedef uint8 wpa_pmkid_t[WPA2_PMKID_LEN];
79 #endif
80
81 /* WPA suite/multicast suite */
82 typedef struct
83 {
84         uint8 oui[3];
85         uint8 type;
86 } PACKED wpa_suite_t, wpa_suite_mcast_t;
87 #define WPA_SUITE_LEN   4
88
89 /* WPA unicast suite list/key management suite list */
90 typedef struct
91 {
92         struct {
93                 uint8 low;
94                 uint8 high;
95         } PACKED count;
96         wpa_suite_t list[1];
97 } PACKED wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
98 #define WPA_IE_SUITE_COUNT_LEN  2
99 #ifdef BCMWPA2
100 typedef struct
101 {
102         struct {
103                 uint8 low;
104                 uint8 high;
105         } PACKED count;
106         wpa_pmkid_t list[1];
107 } PACKED wpa_pmkid_list_t;
108 #endif
109
110 /* WPA cipher suites */
111 #define WPA_CIPHER_NONE         0       /* None */
112 #define WPA_CIPHER_WEP_40       1       /* WEP (40-bit) */
113 #define WPA_CIPHER_TKIP         2       /* TKIP: default for WPA */
114 #define WPA_CIPHER_AES_OCB      3       /* AES (OCB) */
115 #define WPA_CIPHER_AES_CCM      4       /* AES (CCM) */
116 #define WPA_CIPHER_WEP_104      5       /* WEP (104-bit) */
117
118 #define IS_WPA_CIPHER(cipher)   ((cipher) == WPA_CIPHER_NONE || \
119                                  (cipher) == WPA_CIPHER_WEP_40 || \
120                                  (cipher) == WPA_CIPHER_WEP_104 || \
121                                  (cipher) == WPA_CIPHER_TKIP || \
122                                  (cipher) == WPA_CIPHER_AES_OCB || \
123                                  (cipher) == WPA_CIPHER_AES_CCM)
124
125 /* WPA TKIP countermeasures parameters */
126 #define WPA_TKIP_CM_DETECT      60      /* multiple MIC failure window (seconds) */
127 #define WPA_TKIP_CM_BLOCK       60      /* countermeasures active window (seconds) */
128
129 /* WPA capabilities defined in 802.11i */
130 #define WPA_CAP_4_REPLAY_CNTRS          2
131 #define WPA_CAP_16_REPLAY_CNTRS         3
132 #define WPA_CAP_REPLAY_CNTR_SHIFT       2
133 #define WPA_CAP_REPLAY_CNTR_MASK        0x000c
134
135 /* WPA Specific defines */
136 #define WPA_CAP_LEN     2       /* Length of RSN capabilities in RSN IE (2 octets) */
137
138 #ifdef BCMWPA2
139 #define WPA_CAP_WPA2_PREAUTH            1
140 #endif /* BCMWPA2 */
141
142 #undef PACKED
143 #if !defined(__GNUC__)
144 #pragma pack()
145 #endif
146
147 #endif /* _proto_wpa_h_ */