MSWSP: fix dissect_mswsp_smb()
[wireshark-wip.git] / epan / dissectors / packet-wps.c
blob9b8931f383e6daaf2fb8a7ace7ce385c79b82f9d
1 /* packet-wps.c
3 * Wifi Simple Config aka Wifi Protected Setup
5 * Written by Jens Braeuer using WiFi-Alliance Spec 1.0h and
6 * parts of a patch by JP Jiang and Philippe Teuwen. November 2007
8 * Spec:
9 * https://www.wi-fi.org/knowledge_center_overview.php?type=4
10 * Patch:
11 * http://wireshark.digimirror.nl/lists/wireshark-dev/200703/msg00121.html
13 * Copyright 2007 Jens Braeuer <jensb@cs.tu-berlin.de>
15 * $Id$
17 * Wireshark - Network traffic analyzer
18 * By Gerald Combs <gerald@wireshark.org>
19 * Copyright 1998 Gerald Combs
21 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License
23 * as published by the Free Software Foundation; either version 2
24 * of the License, or (at your option) any later version.
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
37 #include "config.h"
39 #include <glib.h>
40 #include <epan/packet.h>
41 #include <epan/expert.h>
42 #include <epan/sminmpec.h>
44 #include "packet-wps.h"
46 static int hf_eapwps_opcode = -1;
47 static int hf_eapwps_flags = -1;
48 static int hf_eapwps_flag_mf = -1;
49 static int hf_eapwps_flag_lf = -1;
50 static int hf_eapwps_msglen = -1;
52 static gint ett_eap_wps_attr = -1;
53 static gint ett_eap_wps_flags = -1;
55 static expert_field ei_eapwps_packet_too_short = EI_INIT;
56 static expert_field ei_eapwps_fmt_warn_too_long = EI_INIT;
57 static expert_field ei_eapwps_fmt_length_warn = EI_INIT;
59 /* OPCodes */
60 #define OPC_WSC_START 0x01 /* WPS OPCODE WSC_Start */
61 #define OPC_WSC_ACK 0x02 /* WPS OPCODE WSC_ACK */
62 #define OPC_WSC_NACK 0x03 /* WPS OPCODE WSC_NACK */
63 #define OPC_WSC_MSG 0x04 /* WPS OPCODE WSC_MSG */
64 #define OPC_WSC_DONE 0x05 /* WPS OPCODE WSC_Done */
65 #define OPC_WSC_FRAG_ACK 0x06 /* WPS OPCODE WSC_FRAG_ACK */
67 static const value_string eapwps_opcode_vals[] = {
68 { OPC_WSC_START, "WSC Start"},
69 { OPC_WSC_ACK, "WSC Ack"},
70 { OPC_WSC_NACK, "WSC Nack" },
71 { OPC_WSC_MSG, "WSC Msg" },
72 { OPC_WSC_DONE, "WSC Done" },
73 { OPC_WSC_FRAG_ACK, "WSC Frag Ack" },
74 { 0, NULL }
77 /* Flag-Field masks */
78 #define MASK_WSC_FLAG_MF 0x01 /* WPS Flag more frag */
79 #define MASK_WSC_FLAG_LF 0x02 /* WPS flag length field */
81 #define WPS_TLV_TYPE_AP_CHANNEL 0x1001
82 #define WPS_TLV_TYPE_ASSOCIATION_STATE 0x1002
83 #define WPS_TLV_TYPE_AUTHENTICATION_TYPE 0x1003
84 #define WPS_TLV_TYPE_AUTHENTICATION_TYPE_FLAGS 0x1004
85 #define WPS_TLV_TYPE_AUTHENTICATOR 0x1005
86 #define WPS_TLV_TYPE_CONFIG_METHODS 0x1008
87 #define WPS_TLV_TYPE_CONFIGURATION_ERROR 0x1009
88 #define WPS_TLV_TYPE_CONFIRMATION_URL4 0x100a
89 #define WPS_TLV_TYPE_CONFIRMATION_URL6 0x100b
90 #define WPS_TLV_TYPE_CONNECTION_TYPE 0x100c
91 #define WPS_TLV_TYPE_CONNECTION_TYPE_FLAGS 0x100d
92 #define WPS_TLV_TYPE_CREDENTIAL 0x100e
93 #define WPS_TLV_TYPE_DEVICE_NAME 0x1011
94 #define WPS_TLV_TYPE_DEVICE_PASSWORD_ID 0x1012
95 #define WPS_TLV_TYPE_E_HASH1 0X1014
96 #define WPS_TLV_TYPE_E_HASH2 0x1015
97 #define WPS_TLV_TYPE_E_SNONCE1 0x1016
98 #define WPS_TLV_TYPE_E_SNONCE2 0x1017
99 #define WPS_TLV_TYPE_ENCRYPTED_SETTINGS 0x1018
100 #define WPS_TLV_TYPE_ENCRYPTION_TYPE 0x100f
101 #define WPS_TLV_TYPE_ENCRYPTION_TYPE_FLAGS 0x1010
102 #define WPS_TLV_TYPE_ENROLLEE_NONCE 0x101a
103 #define WPS_TLV_TYPE_FEATURE_ID 0x101b
104 #define WPS_TLV_TYPE_IDENTITY 0x101c
105 #define WPS_TLV_TYPE_IDENTITY_PROOF 0x101d
106 #define WPS_TLV_TYPE_KEY_WRAP_AUTHENTICATOR 0x101e
107 #define WPS_TLV_TYPE_KEY_IDENTIFIER 0x101f
108 #define WPS_TLV_TYPE_MAC_ADDRESS 0x1020
109 #define WPS_TLV_TYPE_MANUFACTURER 0x1021
110 #define WPS_TLV_TYPE_MESSAGE_TYPE 0x1022
111 #define WPS_TLV_TYPE_MODEL_NAME 0x1023
112 #define WPS_TLV_TYPE_MODEL_NUMBER 0x1024
113 #define WPS_TLV_TYPE_NETWORK_INDEX 0x1026
114 #define WPS_TLV_TYPE_NETWORK_KEY 0x1027
115 #define WPS_TLV_TYPE_NETWORK_KEY_INDEX 0x1028
116 #define WPS_TLV_TYPE_NEW_DEVICE_NAME 0x1029
117 #define WPS_TLV_TYPE_NEW_PASSWORD 0x102a
118 #define WPS_TLV_TYPE_OOB_DEVICE_PASSWORD 0x102c
119 #define WPS_TLV_TYPE_OS_VERSION 0x102d
120 #define WPS_TLV_TYPE_POWER_LEVEL 0x102f
121 #define WPS_TLV_TYPE_PSK_CURRENT 0x1030
122 #define WPS_TLV_TYPE_PSK_MAX 0x1031
123 #define WPS_TLV_TYPE_PUBLIC_KEY 0x1032
124 #define WPS_TLV_TYPE_RADIO_ENABLED 0x1033
125 #define WPS_TLV_TYPE_REBOOT 0x1034
126 #define WPS_TLV_TYPE_REGISTRAR_CURRENT 0x1035
127 #define WPS_TLV_TYPE_REGISTRAR_ESTABLISHED 0x1036
128 #define WPS_TLV_TYPE_REGISTRAR_LIST 0x1037
129 #define WPS_TLV_TYPE_REGISTRAR_MAX 0x1038
130 #define WPS_TLV_TYPE_REGISTRAR_NONCE 0x1039
131 #define WPS_TLV_TYPE_REQUEST_TYPE 0x103a
132 #define WPS_TLV_TYPE_RESPONSE_TYPE 0x103b
133 #define WPS_TLV_TYPE_RF_BANDS 0x103c
134 #define WPS_TLV_TYPE_R_HASH1 0x103d
135 #define WPS_TLV_TYPE_R_HASH2 0x103e
136 #define WPS_TLV_TYPE_R_SNONCE1 0x103f
137 #define WPS_TLV_TYPE_R_SNONCE2 0x1040
138 #define WPS_TLV_TYPE_SELECTED_REGISTRAR 0x1041
139 #define WPS_TLV_TYPE_SERIAL_NUMBER 0x1042
140 #define WPS_TLV_TYPE_WIFI_PROTECTED_SETUP_STATE 0x1044
141 #define WPS_TLV_TYPE_SSID 0x1045
142 #define WPS_TLV_TYPE_TOTAL_NETWORKS 0x1046
143 #define WPS_TLV_TYPE_UUID_E 0x1047
144 #define WPS_TLV_TYPE_UUID_R 0x1048
145 #define WPS_TLV_TYPE_VENDOR_EXTENSION 0x1049
146 #define WPS_TLV_TYPE_VERSION 0x104a
147 #define WPS_TLV_TYPE_X509_CERTIFICATE_REQUEST 0x104b
148 #define WPS_TLV_TYPE_X509_CERTIFICATE 0x104c
149 #define WPS_TLV_TYPE_EAP_IDENTITY 0x104d
150 #define WPS_TLV_TYPE_MESSAGE_COUNTER 0x104e
151 #define WPS_TLV_TYPE_PUBLIC_KEY_HASH 0x104f
152 #define WPS_TLV_TYPE_REKEY_KEY 0x1050
153 #define WPS_TLV_TYPE_KEY_LIFETIME 0x1051
154 #define WPS_TLV_TYPE_PERMITTED_CONFIG_METHODS 0x1052
155 #define WPS_TLV_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS 0x1053
156 #define WPS_TLV_TYPE_PRIMARY_DEVICE_TYPE 0x1054
157 #define WPS_TLV_TYPE_SECONDARY_DEVICE_TYPE_LIST 0x1055
158 #define WPS_TLV_TYPE_PORTABLE_DEVICE 0x1056
159 #define WPS_TLV_TYPE_AP_SETUP_LOCKED 0x1057
160 #define WPS_TLV_TYPE_APPLICATION_EXTENSION 0x1058
161 #define WPS_TLV_TYPE_EAP_TYPE 0x1059
162 #define WPS_TLV_TYPE_INITIALIZATION_VECTOR 0x1060
163 #define WPS_TLV_TYPE_KEY_PROVIDED_AUTOMATICALLY 0x1061
164 #define WPS_TLV_TYPE_8021X_ENABLED 0x1062
165 #define WPS_TLV_TYPE_APPSESSIONKEY 0x1063
166 #define WPS_TLV_TYPE_WEPTRANSMITKEY 0x1064
167 #define WPS_TLV_TYPE_REQUESTED_DEV_TYPE 0x106a
170 static const value_string eapwps_tlv_types[] = {
171 { WPS_TLV_TYPE_AP_CHANNEL, "AP Channel" },
172 { WPS_TLV_TYPE_ASSOCIATION_STATE, "Association State" },
173 { WPS_TLV_TYPE_AUTHENTICATION_TYPE, "Authentication Type" },
174 { WPS_TLV_TYPE_AUTHENTICATION_TYPE_FLAGS, "Authentication Type Flags" },
175 { WPS_TLV_TYPE_AUTHENTICATOR, "Authenticator" },
176 { WPS_TLV_TYPE_CONFIG_METHODS, "Config Methods" },
177 { WPS_TLV_TYPE_CONFIGURATION_ERROR, "Configuration Error" },
178 { WPS_TLV_TYPE_CONFIRMATION_URL4, "Confirmation URL4" },
179 { WPS_TLV_TYPE_CONFIRMATION_URL6, "Confirmation URL6" },
180 { WPS_TLV_TYPE_CONNECTION_TYPE, "Connection Type" },
181 { WPS_TLV_TYPE_CONNECTION_TYPE_FLAGS, "Connection Type Flags" },
182 { WPS_TLV_TYPE_CREDENTIAL, "Credential" },
183 { WPS_TLV_TYPE_DEVICE_NAME, "Device Name" },
184 { WPS_TLV_TYPE_DEVICE_PASSWORD_ID, "Device Password ID" },
185 { WPS_TLV_TYPE_E_HASH1, "E Hash1" },
186 { WPS_TLV_TYPE_E_HASH2, "E Hash2" },
187 { WPS_TLV_TYPE_E_SNONCE1, "E SNonce1" },
188 { WPS_TLV_TYPE_E_SNONCE2, "E SNonce2" },
189 { WPS_TLV_TYPE_ENCRYPTED_SETTINGS, "Encrypted Settings" },
190 { WPS_TLV_TYPE_ENCRYPTION_TYPE, "Encryption Type" },
191 { WPS_TLV_TYPE_ENCRYPTION_TYPE_FLAGS, "Encryption Type Flags" },
192 { WPS_TLV_TYPE_ENROLLEE_NONCE, "Enrollee Nonce" },
193 { WPS_TLV_TYPE_FEATURE_ID, "Feature Id" },
194 { WPS_TLV_TYPE_IDENTITY, "Identity" },
195 { WPS_TLV_TYPE_IDENTITY_PROOF, "Identity Proof" },
196 { WPS_TLV_TYPE_KEY_WRAP_AUTHENTICATOR, "Key Wrap Authenticator" },
197 { WPS_TLV_TYPE_KEY_IDENTIFIER, "Key Identifier" },
198 { WPS_TLV_TYPE_MAC_ADDRESS, "MAC Address" },
199 { WPS_TLV_TYPE_MANUFACTURER, "Manufacturer" },
200 { WPS_TLV_TYPE_MESSAGE_TYPE, "Message Type" },
201 { WPS_TLV_TYPE_MODEL_NAME, "Model Name" },
202 { WPS_TLV_TYPE_MODEL_NUMBER, "Model Number" },
203 { WPS_TLV_TYPE_NETWORK_INDEX, "Network Index" },
204 { WPS_TLV_TYPE_NETWORK_KEY, "Network Key" },
205 { WPS_TLV_TYPE_NETWORK_KEY_INDEX, "Network Key Index" },
206 { WPS_TLV_TYPE_NEW_DEVICE_NAME, "New Device Name" },
207 { WPS_TLV_TYPE_NEW_PASSWORD, "New Password" },
208 { WPS_TLV_TYPE_OOB_DEVICE_PASSWORD, "OOB Device Password" },
209 { WPS_TLV_TYPE_OS_VERSION, "OS Version" },
210 { WPS_TLV_TYPE_POWER_LEVEL, "Power Level" },
211 { WPS_TLV_TYPE_PSK_CURRENT, "PSK Current" },
212 { WPS_TLV_TYPE_PSK_MAX, "PSK Max" },
213 { WPS_TLV_TYPE_PUBLIC_KEY, "Public Key" },
214 { WPS_TLV_TYPE_RADIO_ENABLED, "Radio Enabled" },
215 { WPS_TLV_TYPE_REBOOT, "Reboot" },
216 { WPS_TLV_TYPE_REGISTRAR_CURRENT, "Registrar Current" },
217 { WPS_TLV_TYPE_REGISTRAR_ESTABLISHED, "Registrar Established" },
218 { WPS_TLV_TYPE_REGISTRAR_LIST, "Registrar List" },
219 { WPS_TLV_TYPE_REGISTRAR_MAX, "registrar_max" },
220 { WPS_TLV_TYPE_REGISTRAR_NONCE, "Registrar Nonce" },
221 { WPS_TLV_TYPE_REQUEST_TYPE, "Request Type" },
222 { WPS_TLV_TYPE_RESPONSE_TYPE, "Response Type" },
223 { WPS_TLV_TYPE_RF_BANDS, "RF Bands" },
224 { WPS_TLV_TYPE_R_HASH1, "R Hash1" },
225 { WPS_TLV_TYPE_R_HASH2, "R Hash2" },
226 { WPS_TLV_TYPE_R_SNONCE1, "R Snonce1" },
227 { WPS_TLV_TYPE_R_SNONCE2, "R Snonce2" },
228 { WPS_TLV_TYPE_SELECTED_REGISTRAR, "Selected Registrar" },
229 { WPS_TLV_TYPE_SERIAL_NUMBER, "Serial Number" },
230 { WPS_TLV_TYPE_WIFI_PROTECTED_SETUP_STATE, "Wifi Protected Setup State" },
231 { WPS_TLV_TYPE_SSID, "SSID" },
232 { WPS_TLV_TYPE_TOTAL_NETWORKS, "Total Networks" },
233 { WPS_TLV_TYPE_UUID_E, "UUID E" },
234 { WPS_TLV_TYPE_UUID_R, "UUID R" },
235 { WPS_TLV_TYPE_VENDOR_EXTENSION, "Vendor Extension" },
236 { WPS_TLV_TYPE_VERSION, "Version" },
237 { WPS_TLV_TYPE_X509_CERTIFICATE_REQUEST, "X509 Certificate Request" },
238 { WPS_TLV_TYPE_X509_CERTIFICATE, "X509 Certificate" },
239 { WPS_TLV_TYPE_EAP_IDENTITY, "EAP Identity" },
240 { WPS_TLV_TYPE_MESSAGE_COUNTER, "Message Counter" },
241 { WPS_TLV_TYPE_PUBLIC_KEY_HASH, "Public Key Hash" },
242 { WPS_TLV_TYPE_REKEY_KEY, "Rekey Key" },
243 { WPS_TLV_TYPE_KEY_LIFETIME, "Key Lifetime" },
244 { WPS_TLV_TYPE_PERMITTED_CONFIG_METHODS, "Permitted Config Methods" },
245 { WPS_TLV_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS, "Selected Registrar Config Methods" },
246 { WPS_TLV_TYPE_PRIMARY_DEVICE_TYPE, "Primary Device Type" },
247 { WPS_TLV_TYPE_SECONDARY_DEVICE_TYPE_LIST, "Secondary Device Type List" },
248 { WPS_TLV_TYPE_PORTABLE_DEVICE, "Portable Device" },
249 { WPS_TLV_TYPE_AP_SETUP_LOCKED, "Ap Setup Locked" },
250 { WPS_TLV_TYPE_APPLICATION_EXTENSION, "Application Extension" },
251 { WPS_TLV_TYPE_EAP_TYPE, "EAP Type" },
252 { WPS_TLV_TYPE_INITIALIZATION_VECTOR, "Initialization Vector" },
253 { WPS_TLV_TYPE_KEY_PROVIDED_AUTOMATICALLY, "Key Provided Automatically" },
254 { WPS_TLV_TYPE_8021X_ENABLED, "8021x Enabled" },
255 { WPS_TLV_TYPE_APPSESSIONKEY, "AppSessionKey" },
256 { WPS_TLV_TYPE_WEPTRANSMITKEY, "WEPTransmitKey" },
257 { WPS_TLV_TYPE_REQUESTED_DEV_TYPE, "Requested Device Type" },
258 { 0, NULL }
262 /* WFA Vendor Extension */
264 #define WPS_WFA_EXT_VERSION2 0x00
265 #define WPS_WFA_EXT_AUTHORIZEDMACS 0x01
266 #define WPS_WFA_EXT_NETWORK_KEY_SHAREABLE 0x02
267 #define WPS_WFA_EXT_REQUEST_TO_ENROLL 0x03
268 #define WPS_WFA_EXT_SETTINGS_DELAY_TIME 0x04
270 static const value_string eapwps_wfa_ext_types[] = {
271 { WPS_WFA_EXT_VERSION2, "Version2" },
272 { WPS_WFA_EXT_AUTHORIZEDMACS, "AuthorizedMACs" },
273 { WPS_WFA_EXT_NETWORK_KEY_SHAREABLE, "Network Key Shareable" },
274 { WPS_WFA_EXT_REQUEST_TO_ENROLL, "Request to Enroll" },
275 { WPS_WFA_EXT_SETTINGS_DELAY_TIME, "Settings Delay Time" },
276 { 0, NULL }
278 #define WFA_OUI 0x0050F204
280 static int proto_wps = -1;
282 static int hf_eapwps_tlv_type = -1;
283 static int hf_eapwps_tlv_len = -1;
285 static int hf_eapwps_tlv_ap_channel = -1;
286 static int hf_eapwps_tlv_association_state = -1;
287 static int hf_eapwps_tlv_authentication_type = -1;
288 static int hf_eapwps_tlv_authentication_type_flags = -1;
289 static int hf_eapwps_tlv_authentication_type_flags_open = -1;
290 static int hf_eapwps_tlv_authentication_type_flags_wpapsk = -1;
291 static int hf_eapwps_tlv_authentication_type_flags_shared = -1;
292 static int hf_eapwps_tlv_authentication_type_flags_wpa = -1;
293 static int hf_eapwps_tlv_authentication_type_flags_wpa2 = -1;
294 static int hf_eapwps_tlv_authentication_type_flags_wpa2psk = -1;
295 static int hf_eapwps_tlv_authenticator = -1;
296 static int hf_eapwps_tlv_config_methods = -1;
297 static int hf_eapwps_tlv_config_methods_usba = -1;
298 static int hf_eapwps_tlv_config_methods_ethernet = -1;
299 static int hf_eapwps_tlv_config_methods_label = -1;
300 static int hf_eapwps_tlv_config_methods_display = -1;
301 static int hf_eapwps_tlv_config_methods_phy_display = -1;
302 static int hf_eapwps_tlv_config_methods_virt_display = -1;
303 static int hf_eapwps_tlv_config_methods_nfcext = -1;
304 static int hf_eapwps_tlv_config_methods_nfcint = -1;
305 static int hf_eapwps_tlv_config_methods_nfcinf = -1;
306 static int hf_eapwps_tlv_config_methods_pushbutton = -1;
307 static int hf_eapwps_tlv_config_methods_phy_pushbutton = -1;
308 static int hf_eapwps_tlv_config_methods_virt_pushbutton = -1;
309 static int hf_eapwps_tlv_config_methods_keypad = -1;
310 static int hf_eapwps_tlv_configuration_error = -1;
311 static int hf_eapwps_tlv_confirmation_url4 = -1;
312 static int hf_eapwps_tlv_confirmation_url6 = -1;
313 static int hf_eapwps_tlv_connection_type = -1;
314 static int hf_eapwps_tlv_connection_type_flags = -1;
315 static int hf_eapwps_tlv_connection_type_flags_ess = -1;
316 static int hf_eapwps_tlv_connection_type_flags_ibss = -1;
317 static int hf_eapwps_tlv_credential = -1;
318 static int hf_eapwps_tlv_device_name = -1;
319 static int hf_eapwps_tlv_device_password_id = -1;
320 static int hf_eapwps_tlv_e_hash1 = -1;
321 static int hf_eapwps_tlv_e_hash2 = -1;
322 static int hf_eapwps_tlv_e_snonce1 = -1;
323 static int hf_eapwps_tlv_e_snonce2 = -1;
324 static int hf_eapwps_tlv_encrypted_settings = -1;
325 static int hf_eapwps_tlv_encryption_type = -1;
326 static int hf_eapwps_tlv_encryption_type_flags = -1;
327 static int hf_eapwps_tlv_encryption_type_flags_none = -1;
328 static int hf_eapwps_tlv_encryption_type_flags_wep = -1;
329 static int hf_eapwps_tlv_encryption_type_flags_tkip = -1;
330 static int hf_eapwps_tlv_encryption_type_flags_aes = -1;
331 static int hf_eapwps_tlv_enrollee_nonce = -1;
332 static int hf_eapwps_tlv_feature_id = -1;
333 static int hf_eapwps_tlv_identity = -1;
334 static int hf_eapwps_tlv_identity_proof = -1;
335 static int hf_eapwps_tlv_key_wrap_authenticator = -1;
336 static int hf_eapwps_tlv_key_identifier = -1;
337 static int hf_eapwps_tlv_mac_address = -1;
338 static int hf_eapwps_tlv_manufacturer = -1;
339 static int hf_eapwps_tlv_message_type = -1;
340 static int hf_eapwps_tlv_model_name = -1;
341 static int hf_eapwps_tlv_model_number = -1;
342 static int hf_eapwps_tlv_network_index = -1;
343 static int hf_eapwps_tlv_network_key = -1;
344 static int hf_eapwps_tlv_network_key_index = -1;
345 static int hf_eapwps_tlv_new_device_name = -1;
346 static int hf_eapwps_tlv_new_password = -1;
347 static int hf_eapwps_tlv_oob_device_password = -1;
348 static int hf_eapwps_tlv_os_version = -1;
349 static int hf_eapwps_tlv_power_level = -1;
350 static int hf_eapwps_tlv_psk_current = -1;
351 static int hf_eapwps_tlv_psk_max = -1;
352 static int hf_eapwps_tlv_public_key = -1;
353 static int hf_eapwps_tlv_radio_enabled = -1;
354 static int hf_eapwps_tlv_reboot = -1;
355 static int hf_eapwps_tlv_registrar_current = -1;
356 static int hf_eapwps_tlv_registrar_established = -1;
357 static int hf_eapwps_tlv_registrar_list = -1;
358 static int hf_eapwps_tlv_registrar_max = -1;
359 static int hf_eapwps_tlv_registrar_nonce = -1;
360 static int hf_eapwps_tlv_request_type = -1;
361 static int hf_eapwps_tlv_response_type = -1;
362 static int hf_eapwps_tlv_rf_bands = -1;
363 static int hf_eapwps_tlv_r_hash1 = -1;
364 static int hf_eapwps_tlv_r_hash2 = -1;
365 static int hf_eapwps_tlv_r_snonce1 = -1;
366 static int hf_eapwps_tlv_r_snonce2 = -1;
367 static int hf_eapwps_tlv_selected_registrar = -1;
368 static int hf_eapwps_tlv_serial_number = -1;
369 static int hf_eapwps_tlv_wifi_protected_setup_state = -1;
370 static int hf_eapwps_tlv_ssid = -1;
371 static int hf_eapwps_tlv_total_networks = -1;
372 static int hf_eapwps_tlv_uuid_e = -1;
373 static int hf_eapwps_tlv_uuid_r = -1;
374 static int hf_eapwps_tlv_vendor_extension = -1;
375 static int hf_eapwps_tlv_version = -1;
376 static int hf_eapwps_tlv_x509_certificate_request = -1;
377 static int hf_eapwps_tlv_x509_certificate = -1;
378 static int hf_eapwps_tlv_eap_identity = -1;
379 static int hf_eapwps_tlv_message_counter = -1;
380 static int hf_eapwps_tlv_public_key_hash = -1;
381 static int hf_eapwps_tlv_rekey_key = -1;
382 static int hf_eapwps_tlv_key_lifetime = -1;
383 static int hf_eapwps_tlv_permitted_config_methods = -1;
384 static int hf_eapwps_tlv_permitted_config_methods_usba = -1;
385 static int hf_eapwps_tlv_permitted_config_methods_ethernet = -1;
386 static int hf_eapwps_tlv_permitted_config_methods_label = -1;
387 static int hf_eapwps_tlv_permitted_config_methods_display = -1;
388 static int hf_eapwps_tlv_permitted_config_methods_phy_display = -1;
389 static int hf_eapwps_tlv_permitted_config_methods_virt_display = -1;
390 static int hf_eapwps_tlv_permitted_config_methods_nfcext = -1;
391 static int hf_eapwps_tlv_permitted_config_methods_nfcint = -1;
392 static int hf_eapwps_tlv_permitted_config_methods_nfcinf = -1;
393 static int hf_eapwps_tlv_permitted_config_methods_pushbutton = -1;
394 static int hf_eapwps_tlv_permitted_config_methods_phy_pushbutton = -1;
395 static int hf_eapwps_tlv_permitted_config_methods_virt_pushbutton = -1;
396 static int hf_eapwps_tlv_permitted_config_methods_keypad = -1;
397 static int hf_eapwps_tlv_selected_registrar_config_methods = -1;
398 static int hf_eapwps_tlv_selected_registrar_config_methods_usba = -1;
399 static int hf_eapwps_tlv_selected_registrar_config_methods_ethernet = -1;
400 static int hf_eapwps_tlv_selected_registrar_config_methods_label = -1;
401 static int hf_eapwps_tlv_selected_registrar_config_methods_display = -1;
402 static int hf_eapwps_tlv_selected_registrar_config_methods_phy_display = -1;
403 static int hf_eapwps_tlv_selected_registrar_config_methods_virt_display = -1;
404 static int hf_eapwps_tlv_selected_registrar_config_methods_nfcext = -1;
405 static int hf_eapwps_tlv_selected_registrar_config_methods_nfcint = -1;
406 static int hf_eapwps_tlv_selected_registrar_config_methods_nfcinf = -1;
407 static int hf_eapwps_tlv_selected_registrar_config_methods_pushbutton = -1;
408 static int hf_eapwps_tlv_selected_registrar_config_methods_phy_pushbutton = -1;
409 static int hf_eapwps_tlv_selected_registrar_config_methods_virt_pushbutton = -1;
410 static int hf_eapwps_tlv_selected_registrar_config_methods_keypad = -1;
411 static int hf_eapwps_tlv_primary_device_type = -1;
412 static int hf_eapwps_tlv_primary_device_type_category = -1;
413 #define WPS_DEVICE_TYPE_CATEGORY_MAX 11
414 static int hf_eapwps_tlv_primary_device_type_subcategory[WPS_DEVICE_TYPE_CATEGORY_MAX] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
415 static int hf_eapwps_tlv_secondary_device_type_list = -1;
416 static int hf_eapwps_tlv_portable_device = -1;
417 static int hf_eapwps_tlv_ap_setup_locked = -1;
418 static int hf_eapwps_tlv_application_extension = -1;
419 static int hf_eapwps_tlv_eap_type = -1;
420 static int hf_eapwps_tlv_initialization_vector = -1;
421 static int hf_eapwps_tlv_key_provided_automatically = -1;
422 static int hf_eapwps_tlv_8021x_enabled = -1;
423 static int hf_eapwps_tlv_appsessionkey = -1;
424 static int hf_eapwps_tlv_weptransmitkey = -1;
425 static int hf_eapwps_tlv_requested_dev_type = -1;
427 static int hf_eapwps_vendor_id = -1;
428 static int hf_eapwps_wfa_ext_id = -1;
429 static int hf_eapwps_wfa_ext_len = -1;
431 static int hf_eapwps_wfa_ext_version2 = -1;
432 static int hf_eapwps_wfa_ext_authorizedmacs = -1;
433 static int hf_eapwps_wfa_ext_network_key_shareable = -1;
434 static int hf_eapwps_wfa_ext_request_to_enroll = -1;
435 static int hf_eapwps_wfa_ext_settings_delay_time = -1;
437 static gint ett_wps_tlv = -1;
438 static gint ett_eap_wps_ap_channel = -1;
439 static gint ett_eap_wps_association_state = -1;
440 static gint ett_eap_wps_authentication_type = -1;
441 static gint ett_eap_wps_authentication_type_flags = -1;
442 static gint ett_eap_wps_authenticator = -1;
443 static gint ett_eap_wps_config_methods = -1;
444 static gint ett_eap_wps_configuration_error = -1;
445 static gint ett_eap_wps_confirmation_url4 = -1;
446 static gint ett_eap_wps_confirmation_url6 = -1;
447 static gint ett_eap_wps_connection_type = -1;
448 static gint ett_eap_wps_connection_type_flags = -1;
449 static gint ett_eap_wps_credential = -1;
450 static gint ett_eap_wps_device_name = -1;
451 static gint ett_eap_wps_device_password_id = -1;
452 static gint ett_eap_wps_e_hash1 = -1;
453 static gint ett_eap_wps_e_hash2 = -1;
454 static gint ett_eap_wps_e_snonce1 = -1;
455 static gint ett_eap_wps_e_snonce2 = -1;
456 static gint ett_eap_wps_encrypted_settings = -1;
457 static gint ett_eap_wps_encryption_type = -1;
458 static gint ett_eap_wps_encryption_type_flags = -1;
459 static gint ett_eap_wps_enrollee_nonce = -1;
460 static gint ett_eap_wps_feature_id = -1;
461 static gint ett_eap_wps_identity = -1;
462 static gint ett_eap_wps_identity_proof = -1;
463 static gint ett_eap_wps_key_wrap_authenticator = -1;
464 static gint ett_eap_wps_key_identifier = -1;
465 static gint ett_eap_wps_mac_address = -1;
466 static gint ett_eap_wps_manufacturer = -1;
467 static gint ett_eap_wps_message_type = -1;
468 static gint ett_eap_wps_model_name = -1;
469 static gint ett_eap_wps_model_number = -1;
470 static gint ett_eap_wps_network_index = -1;
471 static gint ett_eap_wps_network_key = -1;
472 static gint ett_eap_wps_network_key_index = -1;
473 static gint ett_eap_wps_new_device_name = -1;
474 static gint ett_eap_wps_new_password = -1;
475 static gint ett_eap_wps_oob_device_password = -1;
476 static gint ett_eap_wps_os_version = -1;
477 static gint ett_eap_wps_power_level = -1;
478 static gint ett_eap_wps_psk_current = -1;
479 static gint ett_eap_wps_psk_max = -1;
480 static gint ett_eap_wps_public_key = -1;
481 static gint ett_eap_wps_radio_enabled = -1;
482 static gint ett_eap_wps_reboot = -1;
483 static gint ett_eap_wps_registrar_current = -1;
484 static gint ett_eap_wps_registrar_established = -1;
485 static gint ett_eap_wps_registrar_list = -1;
486 static gint ett_eap_wps_registrar_max = -1;
487 static gint ett_eap_wps_registrar_nonce = -1;
488 static gint ett_eap_wps_request_type = -1;
489 static gint ett_eap_wps_response_type = -1;
490 static gint ett_eap_wps_rf_bands = -1;
491 static gint ett_eap_wps_r_hash1 = -1;
492 static gint ett_eap_wps_r_hash2 = -1;
493 static gint ett_eap_wps_r_snonce1 = -1;
494 static gint ett_eap_wps_r_snonce2 = -1;
495 static gint ett_eap_wps_selected_registrar = -1;
496 static gint ett_eap_wps_serial_number = -1;
497 static gint ett_eap_wps_wifi_protected_setup_state = -1;
498 static gint ett_eap_wps_ssid = -1;
499 static gint ett_eap_wps_total_networks = -1;
500 static gint ett_eap_wps_uuid_e = -1;
501 static gint ett_eap_wps_uuid_r = -1;
502 static gint ett_eap_wps_vendor_extension = -1;
503 static gint ett_eap_wps_version = -1;
504 static gint ett_eap_wps_x509_certificate_request = -1;
505 static gint ett_eap_wps_x509_certificate = -1;
506 static gint ett_eap_wps_eap_identity = -1;
507 static gint ett_eap_wps_message_counter = -1;
508 static gint ett_eap_wps_public_key_hash = -1;
509 static gint ett_eap_wps_rekey_key = -1;
510 static gint ett_eap_wps_key_lifetime = -1;
511 static gint ett_eap_wps_permitted_config_methods = -1;
512 static gint ett_eap_wps_selected_registrar_config_methods = -1;
513 static gint ett_eap_wps_primary_device_type = -1;
514 static gint ett_eap_wps_secondary_device_type_list = -1;
515 static gint ett_eap_wps_portable_device = -1;
516 static gint ett_eap_wps_ap_setup_locked = -1;
517 static gint ett_eap_wps_application_extension = -1;
518 static gint ett_eap_wps_eap_type = -1;
519 static gint ett_eap_wps_initialization_vector = -1;
520 static gint ett_eap_wps_key_provided_automatically = -1;
521 static gint ett_eap_wps_8021x_enabled = -1;
522 static gint ett_eap_wps_appsessionkey = -1;
523 static gint ett_eap_wps_weptransmitkey = -1;
524 static gint ett_wps_wfa_ext = -1;
526 static const value_string eapwps_tlv_association_state_vals[] = {
527 { 0, "Not associated" },
528 { 1, "Connection success" },
529 { 2, "Configuration Failure" },
530 { 3, "Association Failure" },
531 { 4, "IP Failure" },
532 { 0, NULL }
535 #define EAPWPS_AUTHTYPE_OPEN 0x01
536 #define EAPWPS_AUTHTYPE_WPAPSK 0x02
537 #define EAPWPS_AUTHTYPE_SHARED 0x04
538 #define EAPWPS_AUTHTYPE_WPA 0x08
539 #define EAPWPS_AUTHTYPE_WPA2 0x10
540 #define EAPWPS_AUTHTYPE_WPA2PSK 0x20
542 static const value_string eapwps_tlv_authentication_type_vals[] = {
543 { EAPWPS_AUTHTYPE_OPEN, "Open" },
544 { EAPWPS_AUTHTYPE_WPA2PSK, "WPA PSK" },
545 { EAPWPS_AUTHTYPE_SHARED, "Shared" },
546 { EAPWPS_AUTHTYPE_WPA, "WPA" },
547 { EAPWPS_AUTHTYPE_WPA2, "WPA2" },
548 { EAPWPS_AUTHTYPE_WPA2PSK, "WPA2 PSK" },
549 { 0, NULL }
552 #define EAPWPS_CONFMETH_USBA 0x0001
553 #define EAPWPS_CONFMETH_ETHERNET 0x0002
554 #define EAPWPS_CONFMETH_LABEL 0x0004
555 #define EAPWPS_CONFMETH_DISPLAY 0x0008
556 #define EAPWPS_CONFMETH_VIRT_DISPLAY 0x2000
557 #define EAPWPS_CONFMETH_PHY_DISPLAY 0x4000
558 #define EAPWPS_CONFMETH_NFCEXT 0x0010
559 #define EAPWPS_CONFMETH_NFCINT 0x0020
560 #define EAPWPS_CONFMETH_NFCINF 0x0040
561 #define EAPWPS_CONFMETH_PUSHBUTTON 0x0080
562 #define EAPWPS_CONFMETH_VIRT_PUSHBUTTON 0x0200
563 #define EAPWPS_CONFMETH_PHY_PUSHBUTTON 0x0400
564 #define EAPWPS_CONFMETH_KEYPAD 0x0100
566 static const value_string eapwps_tlv_configuration_error_vals[] = {
567 { 0, "No Error" },
568 { 1, "OOB Interface Read Error" },
569 { 2, "Decryption CRC Failure" },
570 { 3, "2.4 channel not supported" },
571 { 4, "5.0 channel not supported" },
572 { 5, "Signal too weak" },
573 { 6, "Network auth failure" },
574 { 7, "Network association failure" },
575 { 8, "No DHCP response" },
576 { 9, "failed DHCP config" },
577 { 10, "IP address conflict" },
578 { 11, "Couldn't connect to Registrar" },
579 { 12, "Multiple PBC sessions detected" },
580 { 13, "Rogue activity suspected" },
581 { 14, "Device busy" },
582 { 15, "Setup locked" },
583 { 16, "Message Timeout" },
584 { 17, "Registration Session Timeout" },
585 { 18, "Device Password Auth Failure" },
586 { 0, NULL }
589 #define EAPWPS_CONNTYPE_ESS 0x1
590 #define EAPWPS_CONNTYPE_IBSS 0x2
592 static const value_string eapwps_tlv_connection_type_vals[] = {
593 { EAPWPS_CONNTYPE_ESS, "ESS" },
594 { EAPWPS_CONNTYPE_IBSS, "IBSS" },
595 { 0, NULL}
598 #define EAPWPS_DEVPW_PIN 0x0
599 #define EAPWPS_DEVPW_USER 0x1
600 #define EAPWPS_DEVPW_MACHINE 0x2
601 #define EAPWPS_DEVPW_REKEY 0x3
602 #define EAPWPS_DEVPW_PUSHBUTTON 0x4
603 #define EAPWPS_DEVPW_REGISTRAR 0x5
605 static const value_string eapwps_tlv_device_password_id_vals[] = {
606 { EAPWPS_DEVPW_PIN, "PIN (default)" },
607 { EAPWPS_DEVPW_USER, "User specified" },
608 { EAPWPS_DEVPW_MACHINE, "Machine specified" },
609 { EAPWPS_DEVPW_REKEY, "Rekey" },
610 { EAPWPS_DEVPW_PUSHBUTTON, "PushButton" },
611 { EAPWPS_DEVPW_REGISTRAR, "Registrar specified" },
612 { 0, NULL }
615 #define EAPWPS_ENCTYPE_NONE 0x1
616 #define EAPWPS_ENCTYPE_WEP 0x2
617 #define EAPWPS_ENCTYPE_TKIP 0x4
618 #define EAPWPS_ENCTYPE_AES 0x8
620 static const value_string eapwps_tlv_encryption_type_vals[] = {
621 { EAPWPS_ENCTYPE_NONE, "none" },
622 { EAPWPS_ENCTYPE_WEP, "WEP" },
623 { EAPWPS_ENCTYPE_TKIP, "TKIP" },
624 { EAPWPS_ENCTYPE_AES, "AES" },
625 { 0, NULL }
628 static const value_string eapwps_tlv_message_type_vals[] = {
629 { 0x01, "Beacon" },
630 { 0x02, "Probe Request" },
631 { 0x03, "Probe Response" },
632 { 0x04, "M1" },
633 { 0x05, "M2" },
634 { 0x06, "M2D" },
635 { 0x07, "M3" },
636 { 0x08, "M4" },
637 { 0x09, "M5" },
638 { 0x0A, "M6" },
639 { 0x0B, "M7" },
640 { 0x0C, "M8" },
641 { 0x0D, "WSC_ACK" },
642 { 0x0E, "WSC_NACK" },
643 { 0x0F, "WSC_DONE" },
644 { 0, NULL }
648 static const value_string eapwps_tlv_request_type_vals[] = {
649 { 0x00, "Enrollee, Info only" },
650 { 0x01, "Enrollee, open 802.1X" },
651 { 0x02, "Registrar" },
652 { 0x03, "WLAN Manager Registrar" },
653 { 0, NULL }
656 static const value_string eapwps_tlv_response_type_vals[] = {
657 { 0x00, "Enrollee, Info only" },
658 { 0x01, "Enrollee, open 802.1X" },
659 { 0x02, "Registrar" },
660 { 0x03, "AP" },
661 { 0, NULL }
664 static const value_string eapwps_tlv_rf_bands_vals[] = {
665 { 0x01, "2.4 GHz" },
666 { 0x02, "5 GHz" },
667 { 0x03, "2.4 and 5 GHz" },
668 { 0, NULL }
671 static const value_string eapwps_tlv_wifi_protected_setup_state[] = {
672 { 0x00, "Reserved" },
673 { 0x01, "Not configured" },
674 { 0x02, "Configured" },
675 { 0, NULL }
678 static const value_string eapwps_tlv_primary_device_type_category[] = {
679 { 0x01, "Computer" },
680 { 0x02, "Input Device" },
681 { 0x03, "Printers, Scanners, Faxes and Copiers" },
682 { 0x04, "Camera" },
683 { 0x05, "Storage" },
684 { 0x06, "Network Infrastructure" },
685 { 0x07, "Displays" },
686 { 0x08, "Multimedia Devices" },
687 { 0x09, "Gaming Devices" },
688 { 0x0A, "Telephone" },
689 { 0x0B, "Audio Devices" },
690 { 0, NULL }
693 static const value_string eapwps_tlv_computer_subcategory[] = {
694 { 0x01, "PC" },
695 { 0x02, "Server" },
696 { 0x03, "Media Center" },
697 { 0x04, "Ultra-mobile PC" },
698 { 0x05, "Notebook" },
699 { 0x06, "Desktop" },
700 { 0x07, "MID (Mobile Internet Device)" },
701 { 0x08, "Netbook" },
702 { 0, NULL }
705 static const value_string eapwps_tlv_input_device_subcategory[] = {
706 { 0x01, "Keyboard" },
707 { 0x02, "Mouse" },
708 { 0x03, "Joystick" },
709 { 0x04, "Trackball" },
710 { 0x05, "Gaming controller" },
711 { 0x06, "Remote" },
712 { 0x07, "Touchscreen" },
713 { 0x08, "Biometric reader" },
714 { 0x09, "Barcode reader" },
715 { 0, NULL }
718 static const value_string eapwps_tlv_printers_scanners_faxes_copiers_subcategory[] = {
719 { 0x01, "Printer or Print Server" },
720 { 0x02, "Scanner" },
721 { 0x03, "Fax" },
722 { 0x04, "Copier" },
723 { 0x05, "All-in-one (Printer, Scanner, Fax, Copier)" },
724 { 0, NULL }
727 static const value_string eapwps_tlv_camera_subcategory[] = {
728 { 0x01, "Digital Still Camera" },
729 { 0x02, "Video Camera" },
730 { 0x03, "Web Camera" },
731 { 0x04, "Security Camera" },
732 { 0, NULL }
735 static const value_string eapwps_tlv_storage_subcategory[] = {
736 { 0x01, "NAS" },
737 { 0, NULL }
740 static const value_string eapwps_tlv_network_infrastructure_subcategory[] = {
741 { 0x01, "AP" },
742 { 0x02, "Router" },
743 { 0x03, "Switch" },
744 { 0x04, "Gateway" },
745 { 0x05, "Bridge" },
746 { 0, NULL }
749 static const value_string eapwps_tlv_displays_subcategory[] = {
750 { 0x01, "Television" },
751 { 0x02, "Electronic Picture Frame" },
752 { 0x03, "Projector" },
753 { 0x04, "Monitor" },
754 { 0, NULL }
757 static const value_string eapwps_tlv_multimedia_devices_subcategory[] = {
758 { 0x01, "DAR" },
759 { 0x02, "PVR" },
760 { 0x03, "MCX" },
761 { 0x04, "Set-top box" },
762 { 0x05, "Media Server/Media Adapter/Media Extender" },
763 { 0x06, "Portable Video Player" },
764 { 0, NULL }
767 static const value_string eapwps_tlv_gaming_devices_subcategory[] = {
768 { 0x01, "Xbox" },
769 { 0x02, "Xbox360" },
770 { 0x03, "Playstation" },
771 { 0x04, "Game Console/Game Console Adapter" },
772 { 0x05, "Portable Gaming Device" },
773 { 0, NULL }
776 static const value_string eapwps_tlv_telephone_subcategory[] = {
777 { 0x01, "Windows Mobile" },
778 { 0x02, "Phone - single mode" },
779 { 0x03, "Phone - dual mode" },
780 { 0x04, "Smartphone - single mode" },
781 { 0x05, "Smartphone - dual mode" },
782 { 0, NULL }
785 static const value_string eapwps_tlv_audio_devices_subcategory[] = {
786 { 0x01, "Audio tuner/receiver" },
787 { 0x02, "Speakers" },
788 { 0x03, "Portable Music Player (PMP)" },
789 { 0x04, "Headset (headphones + microphone)" },
790 { 0x05, "Headphones" },
791 { 0x06, "Microphone" },
792 { 0x07, "Home Theater Systems" },
793 { 0, NULL }
797 static void
798 add_wps_wfa_ext(guint8 id, proto_tree *tree, tvbuff_t *tvb,
799 int offset, gint size)
801 proto_item *item;
802 proto_tree *elem;
803 guint8 val8;
805 item = proto_tree_add_text(tree, tvb, offset - 2, 2 + size, "%s",
806 val_to_str(id, eapwps_wfa_ext_types,
807 "Unknown (%u)"));
808 elem = proto_item_add_subtree(item, ett_wps_wfa_ext);
809 proto_tree_add_item(elem, hf_eapwps_wfa_ext_id, tvb, offset - 2, 1, ENC_BIG_ENDIAN);
810 proto_tree_add_item(elem, hf_eapwps_wfa_ext_len, tvb, offset - 1, 1, ENC_BIG_ENDIAN);
812 switch (id) {
813 case WPS_WFA_EXT_VERSION2:
814 val8 = tvb_get_guint8(tvb, offset);
815 proto_item_append_text(item, ": %d.%d", val8 >> 4, val8 & 0x0f);
816 proto_tree_add_item(elem, hf_eapwps_wfa_ext_version2, tvb,
817 offset, 1, ENC_BIG_ENDIAN);
818 break;
819 case WPS_WFA_EXT_AUTHORIZEDMACS:
820 proto_tree_add_item(elem, hf_eapwps_wfa_ext_authorizedmacs,
821 tvb, offset, size, ENC_NA);
822 break;
823 case WPS_WFA_EXT_NETWORK_KEY_SHAREABLE:
824 val8 = tvb_get_guint8(tvb, offset);
825 proto_item_append_text(item, ": %s", val8 ? "TRUE" : "FALSE");
826 proto_tree_add_item(elem, hf_eapwps_wfa_ext_network_key_shareable,
827 tvb, offset, 1, ENC_BIG_ENDIAN);
828 break;
829 case WPS_WFA_EXT_REQUEST_TO_ENROLL:
830 val8 = tvb_get_guint8(tvb, offset);
831 proto_item_append_text(item, ": %s", val8 ? "TRUE" : "FALSE");
832 proto_tree_add_item(elem, hf_eapwps_wfa_ext_request_to_enroll,
833 tvb, offset, 1, ENC_BIG_ENDIAN);
834 break;
835 case WPS_WFA_EXT_SETTINGS_DELAY_TIME:
836 val8 = tvb_get_guint8(tvb, offset);
837 proto_item_append_text(item, ": %d second(s)", val8);
838 proto_tree_add_item(elem, hf_eapwps_wfa_ext_settings_delay_time,
839 tvb, offset, 1, ENC_BIG_ENDIAN);
840 break;
841 default:
842 break;
846 static void
847 dissect_wps_wfa_ext(proto_tree *tree, tvbuff_t *tvb,
848 int offset, gint size)
850 int pos = offset;
851 int end = offset + size;
852 guint8 id, len;
854 while (pos + 2 < end) {
855 id = tvb_get_guint8(tvb, pos);
856 len = tvb_get_guint8(tvb, pos + 1);
857 if ((pos + 2 + len) > end)
858 break;
859 pos += 2;
860 add_wps_wfa_ext(id, tree, tvb, pos, len);
861 pos += len;
865 static void
866 dissect_wps_vendor_ext(proto_tree *tree, tvbuff_t *tvb,
867 int offset, gint size)
869 guint32 vendor_id;
871 if (size < 3)
872 return;
873 vendor_id = tvb_get_ntoh24(tvb, offset);
874 proto_tree_add_item(tree, hf_eapwps_vendor_id, tvb, offset, 3, ENC_BIG_ENDIAN);
875 if (vendor_id == VENDOR_WIFI_ALLIANCE)
876 dissect_wps_wfa_ext(tree, tvb, offset + 3, size - 3);
879 /* ********************************************************************** */
880 /* pinfo may be NULL ! */
881 /* ********************************************************************** */
882 void
883 dissect_wps_tlvs(proto_tree *eap_tree, tvbuff_t *tvb, int offset,
884 gint size, packet_info *pinfo)
886 static const char *fmt_warn_too_long = "Value too long (max. %d)";
887 static const char *fmt_length_warn = "Value length not %d";
889 guint tlv_len;
890 guint16 tlv_type;
892 proto_item *tlv_item = NULL; /* the root item */
893 proto_tree *tlv_root = NULL;
894 proto_item *tmp_item = NULL;
896 int hfindex = -1;
898 while(size > 0) {
900 /* incomplete tlv-entry case */
901 if (size < 4) {
902 if ((tmp_item != NULL) && pinfo)
903 expert_add_info(pinfo, tmp_item, &ei_eapwps_packet_too_short);
904 break;
907 tlv_item = NULL;
908 tlv_root = NULL;
909 tmp_item = NULL;
911 tlv_type = tvb_get_ntohs(tvb, offset);
912 tlv_len = tvb_get_ntohs(tvb, offset+2);
914 /* TOP Node for each TLV-item */
915 tlv_item = proto_tree_add_text(eap_tree, tvb, offset, tlv_len+4, "Unknown Type (0x%04x)", tlv_type);
916 tlv_root = proto_item_add_subtree(tlv_item, ett_wps_tlv);
918 /* analog to Tagged parameters in 802.11 */
919 proto_tree_add_item(tlv_root, hf_eapwps_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN);
920 proto_tree_add_item(tlv_root, hf_eapwps_tlv_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
922 switch(tlv_type) {
923 case WPS_TLV_TYPE_AP_CHANNEL:
924 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_ap_channel, tvb, offset+4, 2, ENC_BIG_ENDIAN);
925 hfindex = hf_eapwps_tlv_ap_channel;
927 break;
929 case WPS_TLV_TYPE_ASSOCIATION_STATE:
930 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_association_state, tvb, offset+4, 2, ENC_BIG_ENDIAN);
931 hfindex = hf_eapwps_tlv_association_state;
933 break;
935 case WPS_TLV_TYPE_AUTHENTICATION_TYPE:
936 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type, tvb, offset+4, 2, ENC_BIG_ENDIAN);
937 hfindex = hf_eapwps_tlv_authentication_type;
939 break;
941 case WPS_TLV_TYPE_AUTHENTICATION_TYPE_FLAGS:
942 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags, tvb, offset+4, 2, ENC_BIG_ENDIAN);
943 hfindex = hf_eapwps_tlv_authentication_type_flags;
945 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_open, tvb, offset+4, 2, ENC_BIG_ENDIAN);
946 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_wpapsk, tvb, offset+4, 2, ENC_BIG_ENDIAN);
947 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_shared, tvb, offset+4, 2, ENC_BIG_ENDIAN);
948 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_wpa, tvb, offset+4, 2, ENC_BIG_ENDIAN);
949 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_wpa2, tvb, offset+4, 2, ENC_BIG_ENDIAN);
950 proto_tree_add_item(tlv_root, hf_eapwps_tlv_authentication_type_flags_wpa2psk, tvb, offset+4, 2, ENC_BIG_ENDIAN);
952 break;
954 case WPS_TLV_TYPE_AUTHENTICATOR:
955 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_authenticator, tvb, offset+4, 8, ENC_NA);
956 hfindex = hf_eapwps_tlv_authenticator;
958 proto_item_append_text(tmp_item, " (1st 64 bits of HMAC)");
959 break;
961 case WPS_TLV_TYPE_CONFIG_METHODS:
962 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods, tvb, offset+4, 2, ENC_BIG_ENDIAN);
963 hfindex = hf_eapwps_tlv_config_methods;
965 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_usba, tvb, offset+4, 2, ENC_BIG_ENDIAN);
966 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_ethernet, tvb, offset+4, 2, ENC_BIG_ENDIAN);
967 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_label, tvb, offset+4, 2, ENC_BIG_ENDIAN);
968 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
969 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_virt_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
970 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_phy_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
971 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_nfcext, tvb, offset+4, 2, ENC_BIG_ENDIAN);
972 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_nfcint, tvb, offset+4, 2, ENC_BIG_ENDIAN);
973 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_nfcinf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
974 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
975 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_virt_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
976 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_phy_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
977 proto_tree_add_item(tlv_root, hf_eapwps_tlv_config_methods_keypad, tvb, offset+4, 2, ENC_BIG_ENDIAN);
979 break;
981 case WPS_TLV_TYPE_CONFIGURATION_ERROR:
982 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_configuration_error, tvb, offset+4, 2, ENC_BIG_ENDIAN);
983 hfindex = hf_eapwps_tlv_configuration_error;
985 break;
987 case WPS_TLV_TYPE_CONFIRMATION_URL4: /* max len is 64 */
988 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_confirmation_url4, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
989 hfindex = hf_eapwps_tlv_confirmation_url4;
990 if (tlv_len > 64)
991 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
993 break;
995 case WPS_TLV_TYPE_CONFIRMATION_URL6: /* max len is 76 */
996 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_confirmation_url6, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
997 hfindex = hf_eapwps_tlv_confirmation_url6;
998 if (tlv_len > 76)
999 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1001 break;
1003 case WPS_TLV_TYPE_CONNECTION_TYPE:
1004 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_connection_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1005 hfindex = hf_eapwps_tlv_connection_type;
1007 break;
1009 case WPS_TLV_TYPE_CONNECTION_TYPE_FLAGS:
1010 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_connection_type_flags, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1011 hfindex = hf_eapwps_tlv_connection_type_flags;
1013 proto_tree_add_item(tlv_root, hf_eapwps_tlv_connection_type_flags_ess, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1014 proto_tree_add_item(tlv_root, hf_eapwps_tlv_connection_type_flags_ibss, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1016 break;
1018 case WPS_TLV_TYPE_CREDENTIAL:
1019 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_credential, tvb, offset+4, tlv_len, ENC_NA);
1020 hfindex = hf_eapwps_tlv_credential;
1022 break;
1024 case WPS_TLV_TYPE_DEVICE_NAME: /* len <= 32, check ! */
1025 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_device_name, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1026 hfindex = hf_eapwps_tlv_device_name;
1027 if ((tlv_len > 32) && pinfo)
1028 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1030 break;
1032 case WPS_TLV_TYPE_DEVICE_PASSWORD_ID:
1033 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_device_password_id, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1034 hfindex = hf_eapwps_tlv_device_password_id;
1036 break;
1038 case WPS_TLV_TYPE_E_HASH1:
1039 /* assert tlv_len == 32 */
1040 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_hash1, tvb, offset+4, 32, ENC_NA);
1041 hfindex = hf_eapwps_tlv_e_hash1;
1042 if ((tlv_len != 32) && pinfo)
1043 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 32);
1045 break;
1047 case WPS_TLV_TYPE_E_HASH2:
1048 /* assert tlv_len == 32 */
1049 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_hash2, tvb, offset+4, 32, ENC_NA);
1050 hfindex = hf_eapwps_tlv_e_hash2;
1051 if ((tlv_len != 32) && pinfo)
1052 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 32);
1054 break;
1056 case WPS_TLV_TYPE_E_SNONCE1:
1057 /* assert tlv_len == 16 */
1058 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_snonce1, tvb, offset+4, 16, ENC_NA);
1059 hfindex = hf_eapwps_tlv_e_snonce1;
1060 if ((tlv_len != 16) && pinfo)
1061 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16);
1063 break;
1065 case WPS_TLV_TYPE_E_SNONCE2:
1066 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_e_snonce2, tvb, offset+4, 16, ENC_NA);
1067 hfindex = hf_eapwps_tlv_e_snonce2;
1068 if ((tlv_len != 16) && pinfo)
1069 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16);
1071 break;
1073 case WPS_TLV_TYPE_ENCRYPTED_SETTINGS:
1074 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_encrypted_settings, tvb, offset+4, tlv_len, ENC_NA);
1075 hfindex = hf_eapwps_tlv_encrypted_settings;
1077 break;
1079 case WPS_TLV_TYPE_ENCRYPTION_TYPE:
1080 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1081 hfindex = hf_eapwps_tlv_encryption_type;
1083 break;
1085 case WPS_TLV_TYPE_ENCRYPTION_TYPE_FLAGS:
1086 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type_flags, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1087 hfindex = hf_eapwps_tlv_encryption_type_flags;
1089 proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type_flags_none, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1090 proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type_flags_wep, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1091 proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type_flags_tkip, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1092 proto_tree_add_item(tlv_root, hf_eapwps_tlv_encryption_type_flags_aes, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1094 break;
1096 case WPS_TLV_TYPE_ENROLLEE_NONCE:
1097 /* assert tlv_len == 16 */
1098 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_enrollee_nonce, tvb, offset+4, 16, ENC_NA);
1099 hfindex = hf_eapwps_tlv_enrollee_nonce;
1100 if ((tlv_len != 16) && pinfo)
1101 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 16);
1103 break;
1105 case WPS_TLV_TYPE_FEATURE_ID:
1106 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_feature_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1107 hfindex = hf_eapwps_tlv_feature_id;
1109 break;
1111 case WPS_TLV_TYPE_IDENTITY:
1112 /* check that tlv_len <= 80 */
1113 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_identity, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1114 hfindex = hf_eapwps_tlv_identity;
1115 if ((tlv_len > 80) && pinfo)
1116 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1118 break;
1120 case WPS_TLV_TYPE_IDENTITY_PROOF:
1121 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_identity_proof, tvb, offset+4, tlv_len, ENC_NA);
1122 hfindex = hf_eapwps_tlv_identity_proof;
1124 break;
1126 case WPS_TLV_TYPE_KEY_WRAP_AUTHENTICATOR:
1127 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_key_wrap_authenticator, tvb, offset+4, 8, ENC_NA);
1128 hfindex = hf_eapwps_tlv_key_wrap_authenticator;
1130 break;
1132 case WPS_TLV_TYPE_KEY_IDENTIFIER:
1133 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_key_identifier, tvb, offset+4, 16, ENC_NA);
1134 hfindex = hf_eapwps_tlv_key_identifier;
1136 break;
1138 case WPS_TLV_TYPE_MAC_ADDRESS:
1139 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_mac_address, tvb, offset+4, 6, ENC_NA);
1140 hfindex = hf_eapwps_tlv_mac_address;
1142 break;
1144 case WPS_TLV_TYPE_MANUFACTURER:
1145 /* check tlv_len <= 64 byte */
1146 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_manufacturer, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1147 hfindex = hf_eapwps_tlv_manufacturer;
1148 if ((tlv_len > 64) && pinfo)
1149 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1151 break;
1153 case WPS_TLV_TYPE_MESSAGE_TYPE:
1154 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_message_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1155 hfindex = hf_eapwps_tlv_message_type;
1156 if ((pinfo != NULL))
1157 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_guint8(tvb, offset+4),
1158 eapwps_tlv_message_type_vals,
1159 "Unknown (0x%02x)"));
1160 break;
1162 case WPS_TLV_TYPE_MODEL_NAME:
1163 /* check tlv_len <= 32 byte */
1164 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_model_name, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1165 hfindex = hf_eapwps_tlv_model_name;
1166 if ((tlv_len > 32) && pinfo)
1167 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1169 break;
1171 case WPS_TLV_TYPE_MODEL_NUMBER:
1172 /* check tlv_len <= 32 byte */
1173 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_model_number, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1174 hfindex = hf_eapwps_tlv_model_number;
1175 if ((tlv_len > 32) && pinfo)
1176 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1178 break;
1180 case WPS_TLV_TYPE_NETWORK_INDEX:
1181 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_network_index, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1182 hfindex = hf_eapwps_tlv_network_index;
1184 break;
1186 case WPS_TLV_TYPE_NETWORK_KEY:
1187 /* check tlv_len <= 64 byte */
1188 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_network_key, tvb, offset+4, tlv_len, ENC_NA);
1189 hfindex = hf_eapwps_tlv_network_key;
1190 if ((tlv_len > 64) && pinfo)
1191 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1193 break;
1195 case WPS_TLV_TYPE_NETWORK_KEY_INDEX:
1196 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_network_key_index, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1197 hfindex = hf_eapwps_tlv_network_key_index;
1199 break;
1201 case WPS_TLV_TYPE_NEW_DEVICE_NAME:
1202 /* check tlv_len <= 32 byte */
1203 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_new_device_name, tvb, offset+4, tlv_len, ENC_NA);
1204 hfindex = hf_eapwps_tlv_new_device_name;
1205 if ((tlv_len > 32) && pinfo)
1206 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1208 break;
1210 case WPS_TLV_TYPE_NEW_PASSWORD:
1211 /* check tlv_len <= 64 byte */
1212 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_new_password, tvb, offset+4, tlv_len, ENC_NA);
1213 hfindex = hf_eapwps_tlv_new_password;
1214 if ((tlv_len > 64) && pinfo)
1215 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1217 break;
1219 case WPS_TLV_TYPE_OOB_DEVICE_PASSWORD:
1220 /* check tlv_len <= 56 byte */
1221 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_oob_device_password, tvb, offset+4, tlv_len, ENC_NA);
1222 hfindex = hf_eapwps_tlv_oob_device_password;
1223 if ((tlv_len > 56) && pinfo)
1224 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1226 break;
1228 case WPS_TLV_TYPE_OS_VERSION:
1229 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_os_version, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1230 hfindex = hf_eapwps_tlv_os_version;
1232 break;
1234 case WPS_TLV_TYPE_POWER_LEVEL:
1235 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_power_level, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1236 hfindex = hf_eapwps_tlv_power_level;
1238 break;
1240 case WPS_TLV_TYPE_PSK_CURRENT:
1241 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_psk_current, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1242 hfindex = hf_eapwps_tlv_psk_current;
1244 break;
1246 case WPS_TLV_TYPE_PSK_MAX:
1247 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_psk_max, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1248 hfindex = hf_eapwps_tlv_psk_max;
1250 break;
1252 case WPS_TLV_TYPE_PUBLIC_KEY:
1253 /* check tlv_len == 192 byte */
1254 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_public_key, tvb, offset+4, 192, ENC_NA);
1255 hfindex = hf_eapwps_tlv_public_key;
1256 if ((tlv_len != 192) && pinfo)
1257 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_length_warn, fmt_length_warn, 192);
1259 break;
1261 case WPS_TLV_TYPE_RADIO_ENABLED:
1262 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_radio_enabled, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1263 hfindex = hf_eapwps_tlv_radio_enabled;
1265 break;
1267 case WPS_TLV_TYPE_REBOOT:
1268 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_reboot, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1269 hfindex = hf_eapwps_tlv_reboot;
1271 break;
1273 case WPS_TLV_TYPE_REGISTRAR_CURRENT:
1274 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_registrar_current, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1275 hfindex = hf_eapwps_tlv_registrar_current;
1277 break;
1279 case WPS_TLV_TYPE_REGISTRAR_ESTABLISHED:
1280 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_registrar_established, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1281 hfindex = hf_eapwps_tlv_registrar_established;
1283 break;
1285 case WPS_TLV_TYPE_REGISTRAR_LIST:
1286 /* NYI: list is */
1287 /* - 16 bytes uuid */
1288 /* - NULL-Terminated device name string */
1289 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_registrar_list, tvb, offset+4, tlv_len, ENC_NA);
1290 hfindex = hf_eapwps_tlv_registrar_list;
1292 break;
1294 case WPS_TLV_TYPE_REGISTRAR_MAX:
1295 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_registrar_max, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1296 hfindex = hf_eapwps_tlv_registrar_max;
1298 break;
1300 case WPS_TLV_TYPE_REGISTRAR_NONCE:
1301 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_registrar_nonce, tvb, offset+4, 16, ENC_NA);
1302 hfindex = hf_eapwps_tlv_registrar_nonce;
1304 break;
1306 case WPS_TLV_TYPE_REQUEST_TYPE:
1307 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_request_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1308 hfindex = hf_eapwps_tlv_request_type;
1310 break;
1312 case WPS_TLV_TYPE_RESPONSE_TYPE:
1313 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_response_type, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1314 hfindex = hf_eapwps_tlv_response_type;
1316 break;
1318 case WPS_TLV_TYPE_RF_BANDS:
1319 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_rf_bands, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1320 hfindex = hf_eapwps_tlv_rf_bands;
1322 break;
1324 case WPS_TLV_TYPE_R_HASH1:
1325 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_r_hash1, tvb, offset+4, 32, ENC_NA);
1326 hfindex = hf_eapwps_tlv_r_hash1;
1328 break;
1330 case WPS_TLV_TYPE_R_HASH2:
1331 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_r_hash2, tvb, offset+4, 32, ENC_NA);
1332 hfindex = hf_eapwps_tlv_r_hash2;
1334 break;
1336 case WPS_TLV_TYPE_R_SNONCE1:
1337 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_r_snonce1, tvb, offset+4, 16, ENC_NA);
1338 hfindex = hf_eapwps_tlv_r_snonce1;
1340 break;
1342 case WPS_TLV_TYPE_R_SNONCE2:
1343 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_r_snonce2, tvb, offset+4, 16, ENC_NA);
1344 hfindex = hf_eapwps_tlv_r_snonce2;
1346 break;
1348 case WPS_TLV_TYPE_SELECTED_REGISTRAR:
1349 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1350 hfindex = hf_eapwps_tlv_selected_registrar;
1352 break;
1354 case WPS_TLV_TYPE_SERIAL_NUMBER:
1355 /* check tlv_len <= 32 bytes */
1356 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_serial_number, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1357 hfindex = hf_eapwps_tlv_serial_number;
1358 if ((tlv_len > 32) && pinfo)
1359 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1361 break;
1363 case WPS_TLV_TYPE_WIFI_PROTECTED_SETUP_STATE:
1364 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_wifi_protected_setup_state, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1365 hfindex = hf_eapwps_tlv_wifi_protected_setup_state;
1367 break;
1369 case WPS_TLV_TYPE_SSID:
1370 /* check tlv_len <= 32 bytes */
1371 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_ssid, tvb, offset+4, tlv_len, ENC_ASCII|ENC_NA);
1372 hfindex = hf_eapwps_tlv_ssid;
1373 if ((tlv_len > 32) && pinfo)
1374 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1376 break;
1378 case WPS_TLV_TYPE_TOTAL_NETWORKS:
1379 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_total_networks, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1380 hfindex = hf_eapwps_tlv_total_networks;
1382 break;
1384 case WPS_TLV_TYPE_UUID_E:
1385 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_uuid_e, tvb, offset+4, tlv_len, ENC_NA);
1386 hfindex = hf_eapwps_tlv_uuid_e;
1387 if ((tlv_len > 16) && pinfo)
1388 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1390 break;
1392 case WPS_TLV_TYPE_UUID_R:
1393 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_uuid_r, tvb, offset+4, tlv_len, ENC_NA);
1394 hfindex = hf_eapwps_tlv_uuid_r;
1395 if ((tlv_len > 16) && pinfo)
1396 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1398 break;
1400 case WPS_TLV_TYPE_VENDOR_EXTENSION:
1401 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_vendor_extension, tvb, offset+4, tlv_len, ENC_NA);
1402 hfindex = hf_eapwps_tlv_vendor_extension;
1404 break;
1406 case WPS_TLV_TYPE_VERSION:
1407 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_version, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1408 hfindex = hf_eapwps_tlv_version;
1410 break;
1412 case WPS_TLV_TYPE_X509_CERTIFICATE_REQUEST:
1413 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_x509_certificate_request, tvb, offset+4, tlv_len, ENC_NA);
1414 hfindex = hf_eapwps_tlv_x509_certificate_request;
1416 break;
1418 case WPS_TLV_TYPE_X509_CERTIFICATE:
1419 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_x509_certificate, tvb, offset+4, tlv_len, ENC_NA);
1420 hfindex = hf_eapwps_tlv_x509_certificate;
1422 break;
1424 case WPS_TLV_TYPE_EAP_IDENTITY:
1425 /* check tlv_len <= 64 byte */
1426 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_eap_identity, tvb, offset+4, tlv_len, ENC_NA);
1427 hfindex = hf_eapwps_tlv_eap_identity;
1428 if ((tlv_len > 64) && pinfo)
1429 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1431 break;
1433 case WPS_TLV_TYPE_MESSAGE_COUNTER:
1434 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_message_counter, tvb, offset+4, 8, ENC_BIG_ENDIAN);
1435 hfindex = hf_eapwps_tlv_message_counter;
1437 break;
1439 case WPS_TLV_TYPE_PUBLIC_KEY_HASH:
1440 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_public_key_hash, tvb, offset+4, 20, ENC_NA);
1441 hfindex = hf_eapwps_tlv_public_key_hash;
1443 break;
1445 case WPS_TLV_TYPE_REKEY_KEY:
1446 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_rekey_key, tvb, offset+4, 32, ENC_NA);
1447 hfindex = hf_eapwps_tlv_rekey_key;
1449 break;
1451 case WPS_TLV_TYPE_KEY_LIFETIME:
1452 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_key_lifetime, tvb, offset+4, 4, ENC_BIG_ENDIAN);
1453 hfindex = hf_eapwps_tlv_key_lifetime;
1455 break;
1457 case WPS_TLV_TYPE_PERMITTED_CONFIG_METHODS:
1458 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1459 hfindex = hf_eapwps_tlv_permitted_config_methods;
1461 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_usba, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1462 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_ethernet, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1463 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_label, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1464 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1465 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_virt_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1466 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_phy_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1467 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_nfcext, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1468 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_nfcint, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1469 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_nfcinf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1470 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1471 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_virt_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1472 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_phy_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1473 proto_tree_add_item(tlv_root, hf_eapwps_tlv_permitted_config_methods_keypad, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1475 break;
1477 case WPS_TLV_TYPE_SELECTED_REGISTRAR_CONFIG_METHODS:
1478 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1479 hfindex = hf_eapwps_tlv_selected_registrar_config_methods;
1481 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_usba, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1482 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_ethernet, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1483 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_label, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1484 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1485 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_virt_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1486 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_phy_display, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1487 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_nfcext, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1488 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_nfcint, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1489 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_nfcinf, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1490 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1491 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_virt_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1492 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_phy_pushbutton, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1493 proto_tree_add_item(tlv_root, hf_eapwps_tlv_selected_registrar_config_methods_keypad, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1495 break;
1497 case WPS_TLV_TYPE_PRIMARY_DEVICE_TYPE:
1498 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_primary_device_type, tvb, offset+4, 8, ENC_NA);
1499 hfindex = hf_eapwps_tlv_primary_device_type;
1500 if (tvb_get_ntohl(tvb, offset+6) == WFA_OUI) {
1501 guint16 dev_cat = tvb_get_ntohs(tvb, offset+4);
1502 if ((dev_cat > 0) && (dev_cat <= WPS_DEVICE_TYPE_CATEGORY_MAX)) {
1503 proto_tree_add_item(tlv_root, hf_eapwps_tlv_primary_device_type_category, tvb, offset+4, 2, ENC_BIG_ENDIAN);
1504 proto_tree_add_item(tlv_root, hf_eapwps_tlv_primary_device_type_subcategory[dev_cat-1], tvb, offset+10, 2, ENC_BIG_ENDIAN);
1508 break;
1510 case WPS_TLV_TYPE_SECONDARY_DEVICE_TYPE_LIST:
1511 /* check tlv_len <= 128 byte */
1512 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_secondary_device_type_list, tvb, offset+4, tlv_len, ENC_NA);
1513 hfindex = hf_eapwps_tlv_secondary_device_type_list;
1514 if ((tlv_len > 128) && pinfo)
1515 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1517 break;
1519 case WPS_TLV_TYPE_PORTABLE_DEVICE:
1520 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_portable_device, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1521 hfindex = hf_eapwps_tlv_portable_device;
1523 break;
1525 case WPS_TLV_TYPE_AP_SETUP_LOCKED:
1526 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_ap_setup_locked, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1527 hfindex = hf_eapwps_tlv_ap_setup_locked;
1529 break;
1531 case WPS_TLV_TYPE_APPLICATION_EXTENSION:
1532 /* check tlv_len <= 512 byte */
1533 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_application_extension, tvb, offset+4, tlv_len, ENC_NA);
1534 hfindex = hf_eapwps_tlv_application_extension;
1535 if ((tlv_len > 512) && pinfo)
1536 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1538 break;
1540 case WPS_TLV_TYPE_EAP_TYPE:
1541 /* check tlv_len <= 8 byte */
1542 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_eap_type, tvb, offset+4, tlv_len, ENC_NA);
1543 hfindex = hf_eapwps_tlv_eap_type;
1544 if ((tlv_len > 8) && pinfo)
1545 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1547 break;
1549 case WPS_TLV_TYPE_INITIALIZATION_VECTOR:
1550 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_initialization_vector, tvb, offset+4, 32, ENC_NA);
1551 hfindex = hf_eapwps_tlv_initialization_vector;
1553 break;
1555 case WPS_TLV_TYPE_KEY_PROVIDED_AUTOMATICALLY:
1556 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_key_provided_automatically, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1557 hfindex = hf_eapwps_tlv_key_provided_automatically;
1559 break;
1561 case WPS_TLV_TYPE_8021X_ENABLED:
1562 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_8021x_enabled, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1563 hfindex = hf_eapwps_tlv_8021x_enabled;
1565 break;
1567 case WPS_TLV_TYPE_APPSESSIONKEY:
1568 /* check tlv_len <= 128 byte */
1569 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_appsessionkey, tvb, offset+4, tlv_len, ENC_NA);
1570 hfindex = hf_eapwps_tlv_appsessionkey;
1571 if ((tlv_len > 128) && pinfo)
1572 expert_add_info_format(pinfo, tmp_item, &ei_eapwps_fmt_warn_too_long, fmt_warn_too_long, tlv_len);
1574 break;
1576 case WPS_TLV_TYPE_WEPTRANSMITKEY:
1577 tmp_item = proto_tree_add_item(tlv_root, hf_eapwps_tlv_weptransmitkey, tvb, offset+4, 1, ENC_BIG_ENDIAN);
1578 hfindex = hf_eapwps_tlv_weptransmitkey;
1580 break;
1582 case WPS_TLV_TYPE_REQUESTED_DEV_TYPE:
1583 tmp_item = proto_tree_add_item(tlv_root,
1584 hf_eapwps_tlv_requested_dev_type, tvb,
1585 offset + 4, 8, ENC_NA);
1586 hfindex = hf_eapwps_tlv_requested_dev_type;
1587 break;
1589 default:
1590 /* do something useful ? */
1591 tmp_item = NULL;
1592 hfindex = -1;
1595 if ((tmp_item != NULL) && (tlv_item != NULL)) {
1596 /* make the tree look nicer :-)
1597 tmp_item -> a proto_item specific to the _value_
1598 tlv_item -> root-item grouping
1599 - "Data Element Type"
1600 - "Date Element Length"
1601 - tmp_item */
1602 guint32 value = -1;
1603 void *valuep = NULL;
1604 header_field_info *hf_info = NULL;
1605 const char *fmt = NULL;
1607 proto_item_set_text(tlv_item, "%s",
1608 val_to_str(tlv_type, eapwps_tlv_types, "Unknown (0x%04x)"));
1610 /* Rendered strings for value. Thanks to Stig Bjorlykke */
1611 hf_info = proto_registrar_get_nth(hfindex);
1612 if (hf_info != NULL) {
1613 switch(hf_info->type) {
1614 case FT_UINT8:
1615 fmt = hf_info->strings ? ": %s (0x%02x)": ": 0x%02x";
1616 value = tvb_get_guint8 (tvb, offset+4);
1617 break;
1618 case FT_UINT16:
1619 fmt = hf_info->strings ? ": %s (0x%04x)": ": 0x%04x";
1620 value = tvb_get_ntohs (tvb, offset+4);
1621 break;
1622 case FT_UINT32:
1623 fmt = hf_info->strings ? ": %s (0x%08x)": ": 0x%08x";
1624 value = tvb_get_ntohl (tvb, offset+4);
1625 break;
1626 case FT_STRING:
1627 fmt = ": %s";
1628 valuep = tvb_get_string(wmem_packet_scope(), tvb, offset+4, tlv_len);
1629 break;
1630 default:
1631 /* make compiler happy */
1632 break;
1636 if ((hf_info != NULL) && hf_info->strings) {
1637 /* item has value_string */
1638 proto_item_append_text(tlv_item, fmt, val_to_str(value,
1639 (value_string *)hf_info->strings,
1640 "Unknown: %d"), value);
1641 } else if (valuep != NULL) {
1642 /* the string-case */
1643 proto_item_append_text(tlv_item, fmt, valuep);
1644 } else if (fmt != NULL) {
1645 /* field is FT_UINT(8|16|32) but has no value_string */
1646 proto_item_append_text(tlv_item, fmt, value);
1647 } else {
1648 /* field is either FT_ETHER or FT_BYTES, don't do anything */
1653 if (tlv_type == WPS_TLV_TYPE_VENDOR_EXTENSION)
1654 dissect_wps_vendor_ext(tlv_root, tvb, offset + 4, tlv_len);
1656 offset += tlv_len + 2 + 2;
1657 size -= tlv_len + 2 + 2;
1661 /********************************************************************** */
1662 /********************************************************************** */
1663 void
1664 dissect_exteap_wps(proto_tree *eap_tree, tvbuff_t *tvb, int offset,
1665 gint size, packet_info *pinfo)
1667 proto_item *pi;
1668 proto_tree *pt;
1669 guint8 flags;
1671 pi = proto_tree_add_item(eap_tree, hf_eapwps_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
1672 offset += 1; size -= 1;
1674 pi = proto_item_get_parent(pi);
1675 if (pi != NULL)
1676 proto_item_append_text(pi, " (Wifi Alliance, WifiProtectedSetup)");
1677 if (pinfo != NULL)
1678 col_append_str(pinfo->cinfo, COL_INFO, ", WPS");
1681 /* Flag field, if msg-len flag set, add approriate field */
1682 flags = tvb_get_guint8(tvb,offset);
1683 pi = proto_tree_add_item(eap_tree, hf_eapwps_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
1684 pt = proto_item_add_subtree(pi, ett_eap_wps_flags);
1686 proto_tree_add_item(pt, hf_eapwps_flag_mf, tvb, offset, 1, ENC_BIG_ENDIAN);
1687 proto_tree_add_item(pt, hf_eapwps_flag_lf, tvb, offset, 1, ENC_BIG_ENDIAN);
1688 offset += 1; size -= 1;
1690 if (flags & MASK_WSC_FLAG_LF) {
1691 /* length field is present in first eap-packet when msg is fragmented */
1692 proto_tree_add_item(eap_tree, hf_eapwps_msglen, tvb, offset, 2, ENC_BIG_ENDIAN);
1693 offset += 2; size -= 2;
1696 dissect_wps_tlvs(eap_tree, tvb, offset, size, pinfo);
1699 /********************************************************************** */
1700 /********************************************************************** */
1701 void
1702 proto_register_wps(void)
1704 static hf_register_info hf[] = {
1706 /* These data-elements are sent in EAP-Pakets using expanded types */
1707 /* (see RFC3748 Section 5.7) */
1708 /* Paket dissections is done here and not in (packet-eap) as */
1709 /* both (tlvs and fields named eap.wps.*) are defined by */
1710 /* WifiAlliance */
1711 { &hf_eapwps_opcode,
1712 { "Opcode", "eap.wps.code",
1713 FT_UINT8, BASE_DEC, VALS(eapwps_opcode_vals), 0x0, "WSC Message Type", HFILL }},
1715 { &hf_eapwps_flags,
1716 { "Flags", "eap.wps.flags",
1717 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1719 { &hf_eapwps_flag_mf,
1720 { "More flag", "eap.wps.flags.more",
1721 FT_BOOLEAN, 8, NULL, MASK_WSC_FLAG_MF, NULL, HFILL }},
1723 { &hf_eapwps_flag_lf,
1724 { "Length field present", "eap.wps.flags.length",
1725 FT_BOOLEAN, 8, NULL, MASK_WSC_FLAG_LF, NULL, HFILL }},
1727 { &hf_eapwps_msglen,
1728 { "Length field", "eap.wps.msglen",
1729 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1731 /* TLV encoded data which may be contained in */
1732 /* 802.11 Management frames and EAP-extended type */
1733 { &hf_eapwps_tlv_type,
1734 { "Data Element Type", "wps.type",
1735 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_types), 0x0, NULL, HFILL }},
1737 { &hf_eapwps_tlv_len,
1738 { "Data Element Length", "wps.length",
1739 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1742 { &hf_eapwps_tlv_ap_channel,
1743 { "AP Channel", "wps.ap_channel",
1744 FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
1746 { &hf_eapwps_tlv_association_state,
1747 { "Association State", "wps.association_state",
1748 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_association_state_vals), 0x0, NULL, HFILL }},
1751 { &hf_eapwps_tlv_authentication_type,
1752 { "Authentication Type", "wps.authentication_type",
1753 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_authentication_type_vals), 0x0, NULL, HFILL }},
1755 { &hf_eapwps_tlv_authentication_type_flags,
1756 { "Authentication Type Flags", "wps.authentication_type_flags",
1757 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1759 { &hf_eapwps_tlv_authentication_type_flags_open,
1760 { "Open", "wps.authentication_type.open",
1761 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_OPEN, NULL, HFILL }},
1763 { &hf_eapwps_tlv_authentication_type_flags_wpapsk,
1764 { "WPA PSK", "wps.authentication_type.wpapsk",
1765 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_WPAPSK, NULL, HFILL }},
1767 { &hf_eapwps_tlv_authentication_type_flags_shared,
1768 { "Shared", "wps.authentication_type.shared",
1769 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_SHARED, NULL, HFILL }},
1771 { &hf_eapwps_tlv_authentication_type_flags_wpa,
1772 { "WPA", "wps.authentication_type.wpa",
1773 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_WPA, NULL, HFILL }},
1775 { &hf_eapwps_tlv_authentication_type_flags_wpa2,
1776 { "WPA2", "wps.authentication_type.wpa2",
1777 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_WPA2, NULL, HFILL }},
1779 { &hf_eapwps_tlv_authentication_type_flags_wpa2psk,
1780 { "WPA2PSK", "wps.authentication_type.wpa2psk",
1781 FT_UINT16, BASE_HEX, NULL, EAPWPS_AUTHTYPE_WPA2PSK, NULL, HFILL }},
1784 { &hf_eapwps_tlv_authenticator,
1785 { "Authenticator", "wps.authenticator",
1786 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1789 { &hf_eapwps_tlv_config_methods,
1790 { "Configuration Methods", "wps.config_methods",
1791 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1793 { &hf_eapwps_tlv_config_methods_usba,
1794 { "USB", "wps.config_methods.usba",
1795 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_USBA, NULL, HFILL }},
1797 { &hf_eapwps_tlv_config_methods_ethernet,
1798 { "Ethernet", "wps.config_methods.ethernet",
1799 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_ETHERNET, NULL, HFILL }},
1801 { &hf_eapwps_tlv_config_methods_label,
1802 { "Label", "wps.config_methods.label",
1803 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_LABEL, NULL, HFILL }},
1805 { &hf_eapwps_tlv_config_methods_display,
1806 { "Display", "wps.config_methods.display",
1807 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_DISPLAY, NULL, HFILL }},
1809 { &hf_eapwps_tlv_config_methods_virt_display,
1810 { "Virtual Display", "wps.config_methods.virt_display",
1811 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_DISPLAY, NULL, HFILL }},
1813 { &hf_eapwps_tlv_config_methods_phy_display,
1814 { "Physical Display", "wps.config_methods.phy_display",
1815 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_DISPLAY, NULL, HFILL }},
1817 { &hf_eapwps_tlv_config_methods_nfcext,
1818 { "External NFC", "wps.config_methods.nfcext",
1819 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCEXT, NULL, HFILL }},
1821 { &hf_eapwps_tlv_config_methods_nfcint,
1822 { "Internal NFC", "wps.config_methods.nfcint",
1823 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINT, NULL, HFILL }},
1825 { &hf_eapwps_tlv_config_methods_nfcinf,
1826 { "NFC Interface", "wps.config_methods.nfcinf",
1827 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINF, NULL, HFILL }},
1829 { &hf_eapwps_tlv_config_methods_pushbutton,
1830 { "Push Button", "wps.config_methods.pushbutton",
1831 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PUSHBUTTON, NULL, HFILL }},
1833 { &hf_eapwps_tlv_config_methods_virt_pushbutton,
1834 { "Virtual Push Button", "wps.config_methods.virt_pushbutton",
1835 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_PUSHBUTTON, NULL, HFILL }},
1837 { &hf_eapwps_tlv_config_methods_phy_pushbutton,
1838 { "Physical Push Button", "wps.config_methods.phy_pushbutton",
1839 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_PUSHBUTTON, NULL, HFILL }},
1841 { &hf_eapwps_tlv_config_methods_keypad,
1842 { "Keypad", "wps.config_methods.keypad",
1843 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_KEYPAD, NULL, HFILL }},
1846 { &hf_eapwps_tlv_configuration_error,
1847 { "Configuration Error", "wps.configuration_error",
1848 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_configuration_error_vals), 0x0, NULL, HFILL }},
1850 { &hf_eapwps_tlv_confirmation_url4,
1851 { "Confirmation URL4", "wps.confirmation_url4",
1852 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1854 { &hf_eapwps_tlv_confirmation_url6,
1855 { "Confirmation URL6", "wps.confirmation_url6",
1856 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1859 { &hf_eapwps_tlv_connection_type,
1860 { "Connection Type", "wps.connection_type",
1861 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1863 { &hf_eapwps_tlv_connection_type_flags,
1864 { "Connection Types", "wps.connection_type_flags",
1865 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_connection_type_vals), 0x0, NULL, HFILL }},
1867 { &hf_eapwps_tlv_connection_type_flags_ess,
1868 { "ESS", "wps.connection_type_flags.ess",
1869 FT_UINT8, BASE_HEX, NULL, EAPWPS_CONNTYPE_ESS, NULL, HFILL }},
1871 { &hf_eapwps_tlv_connection_type_flags_ibss,
1872 { "IBSS", "wps.connection_type_flags.ibss",
1873 FT_UINT8, BASE_HEX, NULL, EAPWPS_CONNTYPE_IBSS, NULL, HFILL }},
1876 { &hf_eapwps_tlv_credential, /* Encrypted */
1877 { "Credential", "wps.credential",
1878 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1881 { &hf_eapwps_tlv_device_name,
1882 { "Device Name", "wps.device_name",
1883 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1885 { &hf_eapwps_tlv_device_password_id,
1886 { "Device Password ID", "wps.device_password_id",
1887 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_device_password_id_vals), 0x0, NULL, HFILL }},
1890 { &hf_eapwps_tlv_e_hash1,
1891 { "Enrollee Hash 1", "wps.e_hash1",
1892 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1894 { &hf_eapwps_tlv_e_hash2,
1895 { "Enrollee Hash 2", "wps.e_hash2",
1896 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1898 { &hf_eapwps_tlv_e_snonce1,
1899 { "Enrollee SNounce 1", "wps.e_snonce1",
1900 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1902 { &hf_eapwps_tlv_e_snonce2,
1903 { "Enrollee SNounce 2", "wps.e_snonce2",
1904 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1907 { &hf_eapwps_tlv_encrypted_settings, /* Encrypted ! */
1908 { "Encrypted Settings", "wps.encrypted_settings",
1909 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1912 { &hf_eapwps_tlv_encryption_type,
1913 { "Encryption Type", "wps.encryption_type",
1914 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_encryption_type_vals), 0x0, NULL, HFILL }},
1916 { &hf_eapwps_tlv_encryption_type_flags,
1917 { "Encryption Type Flags", "wps.encryption_type_flags",
1918 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1920 { &hf_eapwps_tlv_encryption_type_flags_none,
1921 { "None", "wps.encryption_type_flags.none",
1922 FT_UINT16, BASE_HEX, NULL, EAPWPS_ENCTYPE_NONE, NULL, HFILL }},
1924 { &hf_eapwps_tlv_encryption_type_flags_wep,
1925 { "WEP", "wps.encryption_type_flags.wep",
1926 FT_UINT16, BASE_HEX, NULL, EAPWPS_ENCTYPE_WEP, NULL, HFILL }},
1928 { &hf_eapwps_tlv_encryption_type_flags_tkip,
1929 { "TKIP", "wps.encryption_type_flags.tkip",
1930 FT_UINT16, BASE_HEX, NULL, EAPWPS_ENCTYPE_TKIP, NULL, HFILL }},
1932 { &hf_eapwps_tlv_encryption_type_flags_aes,
1933 { "AES", "wps.encryption_type_flags.aes",
1934 FT_UINT16, BASE_HEX, NULL, EAPWPS_ENCTYPE_AES, NULL, HFILL }},
1937 { &hf_eapwps_tlv_enrollee_nonce,
1938 { "Enrollee Nonce", "wps.enrollee_nonce",
1939 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1941 { &hf_eapwps_tlv_feature_id,
1942 { "Feature ID", "wps.feature_id",
1943 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1946 { &hf_eapwps_tlv_identity,
1947 { "Identity", "wps.identity",
1948 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1950 { &hf_eapwps_tlv_identity_proof, /* Encrypted ! */
1951 { "Identity Proof", "wps.identity_proof",
1952 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1955 { &hf_eapwps_tlv_key_wrap_authenticator,
1956 { "Key Wrap Authenticator", "wps.key_wrap_authenticator",
1957 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1959 { &hf_eapwps_tlv_key_identifier,
1960 { "Key Identifier", "wps.key_identifier",
1961 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1964 { &hf_eapwps_tlv_mac_address,
1965 { "MAC", "wps.mac_address",
1966 FT_ETHER, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1968 { &hf_eapwps_tlv_manufacturer,
1969 { "Manufacturer", "wps.manufacturer",
1970 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1972 { &hf_eapwps_tlv_message_type,
1973 { "Message Type", "wps.message_type",
1974 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_message_type_vals), 0x0, NULL, HFILL }},
1977 { &hf_eapwps_tlv_model_name,
1978 { "Model Name", "wps.model_name",
1979 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1981 { &hf_eapwps_tlv_model_number,
1982 { "Model Number", "wps.model_number",
1983 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1986 { &hf_eapwps_tlv_network_index,
1987 { "Network Index", "wps.network_index",
1988 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
1991 { &hf_eapwps_tlv_network_key,
1992 { "Network Key", "wps.network_key",
1993 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
1995 { &hf_eapwps_tlv_network_key_index,
1996 { "Network Key Index", "wps.network_key_index",
1997 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2000 { &hf_eapwps_tlv_new_device_name,
2001 { "New Device Name", "wps.new_device_name",
2002 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2004 { &hf_eapwps_tlv_new_password,
2005 { "New Password", "wps.new_password",
2006 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2008 { &hf_eapwps_tlv_oob_device_password,
2009 { "OOB Device Password", "wps.oob_device_password",
2010 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2013 { &hf_eapwps_tlv_os_version,
2014 { "OS Version", "wps.os_version",
2015 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2017 { &hf_eapwps_tlv_power_level,
2018 { "Power Level", "wps.power_level",
2019 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2022 { &hf_eapwps_tlv_psk_current,
2023 { "PSK Current", "wps.psk_current",
2024 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2026 { &hf_eapwps_tlv_psk_max,
2027 { "PSK Max", "wps.psk_max",
2028 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2031 { &hf_eapwps_tlv_public_key,
2032 { "Public Key", "wps.public_key",
2033 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2035 { &hf_eapwps_tlv_radio_enabled, /* Add info */
2036 { "Radio Enabled", "wps.radio_enabled",
2037 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2038 { &hf_eapwps_tlv_reboot, /* Add info */
2039 { "Reboot", "wps.reboot",
2040 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2042 { &hf_eapwps_tlv_registrar_current,
2043 { "Registrar current", "wps.registrar_current",
2044 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2045 { &hf_eapwps_tlv_registrar_established, /* Add info */
2046 { "Registrar established", "wps.registrar_established",
2047 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2048 { &hf_eapwps_tlv_registrar_list,
2049 { "Registrar list", "wps.registrar_list",
2050 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2051 { &hf_eapwps_tlv_registrar_max,
2052 { "Registrar max", "wps.registrar_max",
2053 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2054 { &hf_eapwps_tlv_registrar_nonce,
2055 { "Registrar Nonce", "wps.registrar_nonce",
2056 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2058 { &hf_eapwps_tlv_request_type,
2059 { "Request Type", "wps.request_type",
2060 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_request_type_vals), 0x0, NULL, HFILL }},
2061 { &hf_eapwps_tlv_response_type,
2062 { "Response Type", "wps.response_type",
2063 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_response_type_vals), 0x0, NULL, HFILL }},
2065 { &hf_eapwps_tlv_rf_bands,
2066 { "RF Bands", "wps.rf_bands",
2067 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_rf_bands_vals), 0x0, NULL, HFILL }},
2070 { &hf_eapwps_tlv_r_hash1,
2071 { "Registrar Hash 1", "wps.r_hash1",
2072 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2074 { &hf_eapwps_tlv_r_hash2,
2075 { "Registrar Hash 2", "wps.r_hash2",
2076 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2078 { &hf_eapwps_tlv_r_snonce1,
2079 { "Registrar Snonce1", "wps.r_snonce1",
2080 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2082 { &hf_eapwps_tlv_r_snonce2,
2083 { "Registrar Snonce 2", "wps.r_snonce2",
2084 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2087 { &hf_eapwps_tlv_selected_registrar,
2088 { "Selected Registrar", "wps.selected_registrar",
2089 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2091 { &hf_eapwps_tlv_serial_number,
2092 { "Serial Number", "wps.serial_number",
2093 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2095 { &hf_eapwps_tlv_wifi_protected_setup_state,
2096 { "Wifi Protected Setup State", "wps.wifi_protected_setup_state",
2097 FT_UINT8, BASE_HEX, VALS(eapwps_tlv_wifi_protected_setup_state), 0x0, NULL, HFILL }},
2099 { &hf_eapwps_tlv_ssid,
2100 { "SSID", "wps.ssid",
2101 FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2103 { &hf_eapwps_tlv_total_networks,
2104 { "Total Networks", "wps.total_networks",
2105 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2108 { &hf_eapwps_tlv_uuid_e,
2109 { "UUID Enrollee", "wps.uuid_e",
2110 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2112 { &hf_eapwps_tlv_uuid_r,
2113 { "UUID Registrar", "wps.uuid_r",
2114 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2117 { &hf_eapwps_tlv_vendor_extension,
2118 { "Vendor Extension", "wps.vendor_extension",
2119 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2121 { &hf_eapwps_tlv_version,
2122 { "Version", "wps.version",
2123 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2125 { &hf_eapwps_tlv_x509_certificate_request,
2126 { "X509 Certificate Request", "wps.x509_certificate_request",
2127 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2128 { &hf_eapwps_tlv_x509_certificate,
2129 { "X509 Certificate", "wps.x509_certificate",
2130 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2132 { &hf_eapwps_tlv_eap_identity,
2133 { "EAP Identity", "wps.eap_identity",
2134 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2136 { &hf_eapwps_tlv_message_counter,
2137 { "Message Counter", "wps.message_counter",
2138 FT_UINT64, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2140 { &hf_eapwps_tlv_public_key_hash,
2141 { "Public Key Hash", "wps.public_key_hash",
2142 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2144 { &hf_eapwps_tlv_rekey_key,
2145 { "Rekey Key", "wps.rekey_key",
2146 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2147 { &hf_eapwps_tlv_key_lifetime,
2148 { "Key Lifetime", "wps.key_lifetime",
2149 FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2151 { &hf_eapwps_tlv_permitted_config_methods,
2152 { "Permitted COnfig Methods", "wps.permitted_config_methods",
2153 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2155 { &hf_eapwps_tlv_permitted_config_methods_usba,
2156 { "USB", "wps.permitted_config_methods.usba",
2157 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_USBA, NULL, HFILL }},
2159 { &hf_eapwps_tlv_permitted_config_methods_ethernet,
2160 { "Ethernet", "wps.permitted_config_methods.ethernet",
2161 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_ETHERNET, NULL, HFILL }},
2163 { &hf_eapwps_tlv_permitted_config_methods_label,
2164 { "Label", "wps.permitted_config_methods.label",
2165 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_LABEL, NULL, HFILL }},
2167 { &hf_eapwps_tlv_permitted_config_methods_display,
2168 { "Display", "wps.permitted_config_methods.display",
2169 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_DISPLAY, NULL, HFILL }},
2171 { &hf_eapwps_tlv_permitted_config_methods_virt_display,
2172 { "Virtual Display", "wps.permitted_config_methods.virt_display",
2173 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_DISPLAY, NULL, HFILL }},
2175 { &hf_eapwps_tlv_permitted_config_methods_phy_display,
2176 { "Physical Display", "wps.permitted_config_methods.phy_display",
2177 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_DISPLAY, NULL, HFILL }},
2179 { &hf_eapwps_tlv_permitted_config_methods_nfcext,
2180 { "External NFC", "wps.permitted_config_methods.nfcext",
2181 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCEXT, NULL, HFILL }},
2183 { &hf_eapwps_tlv_permitted_config_methods_nfcint,
2184 { "Internal NFC", "wps.permitted_config_methods.nfcint",
2185 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINT, NULL, HFILL }},
2187 { &hf_eapwps_tlv_permitted_config_methods_nfcinf,
2188 { "NFC Interface", "wps.permitted_config_methods.nfcinf",
2189 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINF, NULL, HFILL }},
2191 { &hf_eapwps_tlv_permitted_config_methods_pushbutton,
2192 { "Push Button", "wps.permitted_config_methods.pushbutton",
2193 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PUSHBUTTON, NULL, HFILL }},
2195 { &hf_eapwps_tlv_permitted_config_methods_virt_pushbutton,
2196 { "Virtual Push Button", "wps.permitted_config_methods.virt_pushbutton",
2197 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_PUSHBUTTON, NULL, HFILL }},
2199 { &hf_eapwps_tlv_permitted_config_methods_phy_pushbutton,
2200 { "Physical Push Button", "wps.permitted_config_methods.phy_pushbutton",
2201 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_PUSHBUTTON, NULL, HFILL }},
2203 { &hf_eapwps_tlv_permitted_config_methods_keypad,
2204 { "Keypad", "wps.permitted_config_methods.keypad",
2205 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_KEYPAD, NULL, HFILL }},
2207 { &hf_eapwps_tlv_selected_registrar_config_methods,
2208 { "Selected Registrar Config Methods", "wps.selected_registrar_config_methods",
2209 FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2211 { &hf_eapwps_tlv_selected_registrar_config_methods_usba,
2212 { "USB", "wps.selected_registrar_config_methods.usba",
2213 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_USBA, NULL, HFILL }},
2215 { &hf_eapwps_tlv_selected_registrar_config_methods_ethernet,
2216 { "Ethernet", "wps.selected_registrar_config_methods.ethernet",
2217 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_ETHERNET, NULL, HFILL }},
2219 { &hf_eapwps_tlv_selected_registrar_config_methods_label,
2220 { "Label", "wps.selected_registrar_config_methods.label",
2221 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_LABEL, NULL, HFILL }},
2223 { &hf_eapwps_tlv_selected_registrar_config_methods_display,
2224 { "Display", "wps.selected_registrar_config_methods.display",
2225 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_DISPLAY, NULL, HFILL }},
2227 { &hf_eapwps_tlv_selected_registrar_config_methods_virt_display,
2228 { "Virtual Display", "wps.selected_registrar_config_methods.virt_display",
2229 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_DISPLAY, NULL, HFILL }},
2231 { &hf_eapwps_tlv_selected_registrar_config_methods_phy_display,
2232 { "Physical Display", "wps.selected_registrar_config_methods.phy_display",
2233 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_DISPLAY, NULL, HFILL }},
2235 { &hf_eapwps_tlv_selected_registrar_config_methods_nfcext,
2236 { "External NFC", "wps.selected_registrar_config_methods.nfcext",
2237 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCEXT, NULL, HFILL }},
2239 { &hf_eapwps_tlv_selected_registrar_config_methods_nfcint,
2240 { "Internal NFC", "wps.selected_registrar_config_methods.nfcint",
2241 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINT, NULL, HFILL }},
2243 { &hf_eapwps_tlv_selected_registrar_config_methods_nfcinf,
2244 { "NFC Interface", "wps.selected_registrar_config_methods.nfcinf",
2245 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_NFCINF, NULL, HFILL }},
2247 { &hf_eapwps_tlv_selected_registrar_config_methods_pushbutton,
2248 { "Push Button", "wps.selected_registrar_config_methods.pushbutton",
2249 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PUSHBUTTON, NULL, HFILL }},
2251 { &hf_eapwps_tlv_selected_registrar_config_methods_virt_pushbutton,
2252 { "Virtual Push Button", "wps.selected_registrar_config_methods.virt_pushbutton",
2253 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_VIRT_PUSHBUTTON, NULL, HFILL }},
2255 { &hf_eapwps_tlv_selected_registrar_config_methods_phy_pushbutton,
2256 { "Physical Push Button", "wps.selected_registrar_config_methods.phy_pushbutton",
2257 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_PHY_PUSHBUTTON, NULL, HFILL }},
2259 { &hf_eapwps_tlv_selected_registrar_config_methods_keypad,
2260 { "Keypad", "wps.selected_registrar_config_methods.keypad",
2261 FT_UINT16, BASE_HEX, NULL, EAPWPS_CONFMETH_KEYPAD, NULL, HFILL }},
2263 { &hf_eapwps_tlv_primary_device_type,
2264 { "Primary Device Type", "wps.primary_device_type",
2265 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2267 { &hf_eapwps_tlv_primary_device_type_category,
2268 { "Category", "wps.primary_device_type.category",
2269 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_primary_device_type_category), 0x0, NULL, HFILL }},
2271 { &hf_eapwps_tlv_primary_device_type_subcategory[0],
2272 { "Subcategory", "wps.primary_device_type.subcategory_computer",
2273 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_computer_subcategory), 0x0, NULL, HFILL }},
2275 { &hf_eapwps_tlv_primary_device_type_subcategory[1],
2276 { "Subcategory", "wps.primary_device_type.subcategory_input_device",
2277 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_input_device_subcategory), 0x0, NULL, HFILL }},
2279 { &hf_eapwps_tlv_primary_device_type_subcategory[2],
2280 { "Subcategory", "wps.primary_device_type.subcategory_printers_scanners_faxes_copiers",
2281 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_printers_scanners_faxes_copiers_subcategory), 0x0, NULL, HFILL }},
2283 { &hf_eapwps_tlv_primary_device_type_subcategory[3],
2284 { "Subcategory", "wps.primary_device_type.subcategory_camera",
2285 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_camera_subcategory), 0x0, NULL, HFILL }},
2287 { &hf_eapwps_tlv_primary_device_type_subcategory[4],
2288 { "Subcategory", "wps.primary_device_type.subcategory_storage",
2289 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_storage_subcategory), 0x0, NULL, HFILL }},
2291 { &hf_eapwps_tlv_primary_device_type_subcategory[5],
2292 { "Subcategory", "wps.primary_device_type.subcategory_network_infrastructure",
2293 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_network_infrastructure_subcategory), 0x0, NULL, HFILL }},
2295 { &hf_eapwps_tlv_primary_device_type_subcategory[6],
2296 { "Subcategory", "wps.primary_device_type.subcategory_displays",
2297 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_displays_subcategory), 0x0, NULL, HFILL }},
2299 { &hf_eapwps_tlv_primary_device_type_subcategory[7],
2300 { "Subcategory", "wps.primary_device_type.subcategory_multimedia_devices",
2301 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_multimedia_devices_subcategory), 0x0, NULL, HFILL }},
2303 { &hf_eapwps_tlv_primary_device_type_subcategory[8],
2304 { "Subcategory", "wps.primary_device_type.subcategory_gaming_devices",
2305 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_gaming_devices_subcategory), 0x0, NULL, HFILL }},
2307 { &hf_eapwps_tlv_primary_device_type_subcategory[9],
2308 { "Subcategory", "wps.primary_device_type.subcategory_telephone",
2309 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_telephone_subcategory), 0x0, NULL, HFILL }},
2311 { &hf_eapwps_tlv_primary_device_type_subcategory[10],
2312 { "Subcategory", "wps.primary_device_type.subcategory_audio_devices",
2313 FT_UINT16, BASE_HEX, VALS(eapwps_tlv_audio_devices_subcategory), 0x0, NULL, HFILL }},
2316 { &hf_eapwps_tlv_secondary_device_type_list,
2317 { "Secondary Device Type List", "wps.secondary_device_type_list",
2318 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2320 { &hf_eapwps_tlv_portable_device, /* Add info */
2321 { "Portable Device", "wps.portable_device",
2322 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2324 { &hf_eapwps_tlv_ap_setup_locked, /* Add info */
2325 { "AP Setup Locked", "wps.ap_setup_locked",
2326 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2328 { &hf_eapwps_tlv_application_extension,
2329 { "Application Extension", "wps.application_extension",
2330 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2332 { &hf_eapwps_tlv_eap_type,
2333 { "EAP Type", "wps.eap_type",
2334 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2336 { &hf_eapwps_tlv_initialization_vector,
2337 { "Initialization Vector", "wps.initialization_vector",
2338 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2340 { &hf_eapwps_tlv_key_provided_automatically, /* Add info */
2341 { "Key Provided Automatically", "wps.key_provided_automatically",
2342 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2344 { &hf_eapwps_tlv_8021x_enabled, /* Add info */
2345 { "8021x Enabled", "wps.8021x_enabled",
2346 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2348 { &hf_eapwps_tlv_appsessionkey,
2349 { "AppSessionKey", "wps.appsessionkey",
2350 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2352 { &hf_eapwps_tlv_weptransmitkey,
2353 { "WEP Transmit Key", "wps.weptransmitkey",
2354 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2356 { &hf_eapwps_tlv_requested_dev_type,
2357 { "Requested Device Type", "wps.requested_dev_type",
2358 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2360 { &hf_eapwps_vendor_id,
2361 { "Vendor ID", "wps.vendor_id",
2362 FT_UINT24, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2364 { &hf_eapwps_wfa_ext_id,
2365 { "WFA Extension Subelement ID", "wps.ext.id",
2366 FT_UINT8, BASE_DEC, VALS(eapwps_wfa_ext_types), 0x0, NULL, HFILL }},
2368 { &hf_eapwps_wfa_ext_len,
2369 { "WFA Extension Subelement Length", "wps.ext.len",
2370 FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
2372 { &hf_eapwps_wfa_ext_version2,
2373 { "Version2", "wps.ext.version2",
2374 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2376 { &hf_eapwps_wfa_ext_authorizedmacs,
2377 { "AuthorizedMACs", "wps.ext.authorizedmacs",
2378 FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
2380 { &hf_eapwps_wfa_ext_network_key_shareable,
2381 { "Network Key Shareable", "wps.ext.network_key_shareable",
2382 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2384 { &hf_eapwps_wfa_ext_request_to_enroll,
2385 { "Request to Enroll", "wps.ext.request_to_enroll",
2386 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2388 { &hf_eapwps_wfa_ext_settings_delay_time,
2389 { "Settings Delay Time", "wps.ext.settings_delay_time",
2390 FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
2392 static gint *ett[] = {
2393 &ett_eap_wps_attr,
2394 &ett_eap_wps_flags,
2395 /* EAP WPS */
2396 &ett_wps_tlv,
2397 &ett_eap_wps_ap_channel,
2398 &ett_eap_wps_association_state,
2399 &ett_eap_wps_authentication_type,
2400 &ett_eap_wps_authentication_type_flags,
2401 &ett_eap_wps_authenticator,
2402 &ett_eap_wps_config_methods,
2403 &ett_eap_wps_configuration_error,
2404 &ett_eap_wps_confirmation_url4,
2405 &ett_eap_wps_confirmation_url6,
2406 &ett_eap_wps_connection_type,
2407 &ett_eap_wps_connection_type_flags,
2408 &ett_eap_wps_credential,
2409 &ett_eap_wps_device_name,
2410 &ett_eap_wps_device_password_id,
2411 &ett_eap_wps_e_hash1,
2412 &ett_eap_wps_e_hash2,
2413 &ett_eap_wps_e_snonce1,
2414 &ett_eap_wps_e_snonce2,
2415 &ett_eap_wps_encrypted_settings,
2416 &ett_eap_wps_encryption_type,
2417 &ett_eap_wps_encryption_type_flags,
2418 &ett_eap_wps_enrollee_nonce,
2419 &ett_eap_wps_feature_id,
2420 &ett_eap_wps_identity,
2421 &ett_eap_wps_identity_proof,
2422 &ett_eap_wps_key_wrap_authenticator,
2423 &ett_eap_wps_key_identifier,
2424 &ett_eap_wps_mac_address,
2425 &ett_eap_wps_manufacturer,
2426 &ett_eap_wps_message_type,
2427 &ett_eap_wps_model_name,
2428 &ett_eap_wps_model_number,
2429 &ett_eap_wps_network_index,
2430 &ett_eap_wps_network_key,
2431 &ett_eap_wps_network_key_index,
2432 &ett_eap_wps_new_device_name,
2433 &ett_eap_wps_new_password,
2434 &ett_eap_wps_oob_device_password,
2435 &ett_eap_wps_os_version,
2436 &ett_eap_wps_power_level,
2437 &ett_eap_wps_psk_current,
2438 &ett_eap_wps_psk_max,
2439 &ett_eap_wps_public_key,
2440 &ett_eap_wps_radio_enabled,
2441 &ett_eap_wps_reboot,
2442 &ett_eap_wps_registrar_current,
2443 &ett_eap_wps_registrar_established,
2444 &ett_eap_wps_registrar_list,
2445 &ett_eap_wps_registrar_max,
2446 &ett_eap_wps_registrar_nonce,
2447 &ett_eap_wps_request_type,
2448 &ett_eap_wps_response_type,
2449 &ett_eap_wps_rf_bands,
2450 &ett_eap_wps_r_hash1,
2451 &ett_eap_wps_r_hash2,
2452 &ett_eap_wps_r_snonce1,
2453 &ett_eap_wps_r_snonce2,
2454 &ett_eap_wps_selected_registrar,
2455 &ett_eap_wps_serial_number,
2456 &ett_eap_wps_wifi_protected_setup_state,
2457 &ett_eap_wps_ssid,
2458 &ett_eap_wps_total_networks,
2459 &ett_eap_wps_uuid_e,
2460 &ett_eap_wps_uuid_r,
2461 &ett_eap_wps_vendor_extension,
2462 &ett_eap_wps_version,
2463 &ett_eap_wps_x509_certificate_request,
2464 &ett_eap_wps_x509_certificate,
2465 &ett_eap_wps_eap_identity,
2466 &ett_eap_wps_message_counter,
2467 &ett_eap_wps_public_key_hash,
2468 &ett_eap_wps_rekey_key,
2469 &ett_eap_wps_key_lifetime,
2470 &ett_eap_wps_permitted_config_methods,
2471 &ett_eap_wps_selected_registrar_config_methods,
2472 &ett_eap_wps_primary_device_type,
2473 &ett_eap_wps_secondary_device_type_list,
2474 &ett_eap_wps_portable_device,
2475 &ett_eap_wps_ap_setup_locked,
2476 &ett_eap_wps_application_extension,
2477 &ett_eap_wps_eap_type,
2478 &ett_eap_wps_initialization_vector,
2479 &ett_eap_wps_key_provided_automatically,
2480 &ett_eap_wps_8021x_enabled,
2481 &ett_eap_wps_appsessionkey,
2482 &ett_eap_wps_weptransmitkey,
2483 &ett_wps_wfa_ext,
2486 static ei_register_info ei[] = {
2487 { &ei_eapwps_packet_too_short, { "wps.packet_too_short", PI_MALFORMED, PI_ERROR, "Packet too short", EXPFILL }},
2488 { &ei_eapwps_fmt_warn_too_long, { "wps.length.value_too_long", PI_MALFORMED, PI_ERROR, "Value too long", EXPFILL }},
2489 { &ei_eapwps_fmt_length_warn, { "wps.length.too_long", PI_MALFORMED, PI_ERROR, "Value length not X", EXPFILL }},
2492 expert_module_t* expert_wps;
2494 proto_wps = proto_register_protocol("Wifi Protected Setup",
2495 "WPS", "wps");
2496 proto_register_field_array(proto_wps, hf, array_length(hf));
2497 proto_register_subtree_array(ett, array_length(ett));
2498 expert_wps = expert_register_protocol(proto_wps);
2499 expert_register_field_array(expert_wps, ei, array_length(ei));
2503 * Editor modelines
2505 * Local Variables:
2506 * c-basic-offset: 2
2507 * tab-width: 8
2508 * indent-tabs-mode: nil
2509 * End:
2511 * ex: set shiftwidth=2 tabstop=8 expandtab:
2512 * :indentSize=2:tabSize=8:noTabs=true: