• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Wi-Fi Protected Setup - message definitions
3  * Copyright (c) 2008, Jouni Malinen <j@w1.fi>
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 WPS_DEFS_H
16 #define WPS_DEFS_H
17 
18 #define WPS_VERSION 0x10
19 
20 /* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
21 #define WPS_DH_GROUP 5
22 
23 #define WPS_UUID_LEN 16
24 #define WPS_NONCE_LEN 16
25 #define WPS_AUTHENTICATOR_LEN 8
26 #define WPS_AUTHKEY_LEN 32
27 #define WPS_KEYWRAPKEY_LEN 16
28 #define WPS_EMSK_LEN 32
29 #define WPS_PSK_LEN 16
30 #define WPS_SECRET_NONCE_LEN 16
31 #define WPS_HASH_LEN 32
32 #define WPS_KWA_LEN 8
33 #define WPS_MGMTAUTHKEY_LEN 32
34 #define WPS_MGMTENCKEY_LEN 16
35 #define WPS_MGMT_KEY_ID_LEN 16
36 
37 /* Attribute Types */
38 enum wps_attribute {
39 	ATTR_AP_CHANNEL = 0x1001,
40 	ATTR_ASSOC_STATE = 0x1002,
41 	ATTR_AUTH_TYPE = 0x1003,
42 	ATTR_AUTH_TYPE_FLAGS = 0x1004,
43 	ATTR_AUTHENTICATOR = 0x1005,
44 	ATTR_CONFIG_METHODS = 0x1008,
45 	ATTR_CONFIG_ERROR = 0x1009,
46 	ATTR_CONFIRM_URL4 = 0x100a,
47 	ATTR_CONFIRM_URL6 = 0x100b,
48 	ATTR_CONN_TYPE = 0x100c,
49 	ATTR_CONN_TYPE_FLAGS = 0x100d,
50 	ATTR_CRED = 0x100e,
51 	ATTR_ENCR_TYPE = 0x100f,
52 	ATTR_ENCR_TYPE_FLAGS = 0x1010,
53 	ATTR_DEV_NAME = 0x1011,
54 	ATTR_DEV_PASSWORD_ID = 0x1012,
55 	ATTR_E_HASH1 = 0x1014,
56 	ATTR_E_HASH2 = 0x1015,
57 	ATTR_E_SNONCE1 = 0x1016,
58 	ATTR_E_SNONCE2 = 0x1017,
59 	ATTR_ENCR_SETTINGS = 0x1018,
60 	ATTR_ENROLLEE_NONCE = 0x101a,
61 	ATTR_FEATURE_ID = 0x101b,
62 	ATTR_IDENTITY = 0x101c,
63 	ATTR_IDENTITY_PROOF = 0x101d,
64 	ATTR_KEY_WRAP_AUTH = 0x101e,
65 	ATTR_KEY_ID = 0x101f,
66 	ATTR_MAC_ADDR = 0x1020,
67 	ATTR_MANUFACTURER = 0x1021,
68 	ATTR_MSG_TYPE = 0x1022,
69 	ATTR_MODEL_NAME = 0x1023,
70 	ATTR_MODEL_NUMBER = 0x1024,
71 	ATTR_NETWORK_INDEX = 0x1026,
72 	ATTR_NETWORK_KEY = 0x1027,
73 	ATTR_NETWORK_KEY_INDEX = 0x1028,
74 	ATTR_NEW_DEVICE_NAME = 0x1029,
75 	ATTR_NEW_PASSWORD = 0x102a,
76 	ATTR_OOB_DEVICE_PASSWORD = 0x102c,
77 	ATTR_OS_VERSION = 0x102d,
78 	ATTR_POWER_LEVEL = 0x102f,
79 	ATTR_PSK_CURRENT = 0x1030,
80 	ATTR_PSK_MAX = 0x1031,
81 	ATTR_PUBLIC_KEY = 0x1032,
82 	ATTR_RADIO_ENABLE = 0x1033,
83 	ATTR_REBOOT = 0x1034,
84 	ATTR_REGISTRAR_CURRENT = 0x1035,
85 	ATTR_REGISTRAR_ESTABLISHED = 0x1036,
86 	ATTR_REGISTRAR_LIST = 0x1037,
87 	ATTR_REGISTRAR_MAX = 0x1038,
88 	ATTR_REGISTRAR_NONCE = 0x1039,
89 	ATTR_REQUEST_TYPE = 0x103a,
90 	ATTR_RESPONSE_TYPE = 0x103b,
91 	ATTR_RF_BANDS = 0x103c,
92 	ATTR_R_HASH1 = 0x103d,
93 	ATTR_R_HASH2 = 0x103e,
94 	ATTR_R_SNONCE1 = 0x103f,
95 	ATTR_R_SNONCE2 = 0x1040,
96 	ATTR_SELECTED_REGISTRAR = 0x1041,
97 	ATTR_SERIAL_NUMBER = 0x1042,
98 	ATTR_WPS_STATE = 0x1044,
99 	ATTR_SSID = 0x1045,
100 	ATTR_TOTAL_NETWORKS = 0x1046,
101 	ATTR_UUID_E = 0x1047,
102 	ATTR_UUID_R = 0x1048,
103 	ATTR_VENDOR_EXT = 0x1049,
104 	ATTR_VERSION = 0x104a,
105 	ATTR_X509_CERT_REQ = 0x104b,
106 	ATTR_X509_CERT = 0x104c,
107 	ATTR_EAP_IDENTITY = 0x104d,
108 	ATTR_MSG_COUNTER = 0x104e,
109 	ATTR_PUBKEY_HASH = 0x104f,
110 	ATTR_REKEY_KEY = 0x1050,
111 	ATTR_KEY_LIFETIME = 0x1051,
112 	ATTR_PERMITTED_CFG_METHODS = 0x1052,
113 	ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
114 	ATTR_PRIMARY_DEV_TYPE = 0x1054,
115 	ATTR_SECONDARY_DEV_TYP_ELIST = 0x1055,
116 	ATTR_PORTABLE_DEV = 0x1056,
117 	ATTR_AP_SETUP_LOCKED = 0x1057,
118 	ATTR_APPLICATION_EXT = 0x1058,
119 	ATTR_EAP_TYPE = 0x1059,
120 	ATTR_IV = 0x1060,
121 	ATTR_KEY_PROVIDED_AUTO = 0x1061,
122 	ATTR_802_1X_ENABLED = 0x1062,
123 	ATTR_APPSESSIONKEY = 0x1063,
124 	ATTR_WEPTRANSMITKEY = 0x1064
125 };
126 
127 /* Device Password ID */
128 enum wps_dev_password_id {
129 	DEV_PW_DEFAULT = 0x0000,
130 	DEV_PW_USER_SPECIFIED = 0x0001,
131 	DEV_PW_MACHINE_SPECIFIED = 0x0002,
132 	DEV_PW_REKEY = 0x0003,
133 	DEV_PW_PUSHBUTTON = 0x0004,
134 	DEV_PW_REGISTRAR_SPECIFIED = 0x0005
135 };
136 
137 /* Message Type */
138 enum wps_msg_type {
139 	WPS_Beacon = 0x01,
140 	WPS_ProbeRequest = 0x02,
141 	WPS_ProbeResponse = 0x03,
142 	WPS_M1 = 0x04,
143 	WPS_M2 = 0x05,
144 	WPS_M2D = 0x06,
145 	WPS_M3 = 0x07,
146 	WPS_M4 = 0x08,
147 	WPS_M5 = 0x09,
148 	WPS_M6 = 0x0a,
149 	WPS_M7 = 0x0b,
150 	WPS_M8 = 0x0c,
151 	WPS_WSC_ACK = 0x0d,
152 	WPS_WSC_NACK = 0x0e,
153 	WPS_WSC_DONE = 0x0f
154 };
155 
156 /* Authentication Type Flags */
157 #define WPS_AUTH_OPEN 0x0001
158 #define WPS_AUTH_WPAPSK 0x0002
159 #define WPS_AUTH_SHARED 0x0004
160 #define WPS_AUTH_WPA 0x0008
161 #define WPS_AUTH_WPA2 0x0010
162 #define WPS_AUTH_WPA2PSK 0x0020
163 #define WPS_AUTH_TYPES (WPS_AUTH_OPEN | WPS_AUTH_WPAPSK | WPS_AUTH_SHARED | \
164 			WPS_AUTH_WPA | WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)
165 
166 /* Encryption Type Flags */
167 #define WPS_ENCR_NONE 0x0001
168 #define WPS_ENCR_WEP 0x0002
169 #define WPS_ENCR_TKIP 0x0004
170 #define WPS_ENCR_AES 0x0008
171 #define WPS_ENCR_TYPES (WPS_ENCR_NONE | WPS_ENCR_WEP | WPS_ENCR_TKIP | \
172 			WPS_ENCR_AES)
173 
174 /* Configuration Error */
175 enum wps_config_error {
176 	WPS_CFG_NO_ERROR = 0,
177 	WPS_CFG_OOB_IFACE_READ_ERROR = 1,
178 	WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
179 	WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
180 	WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
181 	WPS_CFG_SIGNAL_TOO_WEAK = 5,
182 	WPS_CFG_NETWORK_AUTH_FAILURE = 6,
183 	WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
184 	WPS_CFG_NO_DHCP_RESPONSE = 8,
185 	WPS_CFG_FAILED_DHCP_CONFIG = 9,
186 	WPS_CFG_IP_ADDR_CONFLICT = 10,
187 	WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
188 	WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
189 	WPS_CFG_ROGUE_SUSPECTED = 13,
190 	WPS_CFG_DEVICE_BUSY = 14,
191 	WPS_CFG_SETUP_LOCKED = 15,
192 	WPS_CFG_MSG_TIMEOUT = 16,
193 	WPS_CFG_REG_SESS_TIMEOUT = 17,
194 	WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18
195 };
196 
197 /* RF Bands */
198 #define WPS_RF_24GHZ 0x01
199 #define WPS_RF_50GHZ 0x02
200 
201 /* Config Methods */
202 #define WPS_CONFIG_USBA 0x0001
203 #define WPS_CONFIG_ETHERNET 0x0002
204 #define WPS_CONFIG_LABEL 0x0004
205 #define WPS_CONFIG_DISPLAY 0x0008
206 #define WPS_CONFIG_EXT_NFC_TOKEN 0x0010
207 #define WPS_CONFIG_INT_NFC_TOKEN 0x0020
208 #define WPS_CONFIG_NFC_INTERFACE 0x0040
209 #define WPS_CONFIG_PUSHBUTTON 0x0080
210 #define WPS_CONFIG_KEYPAD 0x0100
211 
212 /* Connection Type Flags */
213 #define WPS_CONN_ESS 0x01
214 #define WPS_CONN_IBSS 0x02
215 
216 /* Wi-Fi Protected Setup State */
217 enum wps_state {
218 	WPS_STATE_NOT_CONFIGURED = 1,
219 	WPS_STATE_CONFIGURED = 2
220 };
221 
222 /* Association State */
223 enum wps_assoc_state {
224 	WPS_ASSOC_NOT_ASSOC = 0,
225 	WPS_ASSOC_CONN_SUCCESS = 1,
226 	WPS_ASSOC_CFG_FAILURE = 2,
227 	WPS_ASSOC_FAILURE = 3,
228 	WPS_ASSOC_IP_FAILURE = 4
229 };
230 
231 
232 /* Primary Device Type */
233 struct wps_dev_type {
234 	u8 categ_id[2];
235 	u8 oui[4];
236 	u8 sub_categ_id[2];
237 };
238 
239 #define WPS_DEV_OUI_WFA 0x0050f204
240 
241 enum wps_dev_categ {
242 	WPS_DEV_COMPUTER = 1,
243 	WPS_DEV_INPUT = 2,
244 	WPS_DEV_PRINTER = 3,
245 	WPS_DEV_CAMERA = 4,
246 	WPS_DEV_STORAGE = 5,
247 	WPS_DEV_NETWORK_INFRA = 6,
248 	WPS_DEV_DISPLAY = 7,
249 	WPS_DEV_MULTIMEDIA = 8,
250 	WPS_DEV_GAMING = 9,
251 	WPS_DEV_PHONE = 10
252 };
253 
254 enum wps_dev_subcateg {
255 	WPS_DEV_COMPUTER_PC = 1,
256 	WPS_DEV_COMPUTER_SERVER = 2,
257 	WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
258 	WPS_DEV_PRINTER_PRINTER = 1,
259 	WPS_DEV_PRINTER_SCANNER = 2,
260 	WPS_DEV_CAMERA_DIGITAL_STILL_CAMERA = 1,
261 	WPS_DEV_STORAGE_NAS = 1,
262 	WPS_DEV_NETWORK_INFRA_AP = 1,
263 	WPS_DEV_NETWORK_INFRA_ROUTER = 2,
264 	WPS_DEV_NETWORK_INFRA_SWITCH = 3,
265 	WPS_DEV_DISPLAY_TV = 1,
266 	WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
267 	WPS_DEV_DISPLAY_PROJECTOR = 3,
268 	WPS_DEV_MULTIMEDIA_DAR = 1,
269 	WPS_DEV_MULTIMEDIA_PVR = 2,
270 	WPS_DEV_MULTIMEDIA_MCX = 3,
271 	WPS_DEV_GAMING_XBOX = 1,
272 	WPS_DEV_GAMING_XBOX360 = 2,
273 	WPS_DEV_GAMING_PLAYSTATION = 3,
274 	WPS_DEV_PHONE_WINDOWS_MOBILE = 1
275 };
276 
277 
278 /* Request Type */
279 enum wps_request_type {
280 	WPS_REQ_ENROLLEE_INFO = 0,
281 	WPS_REQ_ENROLLEE = 1,
282 	WPS_REQ_REGISTRAR = 2,
283 	WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
284 };
285 
286 /* Response Type */
287 enum wps_response_type {
288 	WPS_RESP_ENROLLEE_INFO = 0,
289 	WPS_RESP_ENROLLEE = 1,
290 	WPS_RESP_REGISTRAR = 2,
291 	WPS_RESP_AP = 3
292 };
293 
294 /* Walk Time for push button configuration (in seconds) */
295 #define WPS_PBC_WALK_TIME 120
296 
297 #endif /* WPS_DEFS_H */
298