wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wps_defs.h
Go to the documentation of this file.
1 
5 #ifndef WPS_DEFS_H
6 #define WPS_DEFS_H
7 
8 #ifdef CONFIG_WPS_TESTING
9 
10 extern int wps_version_number;
11 extern int wps_testing_dummy_cred;
12 extern int wps_corrupt_pkhash;
13 #define WPS_VERSION wps_version_number
14 
15 #else /* CONFIG_WPS_TESTING */
16 
17 #define WPS_VERSION 0x20
18 
19 #endif /* CONFIG_WPS_TESTING */
20 
21 /* Diffie-Hellman 1536-bit MODP Group; RFC 3526, Group 5 */
22 #define WPS_DH_GROUP 5
23 
24 #define WPS_UUID_LEN 16
25 #define WPS_NONCE_LEN 16
26 #define WPS_AUTHENTICATOR_LEN 8
27 #define WPS_AUTHKEY_LEN 32
28 #define WPS_KEYWRAPKEY_LEN 16
29 #define WPS_EMSK_LEN 32
30 #define WPS_PSK_LEN 16
31 #define WPS_SECRET_NONCE_LEN 16
32 #define WPS_HASH_LEN 32
33 #define WPS_KWA_LEN 8
34 #define WPS_MGMTAUTHKEY_LEN 32
35 #define WPS_MGMTENCKEY_LEN 16
36 #define WPS_MGMT_KEY_ID_LEN 16
37 #define WPS_OOB_DEVICE_PASSWORD_MIN_LEN 16
38 #define WPS_OOB_DEVICE_PASSWORD_LEN 32
39 #define WPS_OOB_PUBKEY_HASH_LEN 20
40 #define WPS_DEV_NAME_MAX_LEN 32
41 #define WPS_MANUFACTURER_MAX_LEN 64
42 #define WPS_MODEL_NAME_MAX_LEN 32
43 #define WPS_MODEL_NUMBER_MAX_LEN 32
44 #define WPS_SERIAL_NUMBER_MAX_LEN 32
45 
46 /* Attribute Types */
47 enum wps_attribute {
48  ATTR_AP_CHANNEL = 0x1001,
49  ATTR_ASSOC_STATE = 0x1002,
50  ATTR_AUTH_TYPE = 0x1003,
51  ATTR_AUTH_TYPE_FLAGS = 0x1004,
52  ATTR_AUTHENTICATOR = 0x1005,
53  ATTR_CONFIG_METHODS = 0x1008,
54  ATTR_CONFIG_ERROR = 0x1009,
55  ATTR_CONFIRM_URL4 = 0x100a,
56  ATTR_CONFIRM_URL6 = 0x100b,
57  ATTR_CONN_TYPE = 0x100c,
58  ATTR_CONN_TYPE_FLAGS = 0x100d,
59  ATTR_CRED = 0x100e,
60  ATTR_ENCR_TYPE = 0x100f,
61  ATTR_ENCR_TYPE_FLAGS = 0x1010,
62  ATTR_DEV_NAME = 0x1011,
63  ATTR_DEV_PASSWORD_ID = 0x1012,
64  ATTR_E_HASH1 = 0x1014,
65  ATTR_E_HASH2 = 0x1015,
66  ATTR_E_SNONCE1 = 0x1016,
67  ATTR_E_SNONCE2 = 0x1017,
68  ATTR_ENCR_SETTINGS = 0x1018,
69  ATTR_ENROLLEE_NONCE = 0x101a,
70  ATTR_FEATURE_ID = 0x101b,
71  ATTR_IDENTITY = 0x101c,
72  ATTR_IDENTITY_PROOF = 0x101d,
73  ATTR_KEY_WRAP_AUTH = 0x101e,
74  ATTR_KEY_ID = 0x101f,
75  ATTR_MAC_ADDR = 0x1020,
76  ATTR_MANUFACTURER = 0x1021,
77  ATTR_MSG_TYPE = 0x1022,
78  ATTR_MODEL_NAME = 0x1023,
79  ATTR_MODEL_NUMBER = 0x1024,
80  ATTR_NETWORK_INDEX = 0x1026,
81  ATTR_NETWORK_KEY = 0x1027,
82  ATTR_NETWORK_KEY_INDEX = 0x1028,
83  ATTR_NEW_DEVICE_NAME = 0x1029,
84  ATTR_NEW_PASSWORD = 0x102a,
85  ATTR_OOB_DEVICE_PASSWORD = 0x102c,
86  ATTR_OS_VERSION = 0x102d,
87  ATTR_POWER_LEVEL = 0x102f,
88  ATTR_PSK_CURRENT = 0x1030,
89  ATTR_PSK_MAX = 0x1031,
90  ATTR_PUBLIC_KEY = 0x1032,
91  ATTR_RADIO_ENABLE = 0x1033,
92  ATTR_REBOOT = 0x1034,
93  ATTR_REGISTRAR_CURRENT = 0x1035,
94  ATTR_REGISTRAR_ESTABLISHED = 0x1036,
95  ATTR_REGISTRAR_LIST = 0x1037,
96  ATTR_REGISTRAR_MAX = 0x1038,
97  ATTR_REGISTRAR_NONCE = 0x1039,
98  ATTR_REQUEST_TYPE = 0x103a,
99  ATTR_RESPONSE_TYPE = 0x103b,
100  ATTR_RF_BANDS = 0x103c,
101  ATTR_R_HASH1 = 0x103d,
102  ATTR_R_HASH2 = 0x103e,
103  ATTR_R_SNONCE1 = 0x103f,
104  ATTR_R_SNONCE2 = 0x1040,
105  ATTR_SELECTED_REGISTRAR = 0x1041,
106  ATTR_SERIAL_NUMBER = 0x1042,
107  ATTR_WPS_STATE = 0x1044,
108  ATTR_SSID = 0x1045,
109  ATTR_TOTAL_NETWORKS = 0x1046,
110  ATTR_UUID_E = 0x1047,
111  ATTR_UUID_R = 0x1048,
112  ATTR_VENDOR_EXT = 0x1049,
113  ATTR_VERSION = 0x104a,
114  ATTR_X509_CERT_REQ = 0x104b,
115  ATTR_X509_CERT = 0x104c,
116  ATTR_EAP_IDENTITY = 0x104d,
117  ATTR_MSG_COUNTER = 0x104e,
118  ATTR_PUBKEY_HASH = 0x104f,
119  ATTR_REKEY_KEY = 0x1050,
120  ATTR_KEY_LIFETIME = 0x1051,
121  ATTR_PERMITTED_CFG_METHODS = 0x1052,
122  ATTR_SELECTED_REGISTRAR_CONFIG_METHODS = 0x1053,
123  ATTR_PRIMARY_DEV_TYPE = 0x1054,
124  ATTR_SECONDARY_DEV_TYPE_LIST = 0x1055,
125  ATTR_PORTABLE_DEV = 0x1056,
126  ATTR_AP_SETUP_LOCKED = 0x1057,
127  ATTR_APPLICATION_EXT = 0x1058,
128  ATTR_EAP_TYPE = 0x1059,
129  ATTR_IV = 0x1060,
130  ATTR_KEY_PROVIDED_AUTO = 0x1061,
131  ATTR_802_1X_ENABLED = 0x1062,
132  ATTR_APPSESSIONKEY = 0x1063,
133  ATTR_WEPTRANSMITKEY = 0x1064,
134  ATTR_REQUESTED_DEV_TYPE = 0x106a,
135  ATTR_EXTENSIBILITY_TEST = 0x10fa /* _NOT_ defined in the spec */
136 };
137 
138 #define WPS_VENDOR_ID_WFA 14122
139 
140 /* WFA Vendor Extension subelements */
141 enum {
142  WFA_ELEM_VERSION2 = 0x00,
143  WFA_ELEM_AUTHORIZEDMACS = 0x01,
144  WFA_ELEM_NETWORK_KEY_SHAREABLE = 0x02,
145  WFA_ELEM_REQUEST_TO_ENROLL = 0x03,
146  WFA_ELEM_SETTINGS_DELAY_TIME = 0x04,
147  WFA_ELEM_REGISTRAR_CONFIGURATION_METHODS = 0x05
148 };
149 
150 /* Device Password ID */
151 enum wps_dev_password_id {
152  DEV_PW_DEFAULT = 0x0000,
153  DEV_PW_USER_SPECIFIED = 0x0001,
154  DEV_PW_MACHINE_SPECIFIED = 0x0002,
155  DEV_PW_REKEY = 0x0003,
156  DEV_PW_PUSHBUTTON = 0x0004,
157  DEV_PW_REGISTRAR_SPECIFIED = 0x0005,
158  DEV_PW_NFC_CONNECTION_HANDOVER = 0x0007,
159  DEV_PW_P2PS_DEFAULT = 0x0008
160 };
161 
162 /* Message Type */
163 enum wps_msg_type {
164  WPS_Beacon = 0x01,
165  WPS_ProbeRequest = 0x02,
166  WPS_ProbeResponse = 0x03,
167  WPS_M1 = 0x04,
168  WPS_M2 = 0x05,
169  WPS_M2D = 0x06,
170  WPS_M3 = 0x07,
171  WPS_M4 = 0x08,
172  WPS_M5 = 0x09,
173  WPS_M6 = 0x0a,
174  WPS_M7 = 0x0b,
175  WPS_M8 = 0x0c,
176  WPS_WSC_ACK = 0x0d,
177  WPS_WSC_NACK = 0x0e,
178  WPS_WSC_DONE = 0x0f
179 };
180 
181 /* Authentication Type Flags */
182 #define WPS_AUTH_OPEN 0x0001
183 #define WPS_AUTH_WPAPSK 0x0002
184 #define WPS_AUTH_SHARED 0x0004 /* deprecated */
185 #define WPS_AUTH_WPA 0x0008
186 #define WPS_AUTH_WPA2 0x0010
187 #define WPS_AUTH_WPA2PSK 0x0020
188 #define WPS_AUTH_TYPES (WPS_AUTH_OPEN | WPS_AUTH_WPAPSK | WPS_AUTH_SHARED | \
189  WPS_AUTH_WPA | WPS_AUTH_WPA2 | WPS_AUTH_WPA2PSK)
190 
191 /* Encryption Type Flags */
192 #define WPS_ENCR_NONE 0x0001
193 #define WPS_ENCR_WEP 0x0002 /* deprecated */
194 #define WPS_ENCR_TKIP 0x0004
195 #define WPS_ENCR_AES 0x0008
196 #define WPS_ENCR_TYPES (WPS_ENCR_NONE | WPS_ENCR_WEP | WPS_ENCR_TKIP | \
197  WPS_ENCR_AES)
198 
199 /* Configuration Error */
200 enum wps_config_error {
201  WPS_CFG_NO_ERROR = 0,
202  WPS_CFG_OOB_IFACE_READ_ERROR = 1,
203  WPS_CFG_DECRYPTION_CRC_FAILURE = 2,
204  WPS_CFG_24_CHAN_NOT_SUPPORTED = 3,
205  WPS_CFG_50_CHAN_NOT_SUPPORTED = 4,
206  WPS_CFG_SIGNAL_TOO_WEAK = 5,
207  WPS_CFG_NETWORK_AUTH_FAILURE = 6,
208  WPS_CFG_NETWORK_ASSOC_FAILURE = 7,
209  WPS_CFG_NO_DHCP_RESPONSE = 8,
210  WPS_CFG_FAILED_DHCP_CONFIG = 9,
211  WPS_CFG_IP_ADDR_CONFLICT = 10,
212  WPS_CFG_NO_CONN_TO_REGISTRAR = 11,
213  WPS_CFG_MULTIPLE_PBC_DETECTED = 12,
214  WPS_CFG_ROGUE_SUSPECTED = 13,
215  WPS_CFG_DEVICE_BUSY = 14,
216  WPS_CFG_SETUP_LOCKED = 15,
217  WPS_CFG_MSG_TIMEOUT = 16,
218  WPS_CFG_REG_SESS_TIMEOUT = 17,
219  WPS_CFG_DEV_PASSWORD_AUTH_FAILURE = 18,
220  WPS_CFG_60G_CHAN_NOT_SUPPORTED = 19,
221  WPS_CFG_PUBLIC_KEY_HASH_MISMATCH = 20
222 };
223 
224 /* Vendor specific Error Indication for WPS event messages */
225 enum wps_error_indication {
226  WPS_EI_NO_ERROR,
227  WPS_EI_SECURITY_TKIP_ONLY_PROHIBITED,
228  WPS_EI_SECURITY_WEP_PROHIBITED,
229  WPS_EI_AUTH_FAILURE,
230  NUM_WPS_EI_VALUES
231 };
232 
233 /* RF Bands */
234 #define WPS_RF_24GHZ 0x01
235 #define WPS_RF_50GHZ 0x02
236 #define WPS_RF_60GHZ 0x04
237 
238 /* Config Methods */
239 #define WPS_CONFIG_USBA 0x0001
240 #define WPS_CONFIG_ETHERNET 0x0002
241 #define WPS_CONFIG_LABEL 0x0004
242 #define WPS_CONFIG_DISPLAY 0x0008
243 #define WPS_CONFIG_EXT_NFC_TOKEN 0x0010
244 #define WPS_CONFIG_INT_NFC_TOKEN 0x0020
245 #define WPS_CONFIG_NFC_INTERFACE 0x0040
246 #define WPS_CONFIG_PUSHBUTTON 0x0080
247 #define WPS_CONFIG_KEYPAD 0x0100
248 #define WPS_CONFIG_VIRT_PUSHBUTTON 0x0280
249 #define WPS_CONFIG_PHY_PUSHBUTTON 0x0480
250 #define WPS_CONFIG_P2PS 0x1000
251 #define WPS_CONFIG_VIRT_DISPLAY 0x2008
252 #define WPS_CONFIG_PHY_DISPLAY 0x4008
253 
254 /* Connection Type Flags */
255 #define WPS_CONN_ESS 0x01
256 #define WPS_CONN_IBSS 0x02
257 
258 /* Wi-Fi Protected Setup State */
259 enum wps_state {
260  WPS_STATE_NOT_CONFIGURED = 1,
261  WPS_STATE_CONFIGURED = 2
262 };
263 
264 /* Association State */
265 enum wps_assoc_state {
266  WPS_ASSOC_NOT_ASSOC = 0,
267  WPS_ASSOC_CONN_SUCCESS = 1,
268  WPS_ASSOC_CFG_FAILURE = 2,
269  WPS_ASSOC_FAILURE = 3,
270  WPS_ASSOC_IP_FAILURE = 4
271 };
272 
273 
274 #define WPS_DEV_OUI_WFA 0x0050f204
275 
276 enum wps_dev_categ {
277  WPS_DEV_COMPUTER = 1,
278  WPS_DEV_INPUT = 2,
279  WPS_DEV_PRINTER = 3,
280  WPS_DEV_CAMERA = 4,
281  WPS_DEV_STORAGE = 5,
282  WPS_DEV_NETWORK_INFRA = 6,
283  WPS_DEV_DISPLAY = 7,
284  WPS_DEV_MULTIMEDIA = 8,
285  WPS_DEV_GAMING = 9,
286  WPS_DEV_PHONE = 10,
287  WPS_DEV_AUDIO = 11,
288 };
289 
290 enum wps_dev_subcateg {
291  WPS_DEV_COMPUTER_PC = 1,
292  WPS_DEV_COMPUTER_SERVER = 2,
293  WPS_DEV_COMPUTER_MEDIA_CENTER = 3,
294  WPS_DEV_COMPUTER_ULTRA_MOBILE = 4,
295  WPS_DEV_COMPUTER_NOTEBOOK = 5,
296  WPS_DEV_COMPUTER_DESKTOP = 6,
297  WPS_DEV_COMPUTER_MID = 7,
298  WPS_DEV_COMPUTER_NETBOOK = 8,
299  WPS_DEV_COMPUTER_TABLET = 9,
300  WPS_DEV_INPUT_KEYBOARD = 1,
301  WPS_DEV_INPUT_MOUSE = 2,
302  WPS_DEV_INPUT_JOYSTICK = 3,
303  WPS_DEV_INPUT_TRACKBALL = 4,
304  WPS_DEV_INPUT_GAMING = 5,
305  WPS_DEV_INPUT_REMOTE = 6,
306  WPS_DEV_INPUT_TOUCHSCREEN = 7,
307  WPS_DEV_INPUT_BIOMETRIC_READER = 8,
308  WPS_DEV_INPUT_BARCODE_READER = 9,
309  WPS_DEV_PRINTER_PRINTER = 1,
310  WPS_DEV_PRINTER_SCANNER = 2,
311  WPS_DEV_PRINTER_FAX = 3,
312  WPS_DEV_PRINTER_COPIER = 4,
313  WPS_DEV_PRINTER_ALL_IN_ONE = 5,
314  WPS_DEV_CAMERA_DIGITAL_STILL_CAMERA = 1,
315  WPS_DEV_CAMERA_VIDEO = 2,
316  WPS_DEV_CAMERA_WEB = 3,
317  WPS_DEV_CAMERA_SECURITY = 4,
318  WPS_DEV_STORAGE_NAS = 1,
319  WPS_DEV_NETWORK_INFRA_AP = 1,
320  WPS_DEV_NETWORK_INFRA_ROUTER = 2,
321  WPS_DEV_NETWORK_INFRA_SWITCH = 3,
322  WPS_DEV_NETWORK_INFRA_GATEWAY = 4,
323  WPS_DEV_NETWORK_INFRA_BRIDGE = 5,
324  WPS_DEV_DISPLAY_TV = 1,
325  WPS_DEV_DISPLAY_PICTURE_FRAME = 2,
326  WPS_DEV_DISPLAY_PROJECTOR = 3,
327  WPS_DEV_DISPLAY_MONITOR = 4,
328  WPS_DEV_MULTIMEDIA_DAR = 1,
329  WPS_DEV_MULTIMEDIA_PVR = 2,
330  WPS_DEV_MULTIMEDIA_MCX = 3,
331  WPS_DEV_MULTIMEDIA_SET_TOP_BOX = 4,
332  WPS_DEV_MULTIMEDIA_MEDIA_SERVER = 5,
333  WPS_DEV_MULTIMEDIA_PORTABLE_VIDEO_PLAYER = 6,
334  WPS_DEV_GAMING_XBOX = 1,
335  WPS_DEV_GAMING_XBOX360 = 2,
336  WPS_DEV_GAMING_PLAYSTATION = 3,
337  WPS_DEV_GAMING_GAME_CONSOLE = 4,
338  WPS_DEV_GAMING_PORTABLE_DEVICE = 5,
339  WPS_DEV_PHONE_WINDOWS_MOBILE = 1,
340  WPS_DEV_PHONE_SINGLE_MODE = 2,
341  WPS_DEV_PHONE_DUAL_MODE = 3,
342  WPS_DEV_PHONE_SP_SINGLE_MODE = 4,
343  WPS_DEV_PHONE_SP_DUAL_MODE = 5,
344  WPS_DEV_AUDIO_TUNER_RECV = 1,
345  WPS_DEV_AUDIO_SPEAKERS = 2,
346  WPS_DEV_AUDIO_PMP = 3,
347  WPS_DEV_AUDIO_HEADSET = 4,
348  WPS_DEV_AUDIO_HEADPHONES = 5,
349  WPS_DEV_AUDIO_MICROPHONE = 6,
350  WPS_DEV_AUDIO_HOME_THEATRE = 7,
351 };
352 
353 
354 /* Request Type */
355 enum wps_request_type {
356  WPS_REQ_ENROLLEE_INFO = 0,
357  WPS_REQ_ENROLLEE = 1,
358  WPS_REQ_REGISTRAR = 2,
359  WPS_REQ_WLAN_MANAGER_REGISTRAR = 3
360 };
361 
362 /* Response Type */
363 enum wps_response_type {
364  WPS_RESP_ENROLLEE_INFO = 0,
365  WPS_RESP_ENROLLEE = 1,
366  WPS_RESP_REGISTRAR = 2,
367  WPS_RESP_AP = 3
368 };
369 
370 /* Walk Time for push button configuration (in seconds) */
371 #define WPS_PBC_WALK_TIME 120
372 
373 #define WPS_MAX_AUTHORIZED_MACS 5
374 
375 #endif /* WPS_DEFS_H */