Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[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 <proto/ethernet.h>
21
22 #include <packed_section_start.h>
23
24 #define DOT11_RC_INVALID_WPA_IE         13
25 #define DOT11_RC_MIC_FAILURE            14
26 #define DOT11_RC_4WH_TIMEOUT            15
27 #define DOT11_RC_GTK_UPDATE_TIMEOUT     16
28 #define DOT11_RC_WPA_IE_MISMATCH        17
29 #define DOT11_RC_INVALID_MC_CIPHER      18
30 #define DOT11_RC_INVALID_UC_CIPHER      19
31 #define DOT11_RC_INVALID_AKMP           20
32 #define DOT11_RC_BAD_WPA_VERSION        21
33 #define DOT11_RC_INVALID_WPA_CAP        22
34 #define DOT11_RC_8021X_AUTH_FAIL        23
35
36 #define WPA2_PMKID_LEN  16
37
38 typedef BWL_PRE_PACKED_STRUCT struct {
39         u8 tag;
40         u8 length;
41         u8 oui[3];
42         u8 oui_type;
43         BWL_PRE_PACKED_STRUCT struct {
44                 u8 low;
45                 u8 high;
46         } BWL_POST_PACKED_STRUCT version;
47 } BWL_POST_PACKED_STRUCT wpa_ie_fixed_t;
48 #define WPA_IE_OUITYPE_LEN      4
49 #define WPA_IE_FIXED_LEN        8
50 #define WPA_IE_TAG_FIXED_LEN    6
51
52 typedef BWL_PRE_PACKED_STRUCT struct {
53         u8 tag;
54         u8 length;
55         BWL_PRE_PACKED_STRUCT struct {
56                 u8 low;
57                 u8 high;
58         } BWL_POST_PACKED_STRUCT version;
59 } BWL_POST_PACKED_STRUCT wpa_rsn_ie_fixed_t;
60 #define WPA_RSN_IE_FIXED_LEN    4
61 #define WPA_RSN_IE_TAG_FIXED_LEN        2
62 typedef u8 wpa_pmkid_t[WPA2_PMKID_LEN];
63
64 typedef BWL_PRE_PACKED_STRUCT struct {
65         u8 oui[3];
66         u8 type;
67 } BWL_POST_PACKED_STRUCT wpa_suite_t, wpa_suite_mcast_t;
68 #define WPA_SUITE_LEN   4
69
70 typedef BWL_PRE_PACKED_STRUCT struct {
71         BWL_PRE_PACKED_STRUCT struct {
72                 u8 low;
73                 u8 high;
74         } BWL_POST_PACKED_STRUCT count;
75         wpa_suite_t list[1];
76 } BWL_POST_PACKED_STRUCT wpa_suite_ucast_t, wpa_suite_auth_key_mgmt_t;
77 #define WPA_IE_SUITE_COUNT_LEN  2
78 typedef BWL_PRE_PACKED_STRUCT struct {
79         BWL_PRE_PACKED_STRUCT struct {
80                 u8 low;
81                 u8 high;
82         } BWL_POST_PACKED_STRUCT count;
83         wpa_pmkid_t list[1];
84 } BWL_POST_PACKED_STRUCT wpa_pmkid_list_t;
85
86 #define WPA_CIPHER_NONE         0
87 #define WPA_CIPHER_WEP_40       1
88 #define WPA_CIPHER_TKIP         2
89 #define WPA_CIPHER_AES_OCB      3
90 #define WPA_CIPHER_AES_CCM      4
91 #define WPA_CIPHER_WEP_104      5
92
93 #define IS_WPA_CIPHER(cipher)   ((cipher) == WPA_CIPHER_NONE || \
94                                  (cipher) == WPA_CIPHER_WEP_40 || \
95                                  (cipher) == WPA_CIPHER_WEP_104 || \
96                                  (cipher) == WPA_CIPHER_TKIP || \
97                                  (cipher) == WPA_CIPHER_AES_OCB || \
98                                  (cipher) == WPA_CIPHER_AES_CCM)
99
100 #define WPA_TKIP_CM_DETECT      60
101 #define WPA_TKIP_CM_BLOCK       60
102
103 #define RSN_CAP_LEN             2
104
105 #define RSN_CAP_PREAUTH                 0x0001
106 #define RSN_CAP_NOPAIRWISE              0x0002
107 #define RSN_CAP_PTK_REPLAY_CNTR_MASK    0x000C
108 #define RSN_CAP_PTK_REPLAY_CNTR_SHIFT   2
109 #define RSN_CAP_GTK_REPLAY_CNTR_MASK    0x0030
110 #define RSN_CAP_GTK_REPLAY_CNTR_SHIFT   4
111 #define RSN_CAP_1_REPLAY_CNTR           0
112 #define RSN_CAP_2_REPLAY_CNTRS          1
113 #define RSN_CAP_4_REPLAY_CNTRS          2
114 #define RSN_CAP_16_REPLAY_CNTRS         3
115
116 #define WPA_CAP_4_REPLAY_CNTRS          RSN_CAP_4_REPLAY_CNTRS
117 #define WPA_CAP_16_REPLAY_CNTRS         RSN_CAP_16_REPLAY_CNTRS
118 #define WPA_CAP_REPLAY_CNTR_SHIFT       RSN_CAP_PTK_REPLAY_CNTR_SHIFT
119 #define WPA_CAP_REPLAY_CNTR_MASK        RSN_CAP_PTK_REPLAY_CNTR_MASK
120
121 #define WPA_CAP_LEN     RSN_CAP_LEN
122
123 #define WPA_CAP_WPA2_PREAUTH            RSN_CAP_PREAUTH
124
125 #include <packed_section_end.h>
126
127 #endif                          /* _proto_wpa_h_ */