5c63e593e6cb266bdf3548c775284687089e04f1
[pandora-kernel.git] / drivers / staging / brcm80211 / include / proto / wpa.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _proto_wpa_h_
18 #define _proto_wpa_h_
19
20 #include <typedefs.h>
21 #include <proto/ethernet.h>
22
23 #include <packed_section_start.h>
24
25 #define DOT11_RC_INVALID_WPA_IE         13
26 #define DOT11_RC_MIC_FAILURE            14
27 #define DOT11_RC_4WH_TIMEOUT            15
28 #define DOT11_RC_GTK_UPDATE_TIMEOUT     16
29 #define DOT11_RC_WPA_IE_MISMATCH        17
30 #define DOT11_RC_INVALID_MC_CIPHER      18
31 #define DOT11_RC_INVALID_UC_CIPHER      19
32 #define DOT11_RC_INVALID_AKMP           20
33 #define DOT11_RC_BAD_WPA_VERSION        21
34 #define DOT11_RC_INVALID_WPA_CAP        22
35 #define DOT11_RC_8021X_AUTH_FAIL        23
36
37 #define WPA2_PMKID_LEN  16
38
39 typedef BWL_PRE_PACKED_STRUCT struct {
40         u8 tag;
41         u8 length;
42         u8 oui[3];
43         u8 oui_type;
44         BWL_PRE_PACKED_STRUCT struct {
45                 u8 low;
46                 u8 high;
47         } BWL_POST_PACKED_STRUCT version;
48 } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
49 #define WPA_IE_OUITYPE_LEN      4
50 #define WPA_IE_FIXED_LEN        8
51 #define WPA_IE_TAG_FIXED_LEN    6
52
53 typedef BWL_PRE_PACKED_STRUCT struct {
54         u8 tag;
55         u8 length;
56         BWL_PRE_PACKED_STRUCT struct {
57                 u8 low;
58                 u8 high;
59         } BWL_POST_PACKED_STRUCT version;
60 } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
61 #define WPA_RSN_IE_FIXED_LEN    4
62 #define WPA_RSN_IE_TAG_FIXED_LEN        2
63 typedef u8 wpa_pmkid_t[WPA2_PMKID_LEN];
64
65 typedef BWL_PRE_PACKED_STRUCT struct {
66         u8 oui[3];
67         u8 type;
68 } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
69 #define WPA_SUITE_LEN   4
70
71 typedef BWL_PRE_PACKED_STRUCT struct {
72         BWL_PRE_PACKED_STRUCT struct {
73                 u8 low;
74                 u8 high;
75         } BWL_POST_PACKED_STRUCT count;
76         wpa_suite_t list[1];
77 } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
78 #define WPA_IE_SUITE_COUNT_LEN  2
79 typedef BWL_PRE_PACKED_STRUCT struct {
80         BWL_PRE_PACKED_STRUCT struct {
81                 u8 low;
82                 u8 high;
83         } BWL_POST_PACKED_STRUCT count;
84         wpa_pmkid_t list[1];
85 } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
86
87 #define WPA_CIPHER_NONE         0
88 #define WPA_CIPHER_WEP_40       1
89 #define WPA_CIPHER_TKIP         2
90 #define WPA_CIPHER_AES_OCB      3
91 #define WPA_CIPHER_AES_CCM      4
92 #define WPA_CIPHER_WEP_104      5
93
94 #define IS_WPA_CIPHER(cipher)   ((cipher) == WPA_CIPHER_NONE || \
95                                  (cipher) == WPA_CIPHER_WEP_40 || \
96                                  (cipher) == WPA_CIPHER_WEP_104 || \
97                                  (cipher) == WPA_CIPHER_TKIP || \
98                                  (cipher) == WPA_CIPHER_AES_OCB || \
99                                  (cipher) == WPA_CIPHER_AES_CCM)
100
101 #define WPA_TKIP_CM_DETECT      60
102 #define WPA_TKIP_CM_BLOCK       60
103
104 #define RSN_CAP_LEN             2
105
106 #define RSN_CAP_PREAUTH                 0x0001
107 #define RSN_CAP_NOPAIRWISE              0x0002
108 #define RSN_CAP_PTK_REPLAY_CNTR_MASK    0x000C
109 #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT   2
110 #define RSN_CAP_GTK_REPLAY_CNTR_MASK    0x0030
111 #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT   4
112 #define RSN_CAP_1_REPLAY_CNTR           0
113 #define RSN_CAP_2_REPLAY_CNTRS          1
114 #define RSN_CAP_4_REPLAY_CNTRS          2
115 #define RSN_CAP_16_REPLAY_CNTRS         3
116
117 #define WPA_CAP_4_REPLAY_CNTRS          RSN_CAP_4_REPLAY_CNTRS
118 #define WPA_CAP_16_REPLAY_CNTRS         RSN_CAP_16_REPLAY_CNTRS
119 #define WPA_CAP_REPLAY_CNTR_SHIFT       RSN_CAP_PTK_REPLAY_CNTR_SHIFT
120 #define WPA_CAP_REPLAY_CNTR_MASK        RSN_CAP_PTK_REPLAY_CNTR_MASK
121
122 #define WPA_CAP_LEN     RSN_CAP_LEN
123
124 #define WPA_CAP_WPA2_PREAUTH            RSN_CAP_PREAUTH
125
126 #include <packed_section_end.h>
127
128 #endif                          /* _proto_wpa_h_ */