xref: /illumos-gate/usr/src/uts/common/net/wpa.h (revision a399b765)
1*a399b765Szf /*
2*a399b765Szf  * CDDL HEADER START
3*a399b765Szf  *
4*a399b765Szf  * The contents of this file are subject to the terms of the
5*a399b765Szf  * Common Development and Distribution License (the "License").
6*a399b765Szf  * You may not use this file except in compliance with the License.
7*a399b765Szf  *
8*a399b765Szf  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*a399b765Szf  * or http://www.opensolaris.org/os/licensing.
10*a399b765Szf  * See the License for the specific language governing permissions
11*a399b765Szf  * and limitations under the License.
12*a399b765Szf  *
13*a399b765Szf  * When distributing Covered Code, include this CDDL HEADER in each
14*a399b765Szf  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*a399b765Szf  * If applicable, add the following below this CDDL HEADER, with the
16*a399b765Szf  * fields enclosed by brackets "[]" replaced with your own identifying
17*a399b765Szf  * information: Portions Copyright [yyyy] [name of copyright owner]
18*a399b765Szf  *
19*a399b765Szf  * CDDL HEADER END
20*a399b765Szf  */
21*a399b765Szf /*
22*a399b765Szf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*a399b765Szf  * Use is subject to license terms.
24*a399b765Szf  */
25*a399b765Szf 
26*a399b765Szf /*
27*a399b765Szf  * Macro and data structures defined for 802.11i.
28*a399b765Szf  */
29*a399b765Szf 
30*a399b765Szf #ifndef	__WPA_H
31*a399b765Szf #define	__WPA_H
32*a399b765Szf 
33*a399b765Szf #pragma ident	"%Z%%M%	%I%	%E% SMI"
34*a399b765Szf 
35*a399b765Szf #include <sys/types.h>
36*a399b765Szf #include <inet/wifi_ioctl.h>
37*a399b765Szf 
38*a399b765Szf #ifdef	__cplusplus
39*a399b765Szf extern "C" {
40*a399b765Szf #endif
41*a399b765Szf 
42*a399b765Szf #define	SERVICE_NAME			"network/wpa"
43*a399b765Szf #define	WPA_DOOR 			"/var/run/wpa_door"
44*a399b765Szf #define	SVC_METHOD			"/usr/lib/inet/wpad"
45*a399b765Szf 
46*a399b765Szf #define	IEEE80211_ADDR_LEN		6
47*a399b765Szf #define	IEEE80211_MAX_WPA_IE		40	/* IEEE802.11i */
48*a399b765Szf #define	WPA_STRSIZE			256
49*a399b765Szf /*
50*a399b765Szf  * Max size of optional information elements.  We artificially
51*a399b765Szf  * constrain this; it's limited only by the max frame size (and
52*a399b765Szf  * the max parameter size of the wireless extensions).
53*a399b765Szf  */
54*a399b765Szf #define	IEEE80211_MAX_OPT_IE		256
55*a399b765Szf 
56*a399b765Szf /*
57*a399b765Szf  * Parameters.
58*a399b765Szf  * WL_WPA_BASE + 0x1, 5, 6 reserved to be compatible with FreeBSD.
59*a399b765Szf  */
60*a399b765Szf #define	WL_WPA_BASE			(WL_PARAMETERS_BASE + 0x500)
61*a399b765Szf #define	WL_SETOPTIE			(WL_WPA_BASE + 0x0)
62*a399b765Szf #define	WL_WPA				(WL_WPA_BASE + 0x2)
63*a399b765Szf #define	WL_KEY				(WL_WPA_BASE + 0x3)
64*a399b765Szf #define	WL_DELKEY			(WL_WPA_BASE + 0x4)
65*a399b765Szf #define	WL_SCANRESULTS			(WL_WPA_BASE + 0x7)
66*a399b765Szf #define	WL_MLME				(WL_WPA_BASE + 0x8)
67*a399b765Szf #define	WL_CAPABILITY			(WL_WPA_BASE + 0x9)
68*a399b765Szf 
69*a399b765Szf typedef struct wl_wpa_ie {
70*a399b765Szf     uint32_t	wpa_ie_len;
71*a399b765Szf     char 	wpa_ie[1];	/* it's the head of wpa_ie */
72*a399b765Szf } wl_wpa_ie_t;
73*a399b765Szf 
74*a399b765Szf typedef struct wl_wpa {
75*a399b765Szf     uint32_t	wpa_flag;
76*a399b765Szf } wl_wpa_t;
77*a399b765Szf 
78*a399b765Szf typedef struct wl_capability {
79*a399b765Szf     uint32_t	caps;
80*a399b765Szf } wl_capability_t;
81*a399b765Szf 
82*a399b765Szf #define	IEEE80211_KEYBUF_SIZE		16	/* 128-bit TKIP & CCMP key */
83*a399b765Szf #define	IEEE80211_MICBUF_SIZE		(8+8)	/* 8 byte tx, 8 byte rx */
84*a399b765Szf 
85*a399b765Szf /*
86*a399b765Szf  * NB: these values are ordered carefully; there are lots of
87*a399b765Szf  * of implications in any reordering.  In particular beware
88*a399b765Szf  * that 4 is not used to avoid conflicting with IEEE80211_F_PRIVACY.
89*a399b765Szf  */
90*a399b765Szf #define	IEEE80211_CIPHER_WEP		0
91*a399b765Szf #define	IEEE80211_CIPHER_TKIP		1
92*a399b765Szf #define	IEEE80211_CIPHER_AES_OCB	2
93*a399b765Szf #define	IEEE80211_CIPHER_AES_CCM	3
94*a399b765Szf #define	IEEE80211_CIPHER_CKIP		4
95*a399b765Szf #define	IEEE80211_CIPHER_NONE		5	/* pseudo value */
96*a399b765Szf 
97*a399b765Szf #define	IEEE80211_CIPHER_MAX		(IEEE80211_CIPHER_NONE+1)
98*a399b765Szf 
99*a399b765Szf /* Key Flags */
100*a399b765Szf #define	IEEE80211_KEY_XMIT		0x01	/* key used for xmit */
101*a399b765Szf #define	IEEE80211_KEY_RECV		0x02	/* key used for recv */
102*a399b765Szf 
103*a399b765Szf #define	IEEE80211_KEY_DEFAULT		0x80	/* default xmit key */
104*a399b765Szf 
105*a399b765Szf /*
106*a399b765Szf  * WPA/RSN get/set key request.  Specify the key/cipher
107*a399b765Szf  * type and whether the key is to be used for sending and/or
108*a399b765Szf  * receiving.  The key index should be set only when working
109*a399b765Szf  * with global keys (use IEEE80211_KEYIX_NONE for ``no index'').
110*a399b765Szf  * Otherwise a unicast/pairwise key is specified by the bssid
111*a399b765Szf  * (on a station) or mac address (on an ap).  They key length
112*a399b765Szf  * must include any MIC key data; otherwise it should be no
113*a399b765Szf  * more than IEEE80211_KEYBUF_SIZE.
114*a399b765Szf  */
115*a399b765Szf #pragma pack(1)
116*a399b765Szf typedef struct wl_key {
117*a399b765Szf 	uint8_t		ik_type;	/* key/cipher type */
118*a399b765Szf 	uint8_t		ik_pad;
119*a399b765Szf 
120*a399b765Szf 	uint16_t	ik_keyix;	/* key index */
121*a399b765Szf 	uint8_t		ik_keylen;	/* key length in bytes */
122*a399b765Szf 	uint8_t		ik_flags;
123*a399b765Szf 
124*a399b765Szf 	uint8_t		ik_macaddr[IEEE80211_ADDR_LEN];
125*a399b765Szf 	uint64_t	ik_keyrsc;	/* key receive sequence counter */
126*a399b765Szf 	uint64_t	ik_keytsc;	/* key transmit sequence counter */
127*a399b765Szf 
128*a399b765Szf 	uint8_t ik_keydata[IEEE80211_KEYBUF_SIZE+IEEE80211_MICBUF_SIZE];
129*a399b765Szf } wl_key_t;
130*a399b765Szf #pragma pack()
131*a399b765Szf 
132*a399b765Szf struct wpa_ess {
133*a399b765Szf 	uint8_t		bssid[IEEE80211_ADDR_LEN];
134*a399b765Szf 	uint8_t		ssid[MAX_ESSID_LENGTH];
135*a399b765Szf 	uint32_t	ssid_len;
136*a399b765Szf 
137*a399b765Szf 	uint8_t		wpa_ie[IEEE80211_MAX_WPA_IE];
138*a399b765Szf 	uint32_t	wpa_ie_len;
139*a399b765Szf 	int		freq;
140*a399b765Szf };
141*a399b765Szf 
142*a399b765Szf typedef struct wl_del_key {
143*a399b765Szf 	uint8_t		idk_keyix;	/* key index */
144*a399b765Szf 	uint8_t		idk_macaddr[IEEE80211_ADDR_LEN];
145*a399b765Szf }wl_del_key_t;
146*a399b765Szf 
147*a399b765Szf typedef struct wl_countermeasures {
148*a399b765Szf 	uint32_t	cm_flag;
149*a399b765Szf } wl_countermeasures_t;
150*a399b765Szf 
151*a399b765Szf typedef struct wl_drop_unenc {
152*a399b765Szf 	uint32_t	drop_flag;
153*a399b765Szf } wl_drop_unenc_t;
154*a399b765Szf 
155*a399b765Szf typedef struct wl_wpa_ess {
156*a399b765Szf 	uint32_t	count;
157*a399b765Szf 	struct wpa_ess	ess[1];
158*a399b765Szf } wl_wpa_ess_t;
159*a399b765Szf 
160*a399b765Szf #define	IEEE80211_MLME_ASSOC		1	/* associate station */
161*a399b765Szf #define	IEEE80211_MLME_DISASSOC		2	/* disassociate station */
162*a399b765Szf #define	IEEE80211_MLME_DEAUTH		3	/* deauthenticate station */
163*a399b765Szf #define	IEEE80211_MLME_AUTHORIZE	4	/* authorize station */
164*a399b765Szf #define	IEEE80211_MLME_UNAUTHORIZE	5	/* unauthorize station */
165*a399b765Szf 
166*a399b765Szf /*
167*a399b765Szf  *  * MLME state manipulation request.  IEEE80211_MLME_ASSOC
168*a399b765Szf  *   * only makes sense when operating as a station.  The other
169*a399b765Szf  *    * requests can be used when operating as a station or an
170*a399b765Szf  *     * ap (to effect a station).
171*a399b765Szf  */
172*a399b765Szf typedef struct wl_mlme {
173*a399b765Szf 	uint8_t		im_op;		/* operation to perform */
174*a399b765Szf 	uint16_t	im_reason;	/* 802.11 reason code */
175*a399b765Szf 	uint8_t		im_macaddr[IEEE80211_ADDR_LEN];
176*a399b765Szf } wl_mlme_t;
177*a399b765Szf 
178*a399b765Szf /*
179*a399b765Szf  * State machine events
180*a399b765Szf  */
181*a399b765Szf typedef enum {
182*a399b765Szf 	EVENT_ASSOC,
183*a399b765Szf 	EVENT_DISASSOC,
184*a399b765Szf 	EVENT_SCAN_RESULTS
185*a399b765Szf } wpa_event_type;
186*a399b765Szf 
187*a399b765Szf typedef struct  wl_events {
188*a399b765Szf 	wpa_event_type	event;
189*a399b765Szf } wl_events_t;
190*a399b765Szf 
191*a399b765Szf #ifdef __cplusplus
192*a399b765Szf }
193*a399b765Szf #endif
194*a399b765Szf 
195*a399b765Szf #endif /* __WPA_H */
196