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