]> git.ipfire.org Git - thirdparty/hostap.git/blame - src/common/defs.h
Added support for using SHA256-based stronger key derivation for WPA2
[thirdparty/hostap.git] / src / common / defs.h
CommitLineData
6fc6879b
JM
1/*
2 * WPA Supplicant - Common definitions
56586197 3 * Copyright (c) 2004-2008, Jouni Malinen <j@w1.fi>
6fc6879b
JM
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * Alternatively, this software may be distributed under the terms of BSD
10 * license.
11 *
12 * See README and COPYING for more details.
13 */
14
15#ifndef DEFS_H
16#define DEFS_H
17
18#ifdef FALSE
19#undef FALSE
20#endif
21#ifdef TRUE
22#undef TRUE
23#endif
24typedef enum { FALSE = 0, TRUE = 1 } Boolean;
25
26
27#define WPA_CIPHER_NONE BIT(0)
28#define WPA_CIPHER_WEP40 BIT(1)
29#define WPA_CIPHER_WEP104 BIT(2)
30#define WPA_CIPHER_TKIP BIT(3)
31#define WPA_CIPHER_CCMP BIT(4)
32#ifdef CONFIG_IEEE80211W
33#define WPA_CIPHER_AES_128_CMAC BIT(5)
34#endif /* CONFIG_IEEE80211W */
35
36#define WPA_KEY_MGMT_IEEE8021X BIT(0)
37#define WPA_KEY_MGMT_PSK BIT(1)
38#define WPA_KEY_MGMT_NONE BIT(2)
39#define WPA_KEY_MGMT_IEEE8021X_NO_WPA BIT(3)
40#define WPA_KEY_MGMT_WPA_NONE BIT(4)
41#define WPA_KEY_MGMT_FT_IEEE8021X BIT(5)
42#define WPA_KEY_MGMT_FT_PSK BIT(6)
56586197
JM
43#define WPA_KEY_MGMT_IEEE8021X_SHA256 BIT(7)
44#define WPA_KEY_MGMT_PSK_SHA256 BIT(8)
45
46static inline int wpa_key_mgmt_wpa_ieee8021x(int akm)
47{
48 return akm == WPA_KEY_MGMT_IEEE8021X ||
49 akm == WPA_KEY_MGMT_FT_IEEE8021X ||
50 akm == WPA_KEY_MGMT_IEEE8021X_SHA256;
51}
52
53static inline int wpa_key_mgmt_wpa_psk(int akm)
54{
55 return akm == WPA_KEY_MGMT_PSK ||
56 akm == WPA_KEY_MGMT_FT_PSK ||
57 akm == WPA_KEY_MGMT_PSK_SHA256;
58}
59
60static inline int wpa_key_mgmt_ft(int akm)
61{
62 return akm == WPA_KEY_MGMT_FT_PSK ||
63 akm == WPA_KEY_MGMT_FT_IEEE8021X;
64}
65
66static inline int wpa_key_mgmt_sha256(int akm)
67{
68 return akm == WPA_KEY_MGMT_PSK_SHA256 ||
69 akm == WPA_KEY_MGMT_IEEE8021X_SHA256;
70}
71
6fc6879b
JM
72
73#define WPA_PROTO_WPA BIT(0)
74#define WPA_PROTO_RSN BIT(1)
75
76#define WPA_AUTH_ALG_OPEN BIT(0)
77#define WPA_AUTH_ALG_SHARED BIT(1)
78#define WPA_AUTH_ALG_LEAP BIT(2)
79
80
81typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP,
82 WPA_ALG_IGTK, WPA_ALG_PMK } wpa_alg;
83typedef enum { CIPHER_NONE, CIPHER_WEP40, CIPHER_TKIP, CIPHER_CCMP,
84 CIPHER_WEP104 } wpa_cipher;
85typedef enum { KEY_MGMT_802_1X, KEY_MGMT_PSK, KEY_MGMT_NONE,
86 KEY_MGMT_802_1X_NO_WPA, KEY_MGMT_WPA_NONE,
56586197
JM
87 KEY_MGMT_FT_802_1X, KEY_MGMT_FT_PSK,
88 KEY_MGMT_802_1X_SHA256, KEY_MGMT_PSK_SHA256
6fc6879b
JM
89} wpa_key_mgmt;
90
91/**
92 * enum wpa_states - wpa_supplicant state
93 *
94 * These enumeration values are used to indicate the current wpa_supplicant
95 * state (wpa_s->wpa_state). The current state can be retrieved with
96 * wpa_supplicant_get_state() function and the state can be changed by calling
97 * wpa_supplicant_set_state(). In WPA state machine (wpa.c and preauth.c), the
98 * wrapper functions wpa_sm_get_state() and wpa_sm_set_state() should be used
99 * to access the state variable.
100 */
101typedef enum {
102 /**
103 * WPA_DISCONNECTED - Disconnected state
104 *
105 * This state indicates that client is not associated, but is likely to
106 * start looking for an access point. This state is entered when a
107 * connection is lost.
108 */
109 WPA_DISCONNECTED,
110
111 /**
112 * WPA_INACTIVE - Inactive state (wpa_supplicant disabled)
113 *
114 * This state is entered if there are no enabled networks in the
115 * configuration. wpa_supplicant is not trying to associate with a new
116 * network and external interaction (e.g., ctrl_iface call to add or
117 * enable a network) is needed to start association.
118 */
119 WPA_INACTIVE,
120
121 /**
122 * WPA_SCANNING - Scanning for a network
123 *
124 * This state is entered when wpa_supplicant starts scanning for a
125 * network.
126 */
127 WPA_SCANNING,
128
129 /**
130 * WPA_ASSOCIATING - Trying to associate with a BSS/SSID
131 *
132 * This state is entered when wpa_supplicant has found a suitable BSS
133 * to associate with and the driver is configured to try to associate
134 * with this BSS in ap_scan=1 mode. When using ap_scan=2 mode, this
135 * state is entered when the driver is configured to try to associate
136 * with a network using the configured SSID and security policy.
137 */
138 WPA_ASSOCIATING,
139
140 /**
141 * WPA_ASSOCIATED - Association completed
142 *
143 * This state is entered when the driver reports that association has
144 * been successfully completed with an AP. If IEEE 802.1X is used
145 * (with or without WPA/WPA2), wpa_supplicant remains in this state
146 * until the IEEE 802.1X/EAPOL authentication has been completed.
147 */
148 WPA_ASSOCIATED,
149
150 /**
151 * WPA_4WAY_HANDSHAKE - WPA 4-Way Key Handshake in progress
152 *
153 * This state is entered when WPA/WPA2 4-Way Handshake is started. In
154 * case of WPA-PSK, this happens when receiving the first EAPOL-Key
155 * frame after association. In case of WPA-EAP, this state is entered
156 * when the IEEE 802.1X/EAPOL authentication has been completed.
157 */
158 WPA_4WAY_HANDSHAKE,
159
160 /**
161 * WPA_GROUP_HANDSHAKE - WPA Group Key Handshake in progress
162 *
163 * This state is entered when 4-Way Key Handshake has been completed
164 * (i.e., when the supplicant sends out message 4/4) and when Group
165 * Key rekeying is started by the AP (i.e., when supplicant receives
166 * message 1/2).
167 */
168 WPA_GROUP_HANDSHAKE,
169
170 /**
171 * WPA_COMPLETED - All authentication completed
172 *
173 * This state is entered when the full authentication process is
174 * completed. In case of WPA2, this happens when the 4-Way Handshake is
175 * successfully completed. With WPA, this state is entered after the
176 * Group Key Handshake; with IEEE 802.1X (non-WPA) connection is
177 * completed after dynamic keys are received (or if not used, after
178 * the EAP authentication has been completed). With static WEP keys and
179 * plaintext connections, this state is entered when an association
180 * has been completed.
181 *
182 * This state indicates that the supplicant has completed its
183 * processing for the association phase and that data connection is
184 * fully configured.
185 */
186 WPA_COMPLETED
187} wpa_states;
188
189#define MLME_SETPROTECTION_PROTECT_TYPE_NONE 0
190#define MLME_SETPROTECTION_PROTECT_TYPE_RX 1
191#define MLME_SETPROTECTION_PROTECT_TYPE_TX 2
192#define MLME_SETPROTECTION_PROTECT_TYPE_RX_TX 3
193
194#define MLME_SETPROTECTION_KEY_TYPE_GROUP 0
195#define MLME_SETPROTECTION_KEY_TYPE_PAIRWISE 1
196
197#endif /* DEFS_H */