Bug Summary

File:builds/wireshark/wireshark/epan/dissectors/packet-eap.c
Warning:line 1777, column 5
Value stored to 'offset' is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name packet-eap.c -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -ffp-contract=on -fno-rounding-math -ffloat16-excess-precision=fast -fbfloat16-excess-precision=fast -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/builds/wireshark/wireshark/build -fcoverage-compilation-dir=/builds/wireshark/wireshark/build -resource-dir /usr/lib/llvm-22/lib/clang/22 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /builds/wireshark/wireshark/epan/dissectors -isystem /builds/wireshark/wireshark/build/epan/dissectors -isystem /usr/include/mit-krb5 -isystem /usr/include/libxml2 -isystem /builds/wireshark/wireshark/epan -D CARES_NO_DEPRECATED -D G_DISABLE_DEPRECATED -D G_DISABLE_SINGLE_INCLUDES -D WS_BUILD_DLL -D WS_DEBUG -D WS_DEBUG_UTF_8 -I /builds/wireshark/wireshark/build -I /builds/wireshark/wireshark -I /builds/wireshark/wireshark/include -D _GLIBCXX_ASSERTIONS -internal-isystem /usr/lib/llvm-22/lib/clang/22/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/16/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fmacro-prefix-map=/builds/wireshark/wireshark/= -fmacro-prefix-map=/builds/wireshark/wireshark/build/= -fmacro-prefix-map=../= -Wno-format-nonliteral -std=gnu17 -ferror-limit 19 -fvisibility=hidden -fwrapv -fwrapv-pointer -fstrict-flex-arrays=3 -stack-protector 2 -fstack-clash-protection -fcf-protection=full -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fexceptions -fcolor-diagnostics -analyzer-output=html -faddrsig -fdwarf2-cfi-asm -o /builds/wireshark/wireshark/sbout/2026-11-04-100346-3662-1 -x c /builds/wireshark/wireshark/epan/dissectors/packet-eap.c
1/* packet-eap.c
2 * Routines for EAP Extensible Authentication Protocol dissection
3 * RFC 2284, RFC 3748
4 *
5 * Wireshark - Network traffic analyzer
6 * By Gerald Combs <[email protected]>
7 * Copyright 1998 Gerald Combs
8 *
9 * SPDX-License-Identifier: GPL-2.0-or-later
10 */
11
12#include "config.h"
13
14#include <epan/packet.h>
15#include <epan/conversation.h>
16#include <epan/reassemble.h>
17#include <epan/expert.h>
18#include <epan/proto_data.h>
19#include <wsutil/strtoi.h>
20
21#include "packet-eap.h"
22#include "packet-eapol.h"
23#include "packet-wps.h"
24#include "packet-e212.h"
25#include "packet-tls-utils.h"
26#include "packet-ppp.h"
27
28void proto_register_eap(void);
29void proto_reg_handoff_eap(void);
30
31static int proto_eap;
32static int hf_eap_code;
33static int hf_eap_identifier;
34static int hf_eap_len;
35static int hf_eap_type;
36static int hf_eap_type_nak;
37
38static int hf_eap_identity;
39static int hf_eap_identity_full;
40static int hf_eap_identity_actual_len;
41static int hf_eap_identity_prefix;
42static int hf_eap_identity_type;
43static int hf_eap_identity_certificate_sn;
44static int hf_eap_identity_mcc;
45static int hf_eap_identity_mcc_mnc_2digits;
46static int hf_eap_identity_mcc_mnc_3digits;
47static int hf_eap_identity_padding;
48
49static int hf_eap_notification;
50
51static int hf_eap_md5_value_size;
52static int hf_eap_md5_value;
53static int hf_eap_md5_extra_data;
54
55static int hf_eap_gtc_challenge;
56static int hf_eap_gtc_response;
57
58static int hf_eap_sim_subtype;
59static int hf_eap_sim_reserved;
60static int hf_eap_sim_subtype_attribute;
61static int hf_eap_sim_subtype_type;
62static int hf_eap_sim_subtype_length;
63static int hf_eap_sim_notification_type;
64static int hf_eap_sim_error_code_type;
65static int hf_eap_sim_subtype_value;
66
67static int hf_eap_aka_subtype;
68static int hf_eap_aka_reserved;
69static int hf_eap_aka_subtype_attribute;
70static int hf_eap_aka_subtype_type;
71static int hf_eap_aka_subtype_length;
72static int hf_eap_aka_notification_type;
73static int hf_eap_aka_error_code_type;
74static int hf_eap_aka_rand;
75static int hf_eap_aka_autn;
76static int hf_eap_aka_res_len;
77static int hf_eap_aka_res;
78static int hf_eap_aka_auts;
79static int hf_eap_aka_subtype_value;
80
81static int hf_eap_leap_version;
82static int hf_eap_leap_reserved;
83static int hf_eap_leap_count;
84static int hf_eap_leap_peer_challenge;
85static int hf_eap_leap_peer_response;
86static int hf_eap_leap_ap_challenge;
87static int hf_eap_leap_ap_response;
88static int hf_eap_leap_data;
89static int hf_eap_leap_name;
90
91static int hf_eap_ms_chap_v2_opcode;
92static int hf_eap_ms_chap_v2_id;
93static int hf_eap_ms_chap_v2_length;
94static int hf_eap_ms_chap_v2_value_size;
95static int hf_eap_ms_chap_v2_challenge;
96static int hf_eap_ms_chap_v2_name;
97static int hf_eap_ms_chap_v2_peer_challenge;
98static int hf_eap_ms_chap_v2_reserved;
99static int hf_eap_ms_chap_v2_nt_response;
100static int hf_eap_ms_chap_v2_flags;
101static int hf_eap_ms_chap_v2_response;
102static int hf_eap_ms_chap_v2_message;
103static int hf_eap_ms_chap_v2_failure_request;
104static int hf_eap_ms_chap_v2_data;
105
106static int hf_eap_pax_opcode;
107static int hf_eap_pax_flags;
108static int hf_eap_pax_flags_mf;
109static int hf_eap_pax_flags_ce;
110static int hf_eap_pax_flags_ai;
111static int hf_eap_pax_flags_reserved;
112static int hf_eap_pax_mac_id;
113static int hf_eap_pax_dh_group_id;
114static int hf_eap_pax_public_key_id;
115static int hf_eap_pax_a_len;
116static int hf_eap_pax_a;
117static int hf_eap_pax_b_len;
118static int hf_eap_pax_b;
119static int hf_eap_pax_cid_len;
120static int hf_eap_pax_cid;
121static int hf_eap_pax_mac_ck_len;
122static int hf_eap_pax_mac_ck;
123static int hf_eap_pax_ade_len;
124static int hf_eap_pax_ade;
125static int hf_eap_pax_mac_icv;
126
127static int hf_eap_psk_flags;
128static int hf_eap_psk_flags_t;
129static int hf_eap_psk_flags_reserved;
130static int hf_eap_psk_rand_p;
131static int hf_eap_psk_rand_s;
132static int hf_eap_psk_mac_p;
133static int hf_eap_psk_mac_s;
134static int hf_eap_psk_id_p;
135static int hf_eap_psk_id_s;
136static int hf_eap_psk_pchannel;
137
138static int hf_eap_sake_version;
139static int hf_eap_sake_session_id;
140static int hf_eap_sake_subtype;
141static int hf_eap_sake_attr_type;
142static int hf_eap_sake_attr_len;
143static int hf_eap_sake_attr_value;
144static int hf_eap_sake_attr_value_str;
145static int hf_eap_sake_attr_value_uint48;
146
147static int hf_eap_gpsk_opcode;
148static int hf_eap_gpsk_id_server_len;
149static int hf_eap_gpsk_id_server;
150static int hf_eap_gpsk_id_peer_len;
151static int hf_eap_gpsk_id_peer;
152static int hf_eap_gpsk_rand_server;
153static int hf_eap_gpsk_rand_peer;
154static int hf_eap_gpsk_csuite_list_len;
155static int hf_eap_gpsk_csuite_vendor;
156static int hf_eap_gpsk_csuite_specifier;
157static int hf_eap_gpsk_pd_payload_len;
158static int hf_eap_gpsk_pd_payload;
159static int hf_eap_gpsk_payload_mac;
160static int hf_eap_gpsk_failure_code;
161
162static int hf_eap_msauth_tlv_mandatory;
163static int hf_eap_msauth_tlv_reserved;
164static int hf_eap_msauth_tlv_type;
165static int hf_eap_msauth_tlv_len;
166static int hf_eap_msauth_tlv_val;
167static int hf_eap_msauth_tlv_status;
168static int hf_eap_msauth_tlv_crypto_reserved;
169static int hf_eap_msauth_tlv_crypto_version;
170static int hf_eap_msauth_tlv_crypto_rcv_version;
171static int hf_eap_msauth_tlv_crypto_subtype;
172static int hf_eap_msauth_tlv_crypto_nonce;
173static int hf_eap_msauth_tlv_crypto_cmac;
174
175static int hf_eap_data;
176
177static int ett_eap;
178static int ett_eap_pax_flags;
179static int ett_eap_psk_flags;
180static int ett_eap_sake_attr;
181static int ett_eap_gpsk_csuite_list;
182static int ett_eap_gpsk_csuite;
183static int ett_eap_gpsk_csuite_sel;
184static int ett_eap_msauth_tlv;
185static int ett_eap_msauth_tlv_tree;
186
187static expert_field ei_eap_ms_chap_v2_length;
188static expert_field ei_eap_mitm_attacks;
189static expert_field ei_eap_md5_value_size_overflow;
190static expert_field ei_eap_dictionary_attacks;
191static expert_field ei_eap_identity_nonascii;
192static expert_field ei_eap_identity_invalid;
193static expert_field ei_eap_retransmission;
194static expert_field ei_eap_bad_length;
195static expert_field ei_eap_tls_fragment_missing;
196
197static dissector_table_t eap_expanded_type_dissector_table;
198
199static dissector_handle_t eap_handle;
200
201static dissector_handle_t tls_handle;
202static dissector_handle_t diameter_avps_handle;
203static dissector_handle_t peap_handle;
204static dissector_handle_t teap_handle;
205
206static dissector_handle_t ike_handle;
207
208const value_string eap_code_vals[] = {
209 { EAP_REQUEST1, "Request" },
210 { EAP_RESPONSE2, "Response" },
211 { EAP_SUCCESS3, "Success" },
212 { EAP_FAILURE4, "Failure" },
213 { EAP_INITIATE5, "Initiate" }, /* [RFC5296] */
214 { EAP_FINISH6, "Finish" }, /* [RFC5296] */
215 { 0, NULL((void*)0) }
216};
217
218/*
219References:
220 1) https://www.iana.org/assignments/ppp-numbers PPP EAP REQUEST/RESPONSE TYPES
221 2) https://tools.ietf.org/html/draft-ietf-pppext-rfc2284bis-02
222 3) RFC2284
223 4) RFC3748
224 5) https://www.iana.org/assignments/eap-numbers EAP registry (updated 2011-02-22)
225 6) https://tools.ietf.org/html/draft-bersani-eap-synthesis-sharedkeymethods-00
226*/
227
228static const value_string eap_type_vals[] = {
229 { 1, "Identity" },
230 { 2, "Notification" },
231 { 3, "Legacy Nak (Response Only)" },
232 { 4, "MD5-Challenge EAP (EAP-MD5-CHALLENGE)" },
233 { 5, "One-Time Password EAP (EAP-OTP)" },
234 { 6, "Generic Token Card EAP (EAP-GTC)" },
235 { 7, "Allocated" },
236 { 8, "Allocated" },
237 { 9, "RSA Public Key Authentication EAP (EAP-RSA-PKA)" },
238 { 10, "DSS Unilateral EAP (EAP-DSS)" },
239 { 11, "KEA EAP (EAP-KEA)" },
240 { 12, "KEA Validate EAP (EAP-KEA-VALIDATE)" },
241 { 13, "TLS EAP (EAP-TLS)" },
242 { 14, "Defender Token EAP (EAP-AXENT)" },
243 { 15, "RSA Security SecurID EAP (EAP-RSA-SECURID)" },
244 { 16, "Arcot Systems EAP (EAP-ARCOT-SYSTEMS)" },
245 { 17, "Cisco Wireless EAP / Lightweight EAP (EAP-LEAP)" },
246 { 18, "GSM Subscriber Identity Modules EAP (EAP-SIM)" },
247 { 19, "Secure Remote Password SHA1 Part 1 EAP (EAP-SRP-SHA1-PART1)" },
248 { 20, "Secure Remote Password SHA1 Part 2 EAP (EAP-SRP-SHA1-PART2)" },
249 { 21, "Tunneled TLS EAP (EAP-TTLS)" },
250 { 22, "Remote Access Service EAP (EAP-RAS)" },
251 { 23, "UMTS Authentication and Key Agreement EAP (EAP-AKA)" },
252 { 24, "3Com Wireless EAP (EAP-3COM-WIRELESS)" },
253 { 25, "Protected EAP (EAP-PEAP)" },
254 { 26, "MS-Authentication EAP (EAP-MS-AUTH)" },
255 { 27, "Mutual Authentication w/Key Exchange EAP (EAP-MAKE)" },
256 { 28, "CRYPTOCard EAP (EAP-CRYPTOCARD)" },
257 { 29, "MS-CHAP-v2 EAP (EAP-MS-CHAP-V2)" },
258 { 30, "DynamID EAP (EAP-DYNAMID)" },
259 { 31, "Rob EAP (EAP-ROB)" },
260 { 32, "Protected One-Time Password EAP (EAP-POTP)" },
261 { 33, "MS-Authentication TLV EAP (EAP-MS-AUTH-TLV)" },
262 { 34, "SentriNET (EAP-SENTRINET)" },
263 { 35, "Actiontec Wireless EAP (EAP-ACTIONTEC-WIRELESS)" },
264 { 36, "Cogent Systems Biometrics Authentication EAP (EAP-COGENT-BIOMETRIC)" },
265 { 37, "AirFortress EAP (EAP-AIRFORTRESS)" },
266 { 38, "HTTP Digest EAP (EAP-HTTP-DIGEST)" },
267 { 39, "SecureSuite EAP (EAP-SECURESUITE)" },
268 { 40, "DeviceConnect EAP (EAP-DEVICECONNECT)" },
269 { 41, "Simple Password Exponential Key Exchange EAP (EAP-SPEKE)" },
270 { 42, "MOBAC EAP (EAP-MOBAC)" },
271 { 43, "Flexible Authentication via Secure Tunneling EAP (EAP-FAST)" },
272 { 44, "ZoneLabs EAP (EAP-ZLXEAP)" },
273 { 45, "Link EAP (EAP-LINK)" },
274 { 46, "Password Authenticated eXchange EAP (EAP-PAX)" },
275 { 47, "Pre-Shared Key EAP (EAP-PSK)" },
276 { 48, "Shared-secret Authentication and Key Establishment EAP (EAP-SAKE)" },
277 { 49, "Internet Key Exchange v2 EAP (EAP-IKEv2)" },
278 { 50, "UMTS Authentication and Key Agreement' EAP (EAP-AKA')" },
279 { 51, "Generalized Pre-Shared Key EAP (EAP-GPSK)" },
280 { 52, "Password EAP (EAP-pwd)" },
281 { 53, "Encrypted Key Exchange v1 EAP (EAP-EKEv1)" },
282 { 55, "Tunneled EAP protocol" },
283 { 254, "Expanded Type" },
284 { 255, "Experimental" },
285 { 0, NULL((void*)0) }
286};
287value_string_ext eap_type_vals_ext = VALUE_STRING_EXT_INIT(eap_type_vals){ _try_val_to_str_ext_init, 0, (sizeof (eap_type_vals) / sizeof
((eap_type_vals)[0]))-1, eap_type_vals, "eap_type_vals", ((void
*)0) }
;
288
289static const value_string eap_identity_prefix_vals[] = {
290 { 0x00, "Encrypted IMSI" },
291 { '0', "EAP-AKA Permanent" },
292 { '1', "EAP-SIM Permanent" },
293 { '2', "EAP-AKA Pseudonym" },
294 { '3', "EAP-SIM Pseudonym" },
295 { '4', "EAP-AKA Reauth ID" },
296 { '5', "EAP-SIM Reauth ID" },
297 { '6', "EAP-AKA Prime Permanent" },
298 { '7', "EAP-AKA Prime Pseudonym" },
299 { '8', "EAP-AKA Prime Reauth ID" },
300 { 'C', "Conservative Peer" },
301 { 'a', "Anonymous Identity" },
302 { 0, NULL((void*)0) }
303};
304
305const value_string eap_sim_subtype_vals[] = {
306 { SIM_START10, "Start" },
307 { SIM_CHALLENGE11, "Challenge" },
308 { SIM_NOTIFICATION12, "Notification" },
309 { SIM_RE_AUTHENTICATION13, "Re-authentication" },
310 { SIM_CLIENT_ERROR14, "Client-Error" },
311 { 0, NULL((void*)0) }
312};
313
314const value_string eap_aka_subtype_vals[] = {
315 { AKA_CHALLENGE1, "AKA-Challenge" },
316 { AKA_AUTHENTICATION_REJECT2, "AKA-Authentication-Reject" },
317 { AKA_SYNCHRONIZATION_FAILURE4, "AKA-Synchronization-Failure" },
318 { AKA_IDENTITY5, "AKA-Identity" },
319 { AKA_NOTIFICATION12, "Notification" },
320 { AKA_REAUTHENTICATION13, "Re-authentication" },
321 { AKA_CLIENT_ERROR14, "Client-Error" },
322 { 0, NULL((void*)0) }
323};
324
325/*
326References:
327 1) http://www.iana.org/assignments/eapsimaka-numbers/eapsimaka-numbers.xml
328 3) RFC4186
329 3) RFC4187
330 4) RFC5448
331 5) 3GPP TS 24.302
332 6) RFC9048
333*/
334
335#define AT_RAND1 1
336#define AT_AUTN2 2
337#define AT_RES3 3
338#define AT_AUTS4 4
339#define AT_NOTIFICATION12 12
340#define AT_IDENTITY14 14
341#define AT_CLIENT_ERROR_CODE22 22
342
343static const value_string eap_sim_aka_attribute_vals[] = {
344 { 1, "AT_RAND" },
345 { 2, "AT_AUTN" },
346 { 3, "AT_RES" },
347 { 4, "AT_AUTS" },
348 { 6, "AT_PADDING" },
349 { 7, "AT_NONCE_MT" },
350 { 10, "AT_PERMANENT_ID_REQ" },
351 { 11, "AT_MAC" },
352 { 12, "AT_NOTIFICATION" },
353 { 13, "AT_ANY_ID_REQ" },
354 { 14, "AT_IDENTITY" },
355 { 15, "AT_VERSION_LIST" },
356 { 16, "AT_SELECTED_VERSION" },
357 { 17, "AT_FULLAUTH_ID_REQ" },
358 { 19, "AT_COUNTER" },
359 { 20, "AT_COUNTER_TOO_SMALL" },
360 { 21, "AT_NONCE_S" },
361 { 22, "AT_CLIENT_ERROR_CODE" },
362 { 23, "AT_KDF_INPUT"},
363 { 24, "AT_KDF"},
364 { 128, "Unassigned" },
365 { 129, "AT_IV" },
366 { 130, "AT_ENCR_DATA" },
367 { 131, "Unassigned" },
368 { 132, "AT_NEXT_PSEUDONYM" },
369 { 133, "AT_NEXT_REAUTH_ID" },
370 { 134, "AT_CHECKCODE" },
371 { 135, "AT_RESULT_IND" },
372 { 136, "AT_BIDDING" },
373 { 137, "AT_IPMS_IND" },
374 { 138, "AT_IPMS_RES" },
375 { 139, "AT_TRUST_IND" },
376 { 140, "AT_SHORT_NAME_FOR_NETWORK" },
377 { 141, "AT_FULL_NAME_FOR_NETWORK" },
378 { 142, "AT_RQSI_IND" },
379 { 143, "AT_RQSI_RES" },
380 { 144, "AT_TWAN_CONN_MODE" },
381 { 145, "AT_VIRTUAL_NETWORK_ID" },
382 { 146, "AT_VIRTUAL_NETWORK_REQ" },
383 { 147, "AT_CONNECTIVITY_TYPE" },
384 { 148, "AT_HANDOVER_INDICATION" },
385 { 149, "AT_HANDOVER_SESSION_ID" },
386 { 150, "AT_MN_SERIAL_ID" },
387 { 151, "AT_DEVICE_IDENTITY" },
388 { 0, NULL((void*)0) }
389};
390static value_string_ext eap_sim_aka_attribute_vals_ext = VALUE_STRING_EXT_INIT(eap_sim_aka_attribute_vals){ _try_val_to_str_ext_init, 0, (sizeof (eap_sim_aka_attribute_vals
) / sizeof ((eap_sim_aka_attribute_vals)[0]))-1, eap_sim_aka_attribute_vals
, "eap_sim_aka_attribute_vals", ((void*)0) }
;
391
392static const value_string eap_sim_aka_notification_vals[] = {
393 { 0, "General Failure after Authentication" },
394 { 1026, "User has been temporarily denied access" },
395 { 1031, "User has not subscribed to the requested service" },
396 { 8192, "Failure to Terminate the Authentication Exchange" },
397 {16384, "General Failure" },
398 {32768, "Success" },
399 {0, NULL((void*)0) }
400};
401
402static const value_string eap_sim_aka_client_error_codes[] = {
403 { 0, "Unable to process packet" },
404 { 1, "Unsupported version" },
405 { 2, "Insufficient number of challenges" },
406 { 3, "RANDs are not fresh" },
407 { 0, NULL((void*)0) }
408};
409
410const value_string eap_ms_chap_v2_opcode_vals[] = {
411 { MS_CHAP_V2_CHALLENGE1, "Challenge" },
412 { MS_CHAP_V2_RESPONSE2, "Response" },
413 { MS_CHAP_V2_SUCCESS3, "Success" },
414 { MS_CHAP_V2_FAILURE4, "Failure" },
415 { MS_CHAP_V2_CHANGE_PASSWORD7, "Change-Password" },
416 { 0, NULL((void*)0) }
417};
418
419#define PAX_STD_10x01 0x01
420#define PAX_STD_20x02 0x02
421#define PAX_STD_30x03 0x03
422#define PAX_SEC_10x11 0x11
423#define PAX_SEC_20x12 0x12
424#define PAX_SEC_30x13 0x13
425#define PAX_SEC_40x14 0x14
426#define PAX_SEC_50x15 0x15
427#define PAX_ACK0x21 0x21
428
429static const value_string eap_pax_opcode_vals[] = {
430 { PAX_STD_10x01, "STD-1" },
431 { PAX_STD_20x02, "STD-2" },
432 { PAX_STD_30x03, "STD-3" },
433 { PAX_SEC_10x11, "SEC-1" },
434 { PAX_SEC_20x12, "SEC-2" },
435 { PAX_SEC_30x13, "SEC-3" },
436 { PAX_SEC_40x14, "SEC-4" },
437 { PAX_SEC_50x15, "SEC-5" },
438 { PAX_ACK0x21, "ACK" },
439 { 0, NULL((void*)0) }
440};
441
442#define EAP_PAX_FLAG_MF0x01 0x01 /* more fragments */
443#define EAP_PAX_FLAG_CE0x02 0x02 /* certificate enabled */
444#define EAP_PAX_FLAG_AI0x04 0x04 /* ADE included */
445#define EAP_PAX_FLAG_RESERVED0xF8 0xF8 /* reserved */
446
447#define PAX_MAC_ID_HMAC_SHA1_1280x01 0x01
448#define PAX_MAC_ID_HMAC_SHA256_1280x02 0x02
449
450static const value_string eap_pax_mac_id_vals[] = {
451 { PAX_MAC_ID_HMAC_SHA1_1280x01, "HMAC_SHA1_128" },
452 { PAX_MAC_ID_HMAC_SHA256_1280x02, "HMAXĆ_SHA256_128" },
453 { 0, NULL((void*)0) }
454};
455
456#define PAX_DH_GROUP_ID_NONE0x00 0x00
457#define PAX_DH_GROUP_ID_DH_140x01 0x01
458#define PAX_DH_GROUP_ID_DH_150x02 0x02
459#define PAX_DH_GROUP_ID_ECC_P2560x03 0x03
460
461static const value_string eap_pax_dh_group_id_vals[] = {
462 { PAX_DH_GROUP_ID_NONE0x00, "NONE" },
463 { PAX_DH_GROUP_ID_DH_140x01, "2048-bit MODP Group (IANA DH Group 14)" },
464 { PAX_DH_GROUP_ID_DH_150x02, "3072-bit MODP Group (IANA DH Group 15)" },
465 { PAX_DH_GROUP_ID_ECC_P2560x03, "NIST ECC Group P-256" },
466 { 0, NULL((void*)0) }
467};
468
469#define PAX_PUBLIC_KEY_ID_NONE0x00 0x00
470#define PAX_PUBLIC_KEY_ID_RSAES_OAEP0x01 0x01
471#define PAX_PUBLIC_KEY_ID_RSA_PKCS1_V1_50x02 0x02
472#define PAX_PUBLIC_KEY_ID_EL_GAMAL_ECC_P2560x03 0x03
473
474static const value_string eap_pax_public_key_id_vals[] = {
475 { PAX_PUBLIC_KEY_ID_NONE0x00, "NONE" },
476 { PAX_PUBLIC_KEY_ID_RSAES_OAEP0x01, "RSAES-OAEP" },
477 { PAX_PUBLIC_KEY_ID_RSA_PKCS1_V1_50x02, "RSA-PKCS1-V1_5" },
478 { PAX_PUBLIC_KEY_ID_EL_GAMAL_ECC_P2560x03, "El-Gamal Over NIST ECC Group P-256" },
479 { 0, NULL((void*)0) }
480};
481
482#define EAP_PSK_FLAGS_T_MASK0xC0 0xC0
483
484#define SAKE_CHALLENGE1 1
485#define SAKE_CONFIRM2 2
486#define SAKE_AUTH_REJECT3 3
487#define SAKE_IDENTITY4 4
488
489static const value_string eap_sake_subtype_vals[] = {
490 { SAKE_CHALLENGE1, "SAKE/Challenge" },
491 { SAKE_CONFIRM2, "SAKE/Confirm" },
492 { SAKE_AUTH_REJECT3, "SAKE/Auth-Reject" },
493 { SAKE_IDENTITY4, "SAKE/Identity" },
494 { 0, NULL((void*)0) }
495};
496
497#define SAKE_AT_RAND_S1 1
498#define SAKE_AT_RAND_P2 2
499#define SAKE_AT_MIC_S3 3
500#define SAKE_AT_MIC_P4 4
501#define SAKE_AT_SERVERID5 5
502#define SAKE_AT_PEERID6 6
503#define SAKE_AT_SPI_S7 7
504#define SAKE_AT_SPI_P8 8
505#define SAKE_AT_ANY_ID_REQ9 9
506#define SAKE_AT_PERM_ID_REQ10 10
507#define SAKE_AT_ENCR_DATA128 128
508#define SAKE_AT_IV129 129
509#define SAKE_AT_PADDING130 130
510#define SAKE_AT_NEXT_TMPID131 131
511#define SAKE_AT_MSK_LIFE132 132
512
513static const value_string eap_sake_attr_type_vals[] = {
514 { SAKE_AT_RAND_S1, "Server Nonce RAND_S" },
515 { SAKE_AT_RAND_P2, "Peer Nonce RAND_P" },
516 { SAKE_AT_MIC_S3, "Server MIC" },
517 { SAKE_AT_MIC_P4, "Peer MIC" },
518 { SAKE_AT_SERVERID5, "Server FQDN" },
519 { SAKE_AT_PEERID6, "Peer NAI (tmp, perm)" },
520 { SAKE_AT_SPI_S7, "Server chosen SPI SPI_S" },
521 { SAKE_AT_SPI_P8, "Peer SPI list SPI_P" },
522 { SAKE_AT_ANY_ID_REQ9, "Requires any Peer Id (tmp, perm)" },
523 { SAKE_AT_PERM_ID_REQ10, "Requires Peer's permanent Id/NAI" },
524 { SAKE_AT_ENCR_DATA128, "Contains encrypted attributes" },
525 { SAKE_AT_IV129, "IV for encrypted attributes" },
526 { SAKE_AT_PADDING130, "Padding for encrypted attributes" },
527 { SAKE_AT_NEXT_TMPID131, "TempID for next EAP-SAKE phase" },
528 { SAKE_AT_MSK_LIFE132, "MSK Lifetime" },
529 { 0, NULL((void*)0) }
530};
531
532#define GPSK_RESERVED0 0
533#define GPSK_GPSK_11 1
534#define GPSK_GPSK_22 2
535#define GPSK_GPSK_33 3
536#define GPSK_GPSK_44 4
537#define GPSK_FAIL5 5
538#define GPSK_PROTECTED_FAIL6 6
539
540static const value_string eap_gpsk_opcode_vals[] = {
541 { GPSK_RESERVED0, "Reserved" },
542 { GPSK_GPSK_11, "GPSK-1" },
543 { GPSK_GPSK_22, "GPSK-2" },
544 { GPSK_GPSK_33, "GPSK-3" },
545 { GPSK_GPSK_44, "GPSK-4" },
546 { GPSK_FAIL5, "Fail" },
547 { GPSK_PROTECTED_FAIL6, "Protected Fail" },
548 { 0, NULL((void*)0) }
549};
550
551static const value_string eap_gpsk_failure_code_vals[] = {
552 { 0x00000000, "Reserved" },
553 { 0x00000001, "PSK Not Found" },
554 { 0x00000002, "Authentication Failure" },
555 { 0x00000003, "Authorization Failure" },
556 { 0, NULL((void*)0) }
557};
558
559#define MSAUTH_TLV_MANDATORY0x8000 0x8000
560#define MSAUTH_TLV_RESERVED0x4000 0x4000
561#define MSAUTH_TLV_TYPE0x3FFF 0x3FFF
562
563#define MSAUTH_TLV_TYPE_EXTENSION_UNASSIGNED0 0
564#define MSAUTH_TLV_TYPE_EXTENSION_RESULT3 3
565#define MSAUTH_TLV_TYPE_EXTENSION_CRYPTOBINDING12 12
566
567#define MSAUTH_TLV_TYPE_EXPANDED_SOH33 33
568
569static const value_string eap_msauth_tlv_type_vals[] = {
570 { MSAUTH_TLV_TYPE_EXTENSION_UNASSIGNED0, "Unassigned" },
571 { MSAUTH_TLV_TYPE_EXTENSION_RESULT3, "Result" },
572 { MSAUTH_TLV_TYPE_EXTENSION_CRYPTOBINDING12, "Cryptobinding" },
573 { 0, NULL((void*)0) }
574};
575
576static const value_string eap_msauth_tlv_status_vals[] = {
577 { 1, "Success" },
578 { 2, "Failure" },
579 { 0, NULL((void*)0) }
580};
581
582static const value_string eap_msauth_tlv_crypto_subtype_vals[] = {
583 { 0, "Binding Request" },
584 { 1, "Binding Response" },
585 { 0, NULL((void*)0) }
586};
587
588/*
589 * State information for EAP-TLS (RFC2716) and Lightweight EAP:
590 *
591 * http://www.missl.cs.umd.edu/wireless/ethereal/leap.txt
592 *
593 * Attach to all conversations:
594 *
595 * a sequence number to be handed to "fragment_add_seq()" as
596 * the fragment sequence number - if it's -1, no reassembly
597 * is in progress, but if it's not, it's the sequence number
598 * to use for the current fragment;
599 *
600 * a value to be handed to "fragment_add_seq()" as the
601 * reassembly ID - when a reassembly is started, it's set to
602 * the frame number of the current frame, i.e. the frame
603 * that starts the reassembly;
604 *
605 * an indication of the current state of LEAP negotiation,
606 * with -1 meaning no LEAP negotiation is in progress.
607 *
608 * Attach to frames containing fragments of EAP-TLS messages the
609 * reassembly ID for those fragments, so we can find the reassembled
610 * data after the first pass through the packets.
611 *
612 * Attach to LEAP frames the state of the LEAP negotiation when the
613 * frame was processed, so we can properly dissect
614 * the LEAP message after the first pass through the packets.
615 *
616 * Attach to all conversations both pieces of information, to keep
617 * track of EAP-TLS reassembly and the LEAP state machine.
618 */
619
620typedef struct {
621 int eap_tls_seq;
622 uint32_t eap_tls_len;
623 uint32_t outer_tlvs_length;
624 uint32_t eap_reass_cookie;
625 int leap_state;
626 int16_t last_eap_id_req; /* Last ID of the request from the authenticator. */
627 int16_t last_eap_id_resp; /* Last ID of the response from the peer. */
628} conv_state_t;
629
630typedef struct {
631 int info; /* interpretation depends on EAP message type */
632 uint32_t eap_tls_len; /* total Message Length; present only on the first fragment */
633 uint32_t outer_tlvs_length; /* TEAP; present only on the first fragment */
634} frame_state_t;
635
636/*
637from RFC5216, pg 21
638
639 Flags
640
641 0 1 2 3 4 5 6 7 8
642 +-+-+-+-+-+-+-+-+
643 |L M S R R R R R| TLS (RFC5216)
644 +-+-+-+-+-+-+-+-+
645 |L M S R R| V | TTLS (RFC5281) and FAST (RFC4851)
646 +-+-+-+-+-+-+-+-+
647 |L M S O R| V | TEAP (RFC7170)
648 +-+-+-+-+-+-+-+-+
649 |L M S R R R| V | PEAPv0 (draft-kamath-pppext-peapv0)
650 +-+-+-+-+-+-+-+-+
651 |L M S R R| V | PEAPv1 (draft-josefsson-pppext-eap-tls-eap-06) and PEAPv2 (draft-josefsson-pppext-eap-tls-eap-10)
652 +-+-+-+-+-+-+-+-+
653
654 L = Length included
655 M = More fragments
656 S = EAP-TLS start
657 O = Outer TLV length included (TEAP only)
658 R = Reserved
659 V = TTLS/FAST/TEAP/PEAP version (Reserved for TLS)
660*/
661
662#define EAP_TLS_FLAG_L0x80 0x80 /* Length included */
663#define EAP_TLS_FLAG_M0x40 0x40 /* More fragments */
664#define EAP_TLS_FLAG_S0x20 0x20 /* EAP-TLS start */
665#define EAP_TLS_FLAG_O0x10 0x10 /* Outer TLV length included */
666
667#define EAP_TLS_FLAGS_VERSION0x07 0x07 /* Version mask */
668
669/*
670 * reassembly of EAP-TLS
671 */
672static reassembly_table eap_tls_reassembly_table;
673
674static int hf_eap_tls_flags;
675static int hf_eap_tls_flag_l;
676static int hf_eap_tls_flag_m;
677static int hf_eap_tls_flag_s;
678static int hf_eap_tls_flag_o;
679static int hf_eap_tls_flags_version;
680static int hf_eap_tls_len;
681static int hf_eap_tls_outer_tlvs_len;
682static int hf_eap_tls_fragment;
683static int hf_eap_tls_fragments;
684static int hf_eap_tls_fragment_overlap;
685static int hf_eap_tls_fragment_overlap_conflict;
686static int hf_eap_tls_fragment_multiple_tails;
687static int hf_eap_tls_fragment_too_long_fragment;
688static int hf_eap_tls_fragment_error;
689static int hf_eap_tls_fragment_count;
690static int hf_eap_tls_reassembled_in;
691static int hf_eap_tls_reassembled_length;
692static int hf_eap_fast_type;
693static int hf_eap_fast_length;
694static int hf_eap_fast_aidd;
695static int ett_eap_tls_fragment;
696static int ett_eap_tls_fragments;
697static int ett_eap_sim_attr;
698static int ett_eap_aka_attr;
699static int ett_eap_exp_attr;
700static int ett_eap_tls_flags;
701static int ett_identity;
702static int ett_eap_ikev2_flags;
703
704static const fragment_items eap_tls_frag_items = {
705 &ett_eap_tls_fragment,
706 &ett_eap_tls_fragments,
707 &hf_eap_tls_fragments,
708 &hf_eap_tls_fragment,
709 &hf_eap_tls_fragment_overlap,
710 &hf_eap_tls_fragment_overlap_conflict,
711 &hf_eap_tls_fragment_multiple_tails,
712 &hf_eap_tls_fragment_too_long_fragment,
713 &hf_eap_tls_fragment_error,
714 &hf_eap_tls_fragment_count,
715 &hf_eap_tls_reassembled_in,
716 &hf_eap_tls_reassembled_length,
717 /* Reassembled data field */
718 NULL((void*)0),
719 "fragments"
720};
721
722
723/*
724 * EAP-IKE2, RFC5106
725 */
726
727 /*
728 RFC5106, 8.1, page 17
729
730 0 1 2 3 4 5 6 7
731 +-+-+-+-+-+-+-+-+
732 |L M I 0 0 0 0 0|
733 +-+-+-+-+-+-+-+-+
734
735 L = Length included
736 M = More fragments
737 I = Integrity Checksum Data included
738 */
739#define EAP_IKEV2_FLAG_L0x80 0x80 /* Length included */
740#define EAP_IKEV2_FLAG_M0x40 0x40 /* More fragments */
741#define EAP_IKEV2_FLAG_I0x20 0x20 /* Integrity checksum data included */
742
743static int hf_eap_ikev2_flags;
744static int hf_eap_ikev2_flag_l;
745static int hf_eap_ikev2_flag_m;
746static int hf_eap_ikev2_flag_i;
747static int hf_eap_ikev2_len;
748static int hf_eap_ikev2_int_chk_data;
749
750/**********************************************************************
751 Support for EAP Expanded Type.
752
753 Currently this is limited to WifiProtectedSetup. Maybe we need
754 a generic method to support EAP extended types ?
755*********************************************************************/
756static int hf_eap_ext_vendor_id;
757static int hf_eap_ext_vendor_type;
758
759static const value_string eap_ext_vendor_id_vals[] = {
760 { WFA_VENDOR_ID0x00372A, "WFA" },
761 { 0, NULL((void*)0) }
762};
763
764static const value_string eap_ext_vendor_type_vals[] = {
765 { WFA_SIMPLECONFIG_TYPE0x1, "SimpleConfig" },
766 { 0, NULL((void*)0) }
767};
768
769static void
770dissect_exteap(proto_tree *eap_tree, tvbuff_t *tvb, unsigned offset,
771 unsigned size _U___attribute__((unused)), packet_info* pinfo, uint8_t eap_code, uint8_t eap_identifier)
772{
773 tvbuff_t *next_tvb;
774 uint32_t vendor_id;
775 uint32_t vendor_type;
776 eap_vendor_context *vendor_context;
777
778 vendor_context = wmem_new(pinfo->pool, eap_vendor_context)((eap_vendor_context*)wmem_alloc((pinfo->pool), sizeof(eap_vendor_context
)))
;
779
780 proto_tree_add_item_ret_uint(eap_tree, hf_eap_ext_vendor_id, tvb, offset, 3, ENC_BIG_ENDIAN0x00000000, &vendor_id);
781 offset += 3;
782
783 proto_tree_add_item_ret_uint(eap_tree, hf_eap_ext_vendor_type, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &vendor_type);
784 offset += 4;
785
786 vendor_context->eap_code = eap_code;
787 vendor_context->eap_identifier = eap_identifier;
788 vendor_context->vendor_id = vendor_id;
789 vendor_context->vendor_type = vendor_type;
790
791 next_tvb = tvb_new_subset_remaining(tvb, offset);
792 if (!dissector_try_uint_with_data(eap_expanded_type_dissector_table,
793 vendor_id, next_tvb, pinfo, eap_tree,
794 false0, vendor_context)) {
795 call_data_dissector(next_tvb, pinfo, eap_tree);
796 }
797}
798/* *********************************************************************
799********************************************************************* */
800
801static void
802dissect_eap_mschapv2(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, unsigned offset,
803 unsigned size)
804{
805 proto_item *item;
806 unsigned left = size;
807 unsigned ms_len;
808 uint8_t value_size;
809 uint8_t opcode;
810
811 /* OpCode (1 byte), MS-CHAPv2-ID (1 byte), MS-Length (2 bytes), Data */
812 proto_tree_add_item_ret_uint8(eap_tree, hf_eap_ms_chap_v2_opcode, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &opcode);
813 offset += 1;
814 left -= 1;
815 if (left <= 0)
816 return;
817
818 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_id, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
819 offset += 1;
820 left -= 1;
821 if (left <= 0)
822 return;
823
824 item = proto_tree_add_item_ret_uint(eap_tree, hf_eap_ms_chap_v2_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &ms_len);
825 if (ms_len != size)
826 expert_add_info(pinfo, item, &ei_eap_ms_chap_v2_length);
827 offset += 2;
828 left -= 2;
829
830 switch (opcode) {
831 case MS_CHAP_V2_CHALLENGE1:
832 if (left <= 0)
833 break;
834 proto_tree_add_item_ret_uint8(eap_tree, hf_eap_ms_chap_v2_value_size,
835 tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &value_size);
836 offset += 1;
837 left -= 1;
838 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_challenge,
839 tvb, offset, value_size, ENC_NA0x00000000);
840 offset += value_size;
841 left -= value_size;
842 if (left <= 0)
843 break;
844 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_name,
845 tvb, offset, left, ENC_ASCII0x00000000);
846 break;
847 case MS_CHAP_V2_RESPONSE2:
848 if (left <= 0)
849 break;
850 proto_tree_add_item_ret_uint8(eap_tree, hf_eap_ms_chap_v2_value_size,
851 tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &value_size);
852 offset += 1;
853 left -= 1;
854 if (value_size == 49) {
855 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_peer_challenge,
856 tvb, offset, 16, ENC_NA0x00000000);
857 offset += 16;
858 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_reserved,
859 tvb, offset, 8, ENC_NA0x00000000);
860 offset += 8;
861 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_nt_response,
862 tvb, offset, 24, ENC_NA0x00000000);
863 offset += 24;
864 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_flags,
865 tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
866 offset += 1;
867 left -= value_size;
868 } else {
869 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_response, tvb, offset, value_size, ENC_NA0x00000000);
870 offset += value_size;
871 left -= value_size;
872 }
873 if (left <= 0)
874 break;
875 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_name, tvb, offset, left, ENC_ASCII0x00000000);
876 break;
877 case MS_CHAP_V2_SUCCESS3:
878 if (left <= 0)
879 break;
880 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_message,
881 tvb, offset, left, ENC_ASCII0x00000000);
882 break;
883 case MS_CHAP_V2_FAILURE4:
884 if (left <= 0)
885 break;
886 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_failure_request,
887 tvb, offset, left, ENC_ASCII0x00000000);
888 break;
889 default:
890 proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_data, tvb, offset, left, ENC_NA0x00000000);
891 break;
892 }
893}
894
895static bool_Bool
896realm_is_3gpp(char** realm_tokens, unsigned *nrealm_tokensp)
897{
898 unsigned nrealm_tokens = g_strv_length(realm_tokens);
899 if (nrealm_tokensp) {
900 *nrealm_tokensp = nrealm_tokens;
901 }
902
903 if (nrealm_tokens < 5 ||
904 g_ascii_strncasecmp(realm_tokens[nrealm_tokens - 4], "mnc", 3) ||
905 g_ascii_strncasecmp(realm_tokens[nrealm_tokens - 3], "mcc", 3) ||
906 g_ascii_strncasecmp(realm_tokens[nrealm_tokens - 2], "3gppnetwork", 11) ||
907 g_ascii_strncasecmp(realm_tokens[nrealm_tokens - 1], "org", 3)) {
908 return false0;
909 }
910 return true1;
911}
912
913/* Dissect the 3GPP identity */
914bool_Bool
915dissect_eap_identity_3gpp(tvbuff_t *tvb, packet_info* pinfo, proto_tree* tree, unsigned offset, unsigned size)
916{
917 unsigned mnc = 0;
918 unsigned mcc = 0;
919 unsigned mcc_mnc = 0;
920 proto_tree* eap_identity_tree = NULL((void*)0);
921 uint32_t eap_identity_prefix = 0;
922 const char* identity = NULL((void*)0);
923 char** tokens = NULL((void*)0);
924 char** realm_tokens = NULL((void*)0);
925 unsigned ntokens = 0;
926 unsigned nrealm_tokens = 0;
927 const char* mnc_token;
928 const char* mcc_token;
929 bool_Bool ret = false0;
930 int hf_eap_identity_mcc_mnc;
931 proto_item* item;
932
933 /* See 3GPP TS 23.003, 3GPP TS 29.273, and RFCs 4186, 4187, 5247, 9048.
934 *
935 * XXX - The possible use of "Decorated NAIs" (prepending a string for
936 * source routing as described in RFC 4282 Section 2.7) is not handled
937 * here. We would need to process '!' as a delimiter in the username.
938 */
939
940 /* Check for Encrypted IMSI - NULL prefix byte */
941 if (tvb_get_uint8(tvb, offset) == 0x00) {
942 /* Check if the identity string complies with ASCII character set. Encrypted IMSI
943 * identities use Base64 encoding and should therefore be ASCII-compliant.
944 */
945 if (size < 2 || tvb_ascii_isprint(tvb, offset + 1, size - 1) == false0) {
946 goto end;
947 }
948 identity = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset + 1, size - 1, ENC_ASCII0x00000000);
949 /* Encrypted IMSIs must be delimited twice:
950 * (1) Once to tokenize the 3GPP realm from the Certificate Serial Number
951 * using the ',' character
952 * (2) Once to tokenize the 3GPP realm using the '@' character
953 */
954 tokens = g_strsplit_set(identity, ",", -1);
955
956 ntokens = g_strv_length(tokens);
957 if (ntokens < 2 || g_ascii_strncasecmp(tokens[1], "CertificateSerialNumber=", strlen("CertificateSerialNumber="))) {
958 goto end;
959 }
960
961 /* The Realm is optional in the Encrypted IMSI format, apparently.
962 * So add the prefix, identity, and cert before checking for the realm.
963 * Consider the dissection successful and return true from this point.
964 */
965 ret = true1;
966
967 /* Skip the null byte when adding the full identity to avoid an expert info.
968 * (Does escaping it make sense?)
969 */
970 item = proto_tree_add_item(tree, hf_eap_identity_full, tvb, offset + 1, size - 1, ENC_ASCII0x00000000);
971 eap_identity_tree = proto_item_add_subtree(item, ett_identity);
972 proto_tree_add_item_ret_uint(eap_identity_tree, hf_eap_identity_prefix, tvb, offset, 1, ENC_ASCII0x00000000, &eap_identity_prefix);
973 proto_tree_add_string(eap_identity_tree, hf_eap_identity_type,
974 tvb, offset, 1, val_to_str_const(eap_identity_prefix, eap_identity_prefix_vals, "Unknown"));
975 offset += 1;
976 size -= 1;
977
978#if 0
979 /* XXX - Would adding the Base64 decoded (but still encrypted) IMSI
980 * be of any use?
981 */
982 tvbuff_t *decoded_tvb = base64_to_tvb(tvb, tokens[0]);
983 if (tvb_reported_length(decoded_tvb)) {
984 add_new_data_source(pinfo, decoded_tvb, "Encrypted IMSI");
985 }
986#endif
987
988 /* We have already checked above that the identity was valid ASCII so
989 * offsets in the tokens are the same as in the TVB. */
990 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset, (int)strlen(tokens[0]), ENC_ASCII0x00000000);
991 offset += (int)(strlen(tokens[0]) + 1 + strlen("CertificateSerialNumber="));
992 const char* cert = tokens[1] + strlen("CertificateSerialNumber=");
993
994 /* Add Certificate Serial Number to the tree */
995 proto_tree_add_item(eap_identity_tree, hf_eap_identity_certificate_sn, tvb,
996 offset, (int)strlen(cert), ENC_ASCII0x00000000);
997
998 /* Check for the optional NAI Realm string */
999 if (ntokens != 3 || g_ascii_strncasecmp(tokens[2], "Realm=", 6)) {
1000 goto end;
1001 }
1002
1003 const char* realm = strchr(tokens[2], '@');
1004 if (!realm) {
1005 goto end;
1006 }
1007
1008 realm += 1;
1009 realm_tokens = g_strsplit_set(realm, ".", -1);
1010
1011 /* Check for a realm of the form
1012 .mnc<mnc>.mcc<mcc>.3gppnetwork.org
1013 */
1014 if (!realm_is_3gpp(realm_tokens, &nrealm_tokens)) {
1015 goto end;
1016 }
1017 } else {
1018 /* Check if identity string complies with ASCII character set */
1019 if (tvb_ascii_isprint(tvb, offset, size) == false0) {
1020 goto end;
1021 }
1022 /* All other identities may be delimited with the '@' character */
1023 identity = (char*)tvb_get_string_enc(pinfo->pool, tvb, offset, size, ENC_ASCII0x00000000);
1024 tokens = g_strsplit_set(identity, "@", -1);
1025
1026 ntokens = g_strv_length(tokens);
1027 /* tokens[0] is the identity, tokens[1] is the NAI Realm */
1028 if (ntokens != 2) {
1029 goto end;
1030 }
1031
1032 /* Check for valid EAP Identity strings based on tokens and 3GPP-format */
1033 realm_tokens = g_strsplit_set(tokens[1], ".", -1);
1034
1035 /* The identity must have the form of
1036 <username>@...mnc<mnc>.mcc<mcc>.3gppnetwork.org
1037 If not, we don't have a 3GPP identity.
1038 */
1039 if (!realm_is_3gpp(realm_tokens, &nrealm_tokens)) {
1040 goto end;
1041 }
1042
1043 const char* label = realm_tokens[nrealm_tokens - 5];
1044
1045 /* We have a 3GPP realm. Add the full identity, and a tree to add the
1046 * MNC and MCC below.
1047 */
1048 ret = true1;
1049 item = proto_tree_add_item(tree, hf_eap_identity_full, tvb, offset, size, ENC_ASCII0x00000000);
1050 eap_identity_tree = proto_item_add_subtree(item, ett_identity);
1051
1052 if ((g_ascii_strncasecmp(label, "wlan", 4) == 0) ||
1053 (g_ascii_strncasecmp(label, "epc", 3) == 0) ||
1054 (g_ascii_strncasecmp(label, "gan", 3) == 0)) {
1055
1056 /* It is very likely that we have an identity (EAP-AKA/EAP-SIM) using
1057 * a single-character prefix. (XXX - Perhaps not all of these should
1058 * be treated as prefixes. GAN might not use the prefix for fast
1059 * re-authentication.) */
1060 proto_tree_add_item_ret_uint(eap_identity_tree, hf_eap_identity_prefix, tvb, offset, 1, ENC_ASCII0x00000000, &eap_identity_prefix);
1061 item = proto_tree_add_string(eap_identity_tree, hf_eap_identity_type,
1062 tvb, offset, 1, val_to_str_const(eap_identity_prefix, eap_identity_prefix_vals, "Unknown"));
1063
1064 switch(eap_identity_prefix) {
1065 case '0': /* EAP-AKA Permanent */
1066 case '1': /* EAP-SIM Permanent */
1067 case '6': /* EAP-AKA' Permanent */
1068 dissect_e212_utf8_imsi(tvb, pinfo, eap_identity_tree, offset + 1, (unsigned)strlen(tokens[0]) - 1);
1069 break;
1070 case '2': /* EAP-AKA Pseudonym */
1071 case '3': /* EAP-SIM Pseudonym */
1072 case '7': /* EAP-AKA' Pseudonym */
1073 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset + 1, (unsigned)strlen(tokens[0]) - 1, ENC_ASCII0x00000000);
1074 break;
1075 case '4': /* EAP-AKA Reauth ID */
1076 case '5': /* EAP-SIM Reauth ID */
1077 case '8': /* EAP-AKA' Reauth ID */
1078 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset + 1, (unsigned)strlen(tokens[0]) - 1, ENC_ASCII0x00000000);
1079 break;
1080 case 'C': /* Conservative Peer */
1081 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset + 1, (unsigned)strlen(tokens[0]) - 1, ENC_ASCII0x00000000);
1082 break;
1083 case 'a': /* Anonymous User */
1084 /* This is not really a prefix, just a username "anonymous" */
1085 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset, (unsigned)strlen(tokens[0]), ENC_ASCII0x00000000);
1086 break;
1087 case 'G': /* TODO: 'G' Unknown */
1088 case 'I': /* TODO: 'I' Unknown */
1089 default:
1090 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset + 1, (unsigned)strlen(tokens[0]) - 1, ENC_ASCII0x00000000);
1091 expert_add_info(pinfo, item, &ei_eap_identity_invalid);
1092 }
1093 } else {
1094 /* It's a 3GPP realm, but probably not using a prefix, e.g. in 5G. */
1095 proto_tree_add_item(eap_identity_tree, hf_eap_identity, tvb, offset, (int)strlen(tokens[0]), ENC_ASCII0x00000000);
1096 }
1097 }
1098
1099 /* EAP identities do not always equate to IMSIs. We should
1100 * still add the MCC and MNC values if present. */
1101 mnc_token = realm_tokens[nrealm_tokens - 4];
1102 mcc_token = realm_tokens[nrealm_tokens - 3];
1103 if (!ws_strtou(mnc_token + 3, NULL((void*)0), &mnc) || !ws_strtou(mcc_token + 3, NULL((void*)0), &mcc)) {
1104 goto end;
1105 }
1106
1107 if (!try_val_to_str_ext(mcc * 100 + mnc, &mcc_mnc_2digits_codes_ext)) {
1108 /* May have
1109 * (1) an invalid 2-digit MNC so it won't resolve,
1110 * (2) an invalid 3-digit MNC so it won't resolve, or
1111 * (3) a valid 3-digit MNC.
1112 * For all cases we treat as 3-digit MNC and continue. */
1113 mcc_mnc = 1000 * mcc + mnc;
1114 hf_eap_identity_mcc_mnc = hf_eap_identity_mcc_mnc_3digits;
1115 } else {
1116 /* We got a 2-digit MNC match */
1117 mcc_mnc = 100 * mcc + mnc;
1118 hf_eap_identity_mcc_mnc = hf_eap_identity_mcc_mnc_2digits;
1119 }
1120
1121 if (tvb_find_uint8_length(tvb, offset, size, '@', &offset)) {
1122 /* Should always be true. */
1123 offset += 1;
1124 for (int i = 0; realm_tokens[i] != mnc_token; ++i) {
1125 offset += (unsigned)(strlen(realm_tokens[i])) + 1;
1126 }
1127 /* XXX - This presentation order is the opposite of the "usual" one.
1128 * Post MCC first to maintain typical code order
1129 */
1130 /* Add MCC to tree */
1131 proto_tree_add_uint(eap_identity_tree, hf_eap_identity_mcc, tvb,
1132 offset + (unsigned)strlen(mnc_token) + 1 + (unsigned)strlen("mcc"),
1133 (unsigned)strlen(mcc_token) - (unsigned)strlen("mcc"), mcc);
1134 /* Add MNC to tree */
1135 proto_tree_add_uint(eap_identity_tree, hf_eap_identity_mcc_mnc, tvb,
1136 offset + (unsigned)strlen("mnc"), (unsigned)strlen(mnc_token) - (unsigned)strlen("mnc"), mcc_mnc);
1137 }
1138
1139end:
1140 g_strfreev(tokens);
1141 g_strfreev(realm_tokens);
1142
1143 return ret;
1144}
1145
1146static void
1147dissect_eap_identity(tvbuff_t *tvb, packet_info* pinfo, proto_tree* tree, unsigned offset, unsigned size)
1148{
1149 proto_item *item;
1150 /*
1151 * Try to dissect as a 3GPP identity.
1152 *
1153 * XXX - what other types of identity are there?
1154 */
1155 if (!dissect_eap_identity_3gpp(tvb, pinfo, tree, offset, size)) {
1156 item = proto_tree_add_item(tree, hf_eap_identity, tvb, offset, size, ENC_ASCII0x00000000);
1157 /* XXX - RFC 7542 revises earlier standards by allowing UTF-8 in the
1158 * NAI (username and realm); if this happens in EAP, remove the expert info. */
1159 if (tvb_ascii_isprint(tvb, offset, size) == false0) {
1160 expert_add_info(pinfo, item, &ei_eap_identity_nonascii);
1161 }
1162 }
1163}
1164
1165static void
1166dissect_eap_sim(proto_tree *eap_tree, tvbuff_t *tvb, packet_info* pinfo, unsigned offset, unsigned size)
1167{
1168 unsigned left = size;
1169
1170 proto_tree_add_item(eap_tree, hf_eap_sim_subtype, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1171
1172 offset += 1;
1173 left -= 1;
1174
1175 if (left < 2)
1176 return;
1177 proto_tree_add_item(eap_tree, hf_eap_sim_reserved, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1178 offset += 2;
1179 left -= 2;
1180
1181 /* Rest of EAP-SIM data is in Type-Len-Value format. */
1182 while (left >= 2) {
1183 uint8_t type, length;
1184 int padding;
1185 proto_item *pi;
1186 proto_tree *attr_tree;
1187 unsigned aoffset;
1188 unsigned aleft;
1189
1190 aoffset = offset;
1191 type = tvb_get_uint8(tvb, aoffset);
1192 length = tvb_get_uint8(tvb, aoffset + 1);
1193 aleft = 4 * length;
1194
1195 pi = proto_tree_add_none_format(eap_tree, hf_eap_sim_subtype_attribute, tvb,
1196 aoffset, aleft, "EAP-SIM Attribute: %s (%d)",
1197 val_to_str_ext_const(type,
1198 &eap_sim_aka_attribute_vals_ext,
1199 "Unknown"),
1200 type);
1201 attr_tree = proto_item_add_subtree(pi, ett_eap_sim_attr);
1202 proto_tree_add_uint(attr_tree, hf_eap_sim_subtype_type, tvb, aoffset, 1, type);
1203 aoffset += 1;
1204 aleft -= 1;
1205
1206 pi = proto_tree_add_item(attr_tree, hf_eap_sim_subtype_length, tvb, aoffset, 1, ENC_BIG_ENDIAN0x00000000);
1207 if (length == 0) {
1208 expert_add_info(pinfo, pi, &ei_eap_bad_length);
1209 break;
1210 }
1211 aoffset += 1;
1212 aleft -= 1;
1213
1214 switch(type){
1215 case AT_IDENTITY14:
1216 proto_tree_add_item(attr_tree, hf_eap_identity_actual_len, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1217 dissect_eap_identity(tvb, pinfo, attr_tree, aoffset + 2, tvb_get_ntohs(tvb, aoffset));
1218 /* If we have a disparity between the EAP-SIM length (minus the
1219 * first 4 bytes of header fields) * 4 and the Identity Actual
1220 * Length then it's padding and we need to adjust for that
1221 * accurately before looking at the next EAP-SIM attribute. */
1222 padding = ((length - 1) * 4) - tvb_get_ntohs(tvb, aoffset);
1223 if (padding != 0) {
1224 proto_tree_add_item(attr_tree, hf_eap_identity_padding, tvb,
1225 aoffset + 2 + tvb_get_ntohs(tvb, aoffset), padding, ENC_NA0x00000000);
1226 }
1227 break;
1228 case AT_NOTIFICATION12:
1229 proto_tree_add_item(attr_tree, hf_eap_sim_notification_type, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1230 break;
1231 case AT_CLIENT_ERROR_CODE22:
1232 proto_tree_add_item(attr_tree, hf_eap_sim_error_code_type, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1233 break;
1234 default:
1235 proto_tree_add_item(attr_tree, hf_eap_sim_subtype_value, tvb, aoffset, aleft, ENC_NA0x00000000);
1236 }
1237
1238 offset += 4 * length;
1239 left -= 4 * length;
1240 }
1241}
1242
1243static void
1244dissect_eap_aka(proto_tree *eap_tree, tvbuff_t *tvb, packet_info* pinfo, unsigned offset, unsigned size)
1245{
1246 unsigned left = size;
1247
1248 proto_tree_add_item(eap_tree, hf_eap_aka_subtype, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1249
1250 offset += 1;
1251 left -= 1;
1252
1253 if (left < 2)
1254 return;
1255 proto_tree_add_item(eap_tree, hf_eap_aka_reserved, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1256 offset += 2;
1257 left -= 2;
1258
1259 /* Rest of EAP-AKA data is in Type-Len-Value format. */
1260 while (left >= 2) {
1261 uint8_t type, length;
1262 uint32_t actual_length;
1263 int padding;
1264 proto_item *pi;
1265 proto_tree *attr_tree;
1266 unsigned aoffset;
1267 unsigned aleft;
1268
1269 aoffset = offset;
1270 type = tvb_get_uint8(tvb, aoffset);
1271 length = tvb_get_uint8(tvb, aoffset + 1);
1272 aleft = 4 * length;
1273
1274 pi = proto_tree_add_none_format(eap_tree, hf_eap_aka_subtype_attribute, tvb,
1275 aoffset, aleft, "EAP-AKA Attribute: %s (%d)",
1276 val_to_str_ext_const(type,
1277 &eap_sim_aka_attribute_vals_ext,
1278 "Unknown"),
1279 type);
1280 attr_tree = proto_item_add_subtree(pi, ett_eap_aka_attr);
1281 proto_tree_add_uint(attr_tree, hf_eap_aka_subtype_type, tvb, aoffset, 1, type);
1282 aoffset += 1;
1283 aleft -= 1;
1284
1285 pi = proto_tree_add_item(attr_tree, hf_eap_aka_subtype_length, tvb, aoffset, 1, ENC_BIG_ENDIAN0x00000000);
1286 if (length == 0) {
1287 expert_add_info(pinfo, pi, &ei_eap_bad_length);
1288 break;
1289 }
1290 aoffset += 1;
1291 aleft -= 1;
1292
1293 switch(type){
1294 case AT_RAND1:
1295 proto_tree_add_item(attr_tree, hf_eap_aka_reserved, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1296 aoffset += 2;
1297 aleft -= 2;
1298 proto_tree_add_item(attr_tree, hf_eap_aka_rand, tvb, aoffset, aleft, ENC_NA0x00000000);
1299 break;
1300 case AT_AUTN2:
1301 proto_tree_add_item(attr_tree, hf_eap_aka_reserved, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1302 aoffset += 2;
1303 aleft -= 2;
1304 proto_tree_add_item(attr_tree, hf_eap_aka_autn, tvb, aoffset, aleft, ENC_NA0x00000000);
1305 break;
1306 case AT_RES3:
1307 pi = proto_tree_add_item_ret_uint(attr_tree, hf_eap_aka_res_len, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000, &actual_length);
1308 aoffset += 2;
1309 if (actual_length == 0) {
1310 expert_add_info(pinfo, pi, &ei_eap_bad_length);
1311 break;
1312 }
1313 proto_tree_add_bits_item(attr_tree, hf_eap_aka_res, tvb, aoffset << 3, actual_length, ENC_NA0x00000000);
1314 break;
1315 case AT_AUTS4:
1316 proto_tree_add_item(attr_tree, hf_eap_aka_auts, tvb, aoffset, aleft, ENC_NA0x00000000);
1317 break;
1318 case AT_IDENTITY14:
1319 proto_tree_add_item_ret_uint(attr_tree, hf_eap_identity_actual_len, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000, &actual_length);
1320 dissect_eap_identity(tvb, pinfo, attr_tree, aoffset + 2, actual_length);
1321 /* If we have a disparity between the EAP-AKA length (minus the
1322 * first 4 bytes of header fields) * 4 and the Identity Actual
1323 * Length then it's padding and we need to adjust for that
1324 * accurately before looking at the next EAP-AKA attribute. */
1325 padding = ((length - 1) * 4) - actual_length;
1326 if (padding != 0) {
1327 proto_tree_add_item(attr_tree, hf_eap_identity_padding, tvb,
1328 aoffset + 2 + actual_length, padding, ENC_NA0x00000000);
1329 }
1330 break;
1331 case AT_NOTIFICATION12:
1332 proto_tree_add_item(attr_tree, hf_eap_aka_notification_type, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1333 break;
1334 case AT_CLIENT_ERROR_CODE22:
1335 proto_tree_add_item(attr_tree, hf_eap_aka_error_code_type, tvb, aoffset, 2, ENC_BIG_ENDIAN0x00000000);
1336 break;
1337 default:
1338 proto_tree_add_item(attr_tree, hf_eap_aka_subtype_value, tvb, aoffset, aleft, ENC_NA0x00000000);
1339 }
1340
1341 offset += 4 * length;
1342 left -= 4 * length;
1343 }
1344}
1345
1346static int
1347dissect_eap_pax(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, unsigned offset, unsigned size)
1348{
1349 static int * const pax_flags[] = {
1350 &hf_eap_pax_flags_mf,
1351 &hf_eap_pax_flags_ce,
1352 &hf_eap_pax_flags_ai,
1353 &hf_eap_pax_flags_reserved,
1354 NULL((void*)0)
1355 };
1356 uint32_t opcode;
1357 uint64_t flags;
1358 uint32_t len;
1359
1360 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_opcode, tvb, offset, 1, ENC_NA0x00000000, &opcode);
1361 offset++;
1362
1363 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1364 val_to_str(pinfo->pool, opcode, eap_pax_opcode_vals, "Unknown opcode (0x%02X)"));
1365
1366 proto_tree_add_bitmask_ret_uint64(eap_tree, tvb, offset, hf_eap_pax_flags, ett_eap_pax_flags,
1367 pax_flags, ENC_BIG_ENDIAN0x00000000, &flags);
1368 offset++;
1369
1370 proto_tree_add_item(eap_tree, hf_eap_pax_mac_id, tvb, offset, 1, ENC_NA0x00000000);
1371 offset++;
1372
1373 proto_tree_add_item(eap_tree, hf_eap_pax_dh_group_id, tvb, offset, 1, ENC_NA0x00000000);
1374 offset++;
1375
1376 proto_tree_add_item(eap_tree, hf_eap_pax_public_key_id, tvb, offset, 1, ENC_NA0x00000000);
1377 offset++;
1378
1379 switch (opcode) {
1380 case PAX_STD_10x01:
1381 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_a_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1382 offset += 2;
1383 proto_tree_add_item(eap_tree, hf_eap_pax_a, tvb, offset, len, ENC_NA0x00000000);
1384 offset += len;
1385 len = 5 + size - offset;
1386 proto_tree_add_item(eap_tree, hf_eap_pax_mac_icv, tvb, offset, len, ENC_NA0x00000000);
1387 offset += len;
1388 break;
1389 case PAX_STD_20x02:
1390 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_b_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1391 offset += 2;
1392 proto_tree_add_item(eap_tree, hf_eap_pax_b, tvb, offset, len, ENC_NA0x00000000);
1393 offset += len;
1394 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_cid_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1395 offset += 2;
1396 proto_tree_add_item(eap_tree, hf_eap_pax_cid, tvb, offset, len, ENC_ASCII0x00000000);
1397 offset += len;
1398 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_mac_ck_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1399 offset += 2;
1400 proto_tree_add_item(eap_tree, hf_eap_pax_mac_ck, tvb, offset, len, ENC_NA0x00000000);
1401 offset += len;
1402 if (flags & EAP_PAX_FLAG_AI0x04) {
1403 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_ade_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1404 offset += 2;
1405 proto_tree_add_item(eap_tree, hf_eap_pax_ade, tvb, offset, len, ENC_NA0x00000000);
1406 offset += len;
1407 }
1408 len = 5 + size - offset;
1409 proto_tree_add_item(eap_tree, hf_eap_pax_mac_icv, tvb, offset, len, ENC_NA0x00000000);
1410 offset += len;
1411 break;
1412 case PAX_STD_30x03:
1413 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_mac_ck_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1414 offset += 2;
1415 proto_tree_add_item(eap_tree, hf_eap_pax_mac_ck, tvb, offset, len, ENC_NA0x00000000);
1416 offset += len;
1417 if (flags & EAP_PAX_FLAG_AI0x04) {
1418 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_ade_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1419 offset += 2;
1420 proto_tree_add_item(eap_tree, hf_eap_pax_ade, tvb, offset, len, ENC_NA0x00000000);
1421 offset += len;
1422 }
1423 len = 5 + size - offset;
1424 proto_tree_add_item(eap_tree, hf_eap_pax_mac_icv, tvb, offset, len, ENC_NA0x00000000);
1425 offset += len;
1426 break;
1427 case PAX_ACK0x21:
1428 if (flags & EAP_PAX_FLAG_AI0x04) {
1429 proto_tree_add_item_ret_uint(eap_tree, hf_eap_pax_ade_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1430 offset += 2;
1431 proto_tree_add_item(eap_tree, hf_eap_pax_ade, tvb, offset, len, ENC_NA0x00000000);
1432 offset += len;
1433 }
1434 len = 5 + size - offset;
1435 proto_tree_add_item(eap_tree, hf_eap_pax_mac_icv, tvb, offset, len, ENC_NA0x00000000);
1436 offset += len;
1437 break;
1438 case PAX_SEC_10x11:
1439 case PAX_SEC_20x12:
1440 case PAX_SEC_30x13:
1441 case PAX_SEC_40x14:
1442 case PAX_SEC_50x15:
1443 /* TODO implement */
1444 default:
1445 break;
1446 }
1447
1448 return offset;
1449}
1450
1451static unsigned
1452dissect_eap_psk_pchannel(proto_tree *eap_tree, tvbuff_t *tvb, unsigned offset, unsigned size)
1453{
1454 /* The protected channel (PCHANNEL) content is encrypted so for now just present
1455 * it as a binary blob */
1456 proto_tree_add_item(eap_tree, hf_eap_psk_pchannel, tvb, offset, size, ENC_NA0x00000000);
1457 offset += size;
1458 return offset;
1459}
1460
1461static unsigned
1462dissect_eap_psk(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, unsigned offset, unsigned size)
1463{
1464 static int * const psk_flags[] = {
1465 &hf_eap_psk_flags_t,
1466 &hf_eap_psk_flags_reserved,
1467 NULL((void*)0)
1468 };
1469 uint64_t flags;
1470
1471 proto_tree_add_bitmask_ret_uint64(eap_tree, tvb, offset, hf_eap_psk_flags, ett_eap_psk_flags,
1472 psk_flags, ENC_NA0x00000000, &flags);
1473 offset++;
1474
1475 switch (flags & EAP_PSK_FLAGS_T_MASK0xC0) {
1476 case 0x00: /* T == 0 - EAP-PSK First Message */
1477 col_append_str(pinfo->cinfo, COL_INFO, " First Message");
1478 proto_tree_add_item(eap_tree, hf_eap_psk_rand_s, tvb, offset, 16, ENC_NA0x00000000);
1479 offset += 16;
1480 proto_tree_add_item(eap_tree, hf_eap_psk_id_s, tvb, offset, size + 5 - offset, ENC_ASCII0x00000000);
1481 offset = size;
1482 break;
1483 case 0x40: /* T == 1 - EAP-PSK Second Message */
1484 col_append_str(pinfo->cinfo, COL_INFO, " Second Message");
1485 proto_tree_add_item(eap_tree, hf_eap_psk_rand_s, tvb, offset, 16, ENC_NA0x00000000);
1486 offset += 16;
1487 proto_tree_add_item(eap_tree, hf_eap_psk_rand_p, tvb, offset, 16, ENC_NA0x00000000);
1488 offset += 16;
1489 proto_tree_add_item(eap_tree, hf_eap_psk_mac_p, tvb, offset, 16, ENC_NA0x00000000);
1490 offset += 16;
1491 proto_tree_add_item(eap_tree, hf_eap_psk_id_p, tvb, offset, size + 5 - offset, ENC_ASCII0x00000000);
1492 offset = size;
1493 break;
1494 case 0x80: /* T == 2 - EAP-PSK Third Message */
1495 col_append_str(pinfo->cinfo, COL_INFO, " Third Message");
1496 proto_tree_add_item(eap_tree, hf_eap_psk_rand_s, tvb, offset, 16, ENC_NA0x00000000);
1497 offset += 16;
1498 proto_tree_add_item(eap_tree, hf_eap_psk_mac_s, tvb, offset, 16, ENC_NA0x00000000);
1499 offset += 16;
1500 offset = dissect_eap_psk_pchannel(eap_tree, tvb, offset, size + 5 - offset);
1501 break;
1502 case 0xC0: /* T == 3 - EAP-PSK Fourth Message */
1503 col_append_str(pinfo->cinfo, COL_INFO, " Fourth Message");
1504 proto_tree_add_item(eap_tree, hf_eap_psk_rand_s, tvb, offset, 16, ENC_NA0x00000000);
1505 offset += 16;
1506 offset = dissect_eap_psk_pchannel(eap_tree, tvb, offset, size + 5 - offset);
1507 break;
1508 default:
1509 break;
1510 }
1511
1512 return offset;
1513}
1514
1515static unsigned
1516dissect_eap_gpsk_csuite_sel(proto_tree *eap_tree, tvbuff_t *tvb, unsigned offset)
1517{
1518 proto_tree *csuite_tree;
1519 csuite_tree = proto_tree_add_subtree(eap_tree, tvb, offset, 6, ett_eap_gpsk_csuite_sel,
1520 NULL((void*)0), "EAP-GPSK CSuite_Sel");
1521 proto_tree_add_item(csuite_tree, hf_eap_gpsk_csuite_vendor, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1522 offset += 4;
1523 proto_tree_add_item(csuite_tree, hf_eap_gpsk_csuite_specifier, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1524 offset += 2;
1525 return offset;
1526}
1527
1528static unsigned
1529dissect_eap_gpsk_csuite_list(proto_tree *eap_tree, tvbuff_t *tvb, unsigned offset)
1530{
1531 unsigned start_offset = offset;
1532 uint16_t len;
1533 proto_tree *list_tree, *csuite_tree;
1534
1535 len = tvb_get_ntohs(tvb, offset) + 2;
1536 list_tree = proto_tree_add_subtree(eap_tree, tvb, offset, len, ett_eap_gpsk_csuite_list,
1537 NULL((void*)0), "EAP-GPSK CSuite List");
1538 proto_tree_add_item(list_tree, hf_eap_gpsk_csuite_list_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1539 offset += 2;
1540
1541 while (offset < start_offset + len) {
1542 csuite_tree = proto_tree_add_subtree(list_tree, tvb, offset, 6, ett_eap_gpsk_csuite,
1543 NULL((void*)0), "CSuite");
1544 proto_tree_add_item(csuite_tree, hf_eap_gpsk_csuite_vendor, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1545 offset += 4;
1546 proto_tree_add_item(csuite_tree, hf_eap_gpsk_csuite_specifier, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1547 offset += 2;
1548 }
1549 return offset;
1550}
1551
1552static int
1553dissect_eap_sake_attribute(proto_tree *eap_tree, packet_info* pinfo, tvbuff_t *tvb, unsigned offset, unsigned size)
1554{
1555 unsigned start_offset = offset;
1556 uint8_t type;
1557 uint8_t len;
1558 proto_tree *attr_tree;
1559
1560 type = tvb_get_uint8(tvb, offset);
1561 len = tvb_get_uint8(tvb, offset + 1);
1562
1563 if (len < 2 || len > size) {
1564 return -1;
1565 }
1566 attr_tree = proto_tree_add_subtree_format(eap_tree, tvb, offset, len, ett_eap_sake_attr, NULL((void*)0),
1567 "EAP-SAKE Attribute: %s",
1568 val_to_str(pinfo->pool, type, eap_sake_attr_type_vals,
1569 "Unknown (%d)"));
1570
1571 proto_tree_add_item(attr_tree, hf_eap_sake_attr_type, tvb, offset, 1, ENC_NA0x00000000);
1572 offset++;
1573 proto_tree_add_item(attr_tree, hf_eap_sake_attr_len, tvb, offset, 1, ENC_NA0x00000000);
1574 offset++;
1575 len -= 2;
1576
1577 switch (type) {
1578 case SAKE_AT_SERVERID5:
1579 case SAKE_AT_PEERID6:
1580 proto_tree_add_item(attr_tree, hf_eap_sake_attr_value_str, tvb, offset, len, ENC_ASCII0x00000000);
1581 offset += len;
1582 break;
1583 case SAKE_AT_MSK_LIFE132:
1584 proto_tree_add_item(attr_tree, hf_eap_sake_attr_value_uint48, tvb, offset, len,
1585 ENC_BIG_ENDIAN0x00000000);
1586 offset += len;
1587 break;
1588 case SAKE_AT_RAND_S1:
1589 case SAKE_AT_RAND_P2:
1590 case SAKE_AT_MIC_S3:
1591 case SAKE_AT_MIC_P4:
1592 case SAKE_AT_SPI_S7:
1593 case SAKE_AT_SPI_P8:
1594 case SAKE_AT_ANY_ID_REQ9:
1595 case SAKE_AT_PERM_ID_REQ10:
1596 case SAKE_AT_ENCR_DATA128:
1597 case SAKE_AT_IV129:
1598 case SAKE_AT_PADDING130:
1599 case SAKE_AT_NEXT_TMPID131:
1600 default:
1601 proto_tree_add_item(attr_tree, hf_eap_sake_attr_value, tvb, offset, len, ENC_NA0x00000000);
1602 offset += len;
1603 break;
1604 }
1605 return (int)(offset - start_offset);
1606}
1607
1608static void
1609dissect_eap_sake_attributes(proto_tree *eap_tree, packet_info* pinfo, tvbuff_t *tvb, unsigned offset, unsigned end)
1610{
1611 int attr_size;
1612 while (offset < end) {
1613 attr_size = dissect_eap_sake_attribute(eap_tree, pinfo, tvb, offset, end - offset);
1614 if (attr_size == -1) {
1615 break;
1616 }
1617 offset += attr_size;
1618 }
1619}
1620
1621static void
1622dissect_eap_sake(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo _U___attribute__((unused)), unsigned offset, unsigned size)
1623{
1624 uint32_t version;
1625 uint32_t subtype;
1626 unsigned end = offset + size;
1627
1628 proto_tree_add_item_ret_uint(eap_tree, hf_eap_sake_version, tvb, offset, 1, ENC_NA0x00000000, &version);
1629 offset++;
1630 if (version != 2) {
1631 /* RFC 4763 specify version 2. Everything else is unsupported */
1632 return;
1633 }
1634 proto_tree_add_item(eap_tree, hf_eap_sake_session_id, tvb, offset, 1, ENC_NA0x00000000);
1635 offset++;
1636 proto_tree_add_item_ret_uint(eap_tree, hf_eap_sake_subtype, tvb, offset, 1, ENC_NA0x00000000, &subtype);
1637 offset++;
1638
1639 switch (subtype) {
1640 case SAKE_CHALLENGE1:
1641 case SAKE_CONFIRM2:
1642 case SAKE_AUTH_REJECT3:
1643 case SAKE_IDENTITY4:
1644 dissect_eap_sake_attributes(eap_tree, pinfo, tvb, offset, end);
1645 break;
1646 default:
1647 break;
1648 }
1649}
1650
1651static unsigned
1652dissect_eap_gpsk(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, unsigned offset, unsigned size)
1653{
1654 uint32_t opcode;
1655 uint32_t len;
1656
1657 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_opcode, tvb, offset, 1, ENC_NA0x00000000, &opcode);
1658 offset++;
1659 col_append_fstr(pinfo->cinfo, COL_INFO, " %s",
1660 val_to_str(pinfo->pool, opcode, eap_gpsk_opcode_vals, "Unknown opcode (0x%02X)"));
1661
1662 switch (opcode) {
1663 case GPSK_GPSK_11:
1664 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_id_server_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1665 offset += 2;
1666 proto_tree_add_item(eap_tree, hf_eap_gpsk_id_server, tvb, offset, len, ENC_ASCII0x00000000);
1667 offset += len;
1668 proto_tree_add_item(eap_tree, hf_eap_gpsk_rand_server, tvb, offset, 32, ENC_NA0x00000000);
1669 offset += 32;
1670 offset = dissect_eap_gpsk_csuite_list(eap_tree, tvb, offset);
1671 break;
1672 case GPSK_GPSK_22:
1673 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_id_peer_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1674 offset += 2;
1675 proto_tree_add_item(eap_tree, hf_eap_gpsk_id_peer, tvb, offset, len, ENC_ASCII0x00000000);
1676 offset += len;
1677 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_id_server_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1678 offset += 2;
1679 proto_tree_add_item(eap_tree, hf_eap_gpsk_id_server, tvb, offset, len, ENC_ASCII0x00000000);
1680 offset += len;
1681 proto_tree_add_item(eap_tree, hf_eap_gpsk_rand_peer, tvb, offset, 32, ENC_NA0x00000000);
1682 offset += 32;
1683 proto_tree_add_item(eap_tree, hf_eap_gpsk_rand_server, tvb, offset, 32, ENC_NA0x00000000);
1684 offset += 32;
1685 offset = dissect_eap_gpsk_csuite_list(eap_tree, tvb, offset);
1686 offset = dissect_eap_gpsk_csuite_sel(eap_tree, tvb, offset);
1687 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_pd_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1688 offset += 2;
1689 if (len > 0) {
1690 proto_tree_add_item(eap_tree, hf_eap_gpsk_pd_payload, tvb, offset, len, ENC_NA0x00000000);
1691 offset += len;
1692 }
1693 len = size + 5 - offset;
1694 proto_tree_add_item(eap_tree, hf_eap_gpsk_payload_mac, tvb, offset, len, ENC_NA0x00000000);
1695 offset += len;
1696 break;
1697 case GPSK_GPSK_33:
1698 proto_tree_add_item(eap_tree, hf_eap_gpsk_rand_peer, tvb, offset, 32, ENC_NA0x00000000);
1699 offset += 32;
1700 proto_tree_add_item(eap_tree, hf_eap_gpsk_rand_server, tvb, offset, 32, ENC_NA0x00000000);
1701 offset += 32;
1702 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_id_server_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1703 offset += 2;
1704 proto_tree_add_item(eap_tree, hf_eap_gpsk_id_server, tvb, offset, len, ENC_ASCII0x00000000);
1705 offset += len;
1706 offset = dissect_eap_gpsk_csuite_sel(eap_tree, tvb, offset);
1707 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_pd_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1708 offset += 2;
1709 if (len > 0) {
1710 proto_tree_add_item(eap_tree, hf_eap_gpsk_pd_payload, tvb, offset, len, ENC_NA0x00000000);
1711 offset += len;
1712 }
1713 len = size + 5 - offset;
1714 proto_tree_add_item(eap_tree, hf_eap_gpsk_payload_mac, tvb, offset, len, ENC_NA0x00000000);
1715 offset += len;
1716 break;
1717 case GPSK_GPSK_44:
1718 proto_tree_add_item_ret_uint(eap_tree, hf_eap_gpsk_pd_payload_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &len);
1719 offset += 2;
1720 if (len > 0) {
1721 proto_tree_add_item(eap_tree, hf_eap_gpsk_pd_payload, tvb, offset, len, ENC_NA0x00000000);
1722 offset += len;
1723 }
1724 len = size + 5 - offset;
1725 proto_tree_add_item(eap_tree, hf_eap_gpsk_payload_mac, tvb, offset, len, ENC_NA0x00000000);
1726 offset += len;
1727 break;
1728 case GPSK_FAIL5:
1729 proto_tree_add_item(eap_tree, hf_eap_gpsk_failure_code, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1730 offset += 4;
1731 break;
1732 case GPSK_PROTECTED_FAIL6:
1733 proto_tree_add_item(eap_tree, hf_eap_gpsk_failure_code, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
1734 offset += 4;
1735 len = size + 5 - offset;
1736 proto_tree_add_item(eap_tree, hf_eap_gpsk_payload_mac, tvb, offset, len, ENC_NA0x00000000);
1737 offset += len;
1738 break;
1739 default:
1740 break;
1741 }
1742
1743 return offset;
1744}
1745
1746static unsigned
1747dissect_eap_msauth_tlv(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, unsigned offset, unsigned size)
1748{
1749 unsigned tlv_type, tlv_len, tlv_start;
1750 unsigned end = offset + size;
1751 proto_tree *tlv_tree, *tree, *ti_len;
1752
1753 tlv_tree = proto_tree_add_subtree(eap_tree, tvb, offset, size, ett_eap_msauth_tlv,
1754 NULL((void*)0), "Tag Length Values");
1755
1756next_tlv:
1757 tlv_start = offset;
1758 tlv_type = tvb_get_uint16(tvb, offset, ENC_BIG_ENDIAN0x00000000) & MSAUTH_TLV_TYPE0x3FFF;
1759 tlv_len = tvb_get_uint16(tvb, offset + 2, ENC_BIG_ENDIAN0x00000000);
1760
1761 tree = proto_tree_add_subtree_format(tlv_tree, tvb, offset, 4 + tlv_len,
1762 ett_eap_msauth_tlv_tree, NULL((void*)0), "TLV: t=%s(%d) l=%d",
1763 val_to_str_const(tlv_type, eap_msauth_tlv_type_vals, "Unknown"),
1764 tlv_type, 4 + tlv_len);
1765
1766 proto_tree_add_item(tree, hf_eap_msauth_tlv_mandatory, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1767 proto_tree_add_item(tree, hf_eap_msauth_tlv_reserved, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1768 proto_tree_add_item(tree, hf_eap_msauth_tlv_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1769 offset += 2;
1770
1771 proto_tree_add_item(tree, hf_eap_msauth_tlv_len, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1772 offset += 2;
1773
1774 switch (tlv_type) {
1775 case MSAUTH_TLV_TYPE_EXTENSION_RESULT3:
1776 proto_tree_add_item(tree, hf_eap_msauth_tlv_status, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000);
1777 offset += 2;
Value stored to 'offset' is never read
1778 break;
1779
1780 case MSAUTH_TLV_TYPE_EXTENSION_CRYPTOBINDING12:
1781 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_reserved, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1782 offset += 1;
1783 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1784 offset += 1;
1785 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_rcv_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1786 offset += 1;
1787 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_subtype, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
1788 offset += 1;
1789 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_nonce, tvb, offset, 32, ENC_NA0x00000000);
1790 offset += 32;
1791 proto_tree_add_item(tree, hf_eap_msauth_tlv_crypto_cmac, tvb, offset, 20, ENC_NA0x00000000);
1792 offset += 20;
1793 break;
1794
1795 default:
1796 ti_len = proto_tree_add_item(tree, hf_eap_msauth_tlv_val, tvb, offset, tlv_len, ENC_NA0x00000000);
1797 if (tlv_len > end - offset) {
1798 expert_add_info(pinfo, ti_len, &ei_eap_bad_length);
1799 }
1800 }
1801 offset = tlv_start + 4 + tlv_len;
1802
1803 if (offset < end) {
1804 goto next_tlv;
1805 }
1806
1807 return offset;
1808}
1809
1810
1811static int
1812dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U___attribute__((unused)))
1813{
1814 uint8_t eap_code;
1815 uint8_t eap_identifier;
1816 uint16_t eap_len;
1817 uint8_t eap_type;
1818 unsigned len;
1819 conversation_t *conversation;
1820 conv_state_t *conversation_state;
1821 wmem_map_t *conversation_state_map;
1822 frame_state_t *packet_state;
1823 int leap_state;
1824 proto_tree *ti, *ti_id, *ti_len;
1825 proto_tree *eap_tree;
1826 proto_tree *eap_tls_flags_tree;
1827 proto_item *eap_type_item;
1828 uint8_t curr_layer_num = p_get_proto_depth(pinfo, proto_eap);
1829
1830 /*
1831 * we could use a wmem_map again here but it is a little excessive for
1832 * a few flags, so instead we note that curr_layer_num is
1833 * uint8_t and the key for proto_data is at least uint32_t (though only
1834 * the bottom 24bits are usable due to PROTO_DEPTH_KEY) whilst our
1835 * flag space is small so we partition by curr_layer_num
1836 */
1837 uint32_t p_proto_data_layer = curr_layer_num << 8;
1838
1839 p_set_proto_depth(pinfo, proto_eap, curr_layer_num + 1);
1840
1841 col_set_str(pinfo->cinfo, COL_PROTOCOL, "EAP");
1842 col_clear(pinfo->cinfo, COL_INFO);
1843
1844 eap_code = tvb_get_uint8(tvb, 0);
1845 eap_identifier = tvb_get_uint8(tvb, 1);
1846
1847 col_add_str(pinfo->cinfo, COL_INFO,
1848 val_to_str(pinfo->pool, eap_code, eap_code_vals, "Unknown code (0x%02X)"));
1849
1850 /*
1851 * Find a conversation to which we belong; create one if we don't find it.
1852 *
1853 * EAP runs over RADIUS (which runs over UDP), EAPOL (Ethernet and 802.11,
1854 * known as 802.1X), PPP and other transports.
1855 *
1856 * Conversation tracking is required for 1) EAP-TLS reassembly and 2) tracking
1857 * the stage in the LEAP protocol. In both cases, the protocol starts with an
1858 * EAP-Request/Identity message which cannot be found in the middle of the
1859 * session. Use it as a signal to start a new conversation. This ensures that
1860 * the TLS dissector associates new TLS messages with a unique TLS session.
1861 *
1862 * For EAPOL frames the destination MAC in both directions can be the PAE
1863 * multicast group address which leads up to three conversations being
1864 * created instead of the single one so blast away those addresses but
1865 * fake the server port to provide something for ssl_packet_from_server
1866 */
1867 if (pinfo->src.type == AT_ETHER) {
1868 address *conv_src, *conv_dst;
1869 uint32_t conv_srcport = 0, conv_destport = 0;
1870 static address null_address = ADDRESS_INIT_NONE{AT_NONE, 0, ((void*)0), ((void*)0)};
1871 static uint8_t pae_group_address_mac_addr[6] = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
1872 static address pae_group_address = ADDRESS_INIT(AT_ETHER, sizeof(pae_group_address_mac_addr), pae_group_address_mac_addr){AT_ETHER, sizeof(pae_group_address_mac_addr), pae_group_address_mac_addr
, ((void*)0)}
;
1873 if (eap_code == EAP_REQUEST1) { /* server -> client */
1874 conv_src = &pae_group_address;
1875 conv_dst = &null_address;
1876 conv_srcport = 443;
1877 } else { /* client -> server */
1878 conv_src = &null_address;
1879 conv_dst = &pae_group_address;
1880 conv_destport = 443;
1881 }
1882 conversation_set_conv_addr_port_endpoints(pinfo, conv_src, conv_dst,
1883 conversation_pt_to_conversation_type(pinfo->ptype), conv_srcport, conv_destport);
1884 }
1885
1886 /*
1887 * TEAP supports chained authentications so we are unable to forcible
1888 * create a new conversation each time we see a EAP-Request/Identity
1889 */
1890 conversation = find_or_create_conversation(pinfo);
1891
1892 /*
1893 * Get the state information for the conversation; attach some if
1894 * we don't find it.
1895 *
1896 * EAP can also be nested (such as EAP-TEAP or EAP-TTLS/EAP-MSCHAPv2) so
1897 * conversations need to be partitioned by curr_layer_num.
1898 */
1899 conversation_state_map = conversation_get_proto_data(conversation, proto_eap);
1900 if (conversation_state_map == NULL((void*)0)) {
1901 conversation_state_map = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
1902 conversation_add_proto_data(conversation, proto_eap, conversation_state_map);
1903 }
1904 conversation_state = wmem_map_lookup(conversation_state_map, GUINT_TO_POINTER(curr_layer_num)((gpointer) (gulong) (curr_layer_num)));
1905 if (conversation_state == NULL((void*)0)) {
1906 /*
1907 * Attach state information to the conversation.
1908 */
1909 conversation_state = wmem_new(wmem_file_scope(), conv_state_t)((conv_state_t*)wmem_alloc((wmem_file_scope()), sizeof(conv_state_t
)))
;
1910 conversation_state->eap_tls_seq = -1;
1911 conversation_state->eap_reass_cookie = 0;
1912 conversation_state->leap_state = -1;
1913 conversation_state->last_eap_id_req = -1;
1914 conversation_state->last_eap_id_resp = -1;
1915 wmem_map_insert(conversation_state_map, GUINT_TO_POINTER(curr_layer_num)((gpointer) (gulong) (curr_layer_num)), conversation_state);
1916 }
1917
1918 /*
1919 * Set this now, so that it gets remembered even if we throw an exception
1920 * later.
1921 */
1922 if (eap_code == EAP_FAILURE4)
1923 conversation_state->leap_state = -1;
1924
1925 eap_len = tvb_get_ntohs(tvb, 2);
1926 len = eap_len;
1927
1928 ti = proto_tree_add_item(tree, proto_eap, tvb, 0, len, ENC_NA0x00000000);
1929 eap_tree = proto_item_add_subtree(ti, ett_eap);
1930
1931 proto_tree_add_item(eap_tree, hf_eap_code, tvb, 0, 1, ENC_BIG_ENDIAN0x00000000);
1932 ti_id = proto_tree_add_item(eap_tree, hf_eap_identifier, tvb, 1, 1, ENC_BIG_ENDIAN0x00000000);
1933 ti_len = proto_tree_add_item(eap_tree, hf_eap_len, tvb, 2, 2, ENC_BIG_ENDIAN0x00000000);
1934 if (len < 4 || (unsigned)len > tvb_reported_length(tvb)) {
1935 expert_add_info(pinfo, ti_len, &ei_eap_bad_length);
1936 }
1937
1938 bool_Bool visited = !!p_get_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_VISITED | p_proto_data_layer);
1939
1940 /* Detect message retransmissions. Since the protocol proceeds in lock-step,
1941 * reordering is not expected. If retransmissions somehow occur, we would have
1942 * to detect retransmissions via a bitmap. */
1943 bool_Bool is_duplicate_id = false0;
1944 if (eap_code == EAP_REQUEST1 || eap_code == EAP_RESPONSE2 ||
1945 eap_code == EAP_INITIATE5 || eap_code == EAP_FINISH6) {
1946 if (!visited) {
1947 int16_t *last_eap_id = eap_code == EAP_REQUEST1 || eap_code == EAP_INITIATE5 ?
1948 &conversation_state->last_eap_id_req :
1949 &conversation_state->last_eap_id_resp;
1950 is_duplicate_id = *last_eap_id == eap_identifier;
1951 *last_eap_id = eap_identifier;
1952 if (is_duplicate_id) {
1953 p_add_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_DUPLICATE_ID | p_proto_data_layer, GINT_TO_POINTER(1)((gpointer) (glong) (1)));
1954 }
1955 } else {
1956 is_duplicate_id = !!p_get_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_DUPLICATE_ID | p_proto_data_layer);
1957 }
1958 if (is_duplicate_id) {
1959 expert_add_info(pinfo, ti_id, &ei_eap_retransmission);
1960 }
1961 }
1962
1963 switch (eap_code) {
1964
1965 case EAP_SUCCESS3:
1966 case EAP_FAILURE4:
1967 break;
1968
1969 case EAP_REQUEST1:
1970 case EAP_RESPONSE2:
1971 eap_type = tvb_get_uint8(tvb, 4);
1972
1973 col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
1974 val_to_str_ext(pinfo->pool, eap_type, &eap_type_vals_ext,
1975 "Unknown type (0x%02x)"));
1976 eap_type_item = proto_tree_add_item(eap_tree, hf_eap_type, tvb, 4, 1, ENC_BIG_ENDIAN0x00000000);
1977
1978 if ((len > 5) || ((len == 5) && (eap_type == EAP_TYPE_ID1))) {
1979 unsigned offset = 5;
1980 unsigned size = len - offset;
1981
1982 switch (eap_type) {
1983 /*********************************************************************
1984 **********************************************************************/
1985 case EAP_TYPE_ID1:
1986 if (size > 0) {
1987 dissect_eap_identity(tvb, pinfo, eap_tree, offset, size);
1988 }
1989 if (!visited) {
1990 conversation_state->leap_state = 0;
1991 conversation_state->eap_tls_seq = -1;
1992 }
1993 break;
1994
1995 /*********************************************************************
1996 **********************************************************************/
1997 case EAP_TYPE_NOTIFY2:
1998 proto_tree_add_item(eap_tree, hf_eap_notification, tvb,
1999 offset, size, ENC_ASCII0x00000000);
2000 break;
2001
2002 /*********************************************************************
2003 **********************************************************************/
2004 case EAP_TYPE_NAK3:
2005 proto_tree_add_item(eap_tree, hf_eap_type_nak, tvb,
2006 offset, 1, ENC_BIG_ENDIAN0x00000000);
2007 break;
2008 /*********************************************************************
2009 **********************************************************************/
2010 case EAP_TYPE_MD54:
2011 {
2012 uint8_t value_size = tvb_get_uint8(tvb, offset);
2013 unsigned extra_len;
2014 proto_item *item;
2015
2016 /* Warn that this is an insecure EAP type. */
2017 expert_add_info(pinfo, eap_type_item, &ei_eap_mitm_attacks);
2018
2019 item = proto_tree_add_item(eap_tree, hf_eap_md5_value_size, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2020 if (value_size > (size - 1))
2021 {
2022 expert_add_info(pinfo, item, &ei_eap_md5_value_size_overflow);
2023 value_size = size - 1;
2024 }
2025 extra_len = size - 1 - value_size;
2026
2027 offset += 1;
2028 proto_tree_add_item(eap_tree, hf_eap_md5_value, tvb, offset, value_size, ENC_NA0x00000000);
2029 offset += value_size;
2030 if (extra_len > 0) {
2031 proto_tree_add_item(eap_tree, hf_eap_md5_extra_data, tvb, offset, extra_len, ENC_NA0x00000000);
2032 }
2033 }
2034 break;
2035
2036 case EAP_TYPE_GTC6:
2037 /* Warn that this is an insecure EAP type. */
2038 expert_add_info(pinfo, eap_type_item, &ei_eap_mitm_attacks);
2039 proto_tree_add_item(eap_type_item, eap_code == EAP_REQUEST1 ? hf_eap_gtc_challenge : hf_eap_gtc_response, tvb, offset, size, ENC_BIG_ENDIAN0x00000000);
2040 break;
2041
2042 /*********************************************************************
2043 EAP-TLS
2044 **********************************************************************/
2045 case EAP_TYPE_FAST43:
2046 case EAP_TYPE_PEAP25:
2047 case EAP_TYPE_TTLS21:
2048 case EAP_TYPE_TLS13:
2049 case EAP_TYPE_TEAP55:
2050 {
2051 bool_Bool more_fragments;
2052 bool_Bool has_length;
2053 uint32_t eap_tls_len;
2054 bool_Bool is_start;
2055 bool_Bool outer_tlvs = false0;
2056 uint32_t outer_tlvs_length = 0;
2057 int eap_tls_seq = -1;
2058 uint32_t eap_reass_cookie = 0;
2059 bool_Bool needs_reassembly = false0;
2060
2061 /* Flags field, 1 byte */
2062 ti = proto_tree_add_item(eap_tree, hf_eap_tls_flags, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2063 eap_tls_flags_tree = proto_item_add_subtree(ti, ett_eap_tls_flags);
2064 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_tls_flag_l, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &has_length);
2065 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_tls_flag_m, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &more_fragments);
2066 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_tls_flag_s, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &is_start);
2067
2068 switch (eap_type) {
2069 case EAP_TYPE_TEAP55:
2070 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_tls_flag_o, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &outer_tlvs);
2071 /* FALLTHROUGH */
2072 case EAP_TYPE_TTLS21:
2073 case EAP_TYPE_FAST43:
2074 case EAP_TYPE_PEAP25:
2075 proto_tree_add_item(eap_tls_flags_tree, hf_eap_tls_flags_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2076 break;
2077 }
2078 size -= 1;
2079 offset += 1;
2080
2081 /* Length field, 4 bytes, OPTIONAL. */
2082 if (has_length) {
2083 proto_tree_add_item_ret_uint(eap_tree, hf_eap_tls_len, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &eap_tls_len);
2084 size -= 4;
2085 offset += 4;
2086 }
2087
2088 /* Outer TLV Length field, 4 bytes, OPTIONAL. */
2089 if (outer_tlvs) {
2090 proto_tree_add_item_ret_uint(eap_tree, hf_eap_tls_outer_tlvs_len, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000, &outer_tlvs_length);
2091 size -= 4;
2092 offset += 4;
2093 }
2094
2095 if (is_start)
2096 conversation_state->eap_tls_seq = -1;
2097
2098 /* 4.1.1 Authority ID Data https://datatracker.ietf.org/doc/html/rfc4851#section-4.1.1 */
2099 if (eap_type == EAP_TYPE_FAST43 && is_start) {
2100 uint32_t length, type;
2101
2102 proto_tree_add_item_ret_uint(eap_tree, hf_eap_fast_type, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &type);
2103 size -= 2;
2104 offset += 2;
2105
2106 proto_tree_add_item_ret_uint(eap_tree, hf_eap_fast_length, tvb, offset, 2, ENC_BIG_ENDIAN0x00000000, &length);
2107 size -= 2;
2108 offset += 2;
2109
2110 proto_tree_add_item(eap_tree, hf_eap_data, tvb, offset, length, ENC_NA0x00000000);
2111
2112 switch (type) {
2113 case 4:
2114 proto_tree_add_item(eap_tree, hf_eap_fast_aidd, tvb, offset, length, ENC_NA0x00000000);
2115 break;
2116 }
2117 size -= length;
2118 offset += length;
2119
2120 }
2121
2122 if (size > 0) {
2123
2124 tvbuff_t *next_tvb = NULL((void*)0);
2125 bool_Bool save_fragmented;
2126
2127 /* If this is a retransmission, do not save the fragment. */
2128 if (is_duplicate_id) {
2129 next_tvb = tvb_new_subset_length(tvb, offset, size);
2130 call_data_dissector(next_tvb, pinfo, eap_tree);
2131 break;
2132 }
2133
2134 /*
2135 EAP/TLS is weird protocol (it comes from
2136 Microsoft after all).
2137
2138 If we have series of fragmented packets,
2139 then there's no way of knowing that from
2140 the packet itself, if it is the last packet
2141 in series, that is that the packet part of
2142 bigger fragmented set of data.
2143
2144 The only way to know is, by knowing
2145 that we are already in defragmentation
2146 "mode" and we are expecting packet
2147 carrying fragment of data. (either
2148 because we have not received expected
2149 amount of data, or because the packet before
2150 had "F"ragment flag set.)
2151
2152 The situation is alleviated by fact that it
2153 is simple ack/nack protocol so there's no
2154 place for out-of-order packets like it is
2155 possible with IP.
2156
2157 Anyway, point of this lengthy essay is that
2158 we have to keep state information in the
2159 conversation, so that we can put ourselves in
2160 defragmenting mode and wait for the last packet,
2161 and have to attach state to frames as well, so
2162 that we can handle defragmentation after the
2163 first pass through the capture.
2164 */
2165 /* See if we have a remembered defragmentation EAP ID. */
2166 packet_state = (frame_state_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_FRAME_STATE | p_proto_data_layer);
2167 if (packet_state == NULL((void*)0)) {
2168 /*
2169 * We haven't - does this message require reassembly?
2170 */
2171 if (!visited) {
2172 /*
2173 * This is the first time we've looked at this frame,
2174 * so it wouldn't have any remembered information.
2175 *
2176 * Therefore, we check whether this conversation has
2177 * a reassembly operation in progress, or whether
2178 * this frame has the Fragment flag set.
2179 */
2180 if (conversation_state->eap_tls_seq != -1) {
2181 /*
2182 * There's a reassembly in progress; the sequence number
2183 * of the previous fragment is
2184 * "conversation_state->eap_tls_seq", and the reassembly
2185 * ID is "conversation_state->eap_reass_cookie".
2186 *
2187 * We must include this frame in the reassembly.
2188 * We advance the sequence number, giving us the
2189 * sequence number for this fragment.
2190 */
2191 needs_reassembly = true1;
2192 conversation_state->eap_tls_seq++;
2193
2194 eap_reass_cookie = conversation_state->eap_reass_cookie;
2195 eap_tls_seq = conversation_state->eap_tls_seq;
2196 eap_tls_len = conversation_state->eap_tls_len;
2197 outer_tlvs_length = conversation_state->outer_tlvs_length;
2198 outer_tlvs = outer_tlvs_length > 0;
2199 } else if (more_fragments && has_length) {
2200 /*
2201 * This message has the Fragment flag set, so it requires
2202 * reassembly. It's the message containing the first
2203 * fragment (if it's a later fragment, the sequence
2204 * number in the conversation state would not be -1).
2205 *
2206 * If it doesn't include a length, however, we can't
2207 * do reassembly (either the message is in error, as
2208 * the first fragment *must* contain a length, or we
2209 * didn't capture the first fragment, and this just
2210 * happens to be the first fragment we saw), so we
2211 * also check that we have a length;
2212 */
2213 needs_reassembly = true1;
2214 conversation_state->eap_reass_cookie = pinfo->num;
2215 conversation_state->eap_tls_len = eap_tls_len;
2216 conversation_state->outer_tlvs_length = outer_tlvs_length;
2217
2218 /*
2219 * Start the reassembly sequence number at 0.
2220 */
2221 conversation_state->eap_tls_seq = 0;
2222
2223 eap_tls_seq = conversation_state->eap_tls_seq;
2224 eap_reass_cookie = conversation_state->eap_reass_cookie;
2225 }
2226
2227 if (needs_reassembly) {
2228 /*
2229 * This frame requires reassembly; remember the reassembly
2230 * ID for subsequent accesses to it.
2231 */
2232 packet_state = wmem_new(wmem_file_scope(), frame_state_t)((frame_state_t*)wmem_alloc((wmem_file_scope()), sizeof(frame_state_t
)))
;
2233 packet_state->info = eap_reass_cookie;
2234 packet_state->eap_tls_len = eap_tls_len;
2235 packet_state->outer_tlvs_length = outer_tlvs_length;
2236 p_add_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_FRAME_STATE | p_proto_data_layer, packet_state);
2237 }
2238 }
2239 } else {
2240 /*
2241 * This frame has a reassembly cookie associated with it, so
2242 * it requires reassembly. We've already done the
2243 * reassembly in the first pass, so "fragment_add_seq()"
2244 * won't look at the sequence number; set it to 0.
2245 *
2246 * XXX - a frame isn't supposed to have more than one
2247 * EAP message in it, but if it includes both an EAP-TLS
2248 * message and a LEAP message, we might be mistakenly
2249 * concluding it requires reassembly because the "info"
2250 * field isn't -1. We could, I guess, pack both EAP-TLS
2251 * ID and LEAP state into the structure, but that doesn't
2252 * work if you have multiple EAP-TLS or LEAP messages in
2253 * the frame.
2254 *
2255 * But it's not clear how much work we should do to handle
2256 * a bogus message such as that; as long as we don't crash
2257 * or do something else equally horrible, we may not
2258 * have to worry about this at all.
2259 */
2260 needs_reassembly = true1;
2261 /* Retrieve information only sent in the first fragment. */
2262 eap_reass_cookie = packet_state->info;
2263 eap_tls_len = packet_state->eap_tls_len;
2264 if (packet_state->outer_tlvs_length) {
2265 outer_tlvs = true1;
2266 outer_tlvs_length = packet_state->outer_tlvs_length;
2267 }
2268 eap_tls_seq = 0;
2269 }
2270
2271 /*
2272 We test here to see whether EAP-TLS packet
2273 carry fragmented of TLS data.
2274
2275 If this is the case, we do reassembly below,
2276 otherwise we just call dissector.
2277 */
2278 if (needs_reassembly) {
2279 fragment_head *fd_head;
2280
2281 /*
2282 * Yes, this frame contains a fragment that requires
2283 * reassembly.
2284 */
2285 save_fragmented = pinfo->fragmented;
2286 pinfo->fragmented = true1;
2287 fd_head = fragment_add_seq(&eap_tls_reassembly_table,
2288 tvb, offset,
2289 pinfo, eap_reass_cookie, NULL((void*)0),
2290 eap_tls_seq,
2291 size,
2292 more_fragments, 0);
2293
2294 if (fd_head != NULL((void*)0)) {
2295 if (fd_head->reassembled_in == pinfo->num) {
2296 /* Reassembled */
2297 proto_item* frag_tree_item;
2298
2299 next_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
2300 add_new_data_source(pinfo, next_tvb, "Reassembled EAP-TLS");
2301
2302 show_fragment_seq_tree(fd_head, &eap_tls_frag_items,
2303 eap_tree, pinfo, next_tvb, &frag_tree_item);
2304
2305 if (tvb_reported_length(next_tvb) != eap_tls_len) {
2306 expert_add_info(pinfo, frag_tree_item, &ei_eap_tls_fragment_missing);
2307 /* We know there's missing data in the middle. Since we got
2308 * the first fragment, it might still be ok to call the TLS
2309 * dissector.
2310 */
2311 }
2312 /*
2313 * We're finished reassembling this frame.
2314 * Reinitialize the reassembly state.
2315 */
2316 if (!visited)
2317 conversation_state->eap_tls_seq = -1;
2318 } else {
2319 ti = proto_tree_add_uint(eap_tree, hf_eap_tls_reassembled_in, tvb,
2320 0, 0, fd_head->reassembled_in);
2321 proto_item_set_generated(ti);
2322 }
2323 }
2324
2325 pinfo->fragmented = save_fragmented;
2326
2327 } else { /* this data is NOT fragmented */
2328 next_tvb = tvb_new_subset_length(tvb, offset, size);
2329 }
2330
2331 if (next_tvb) {
2332 switch (eap_type) {
2333 case EAP_TYPE_TTLS21:
2334 tls_set_appdata_dissector(tls_handle, pinfo, diameter_avps_handle);
2335 break;
2336 case EAP_TYPE_PEAP25:
2337 p_add_proto_data(pinfo->pool, pinfo, proto_eap, PROTO_DATA_EAP_TVB | p_proto_data_layer, tvb);
2338 tls_set_appdata_dissector(tls_handle, pinfo, peap_handle);
2339 break;
2340 case EAP_TYPE_TEAP55:
2341 if (outer_tlvs) { /* https://www.rfc-editor.org/rfc/rfc7170.html#section-4.1 */
2342 tvbuff_t *teap_tvb;
2343 if (outer_tlvs_length > tvb_reported_length(next_tvb)) {
2344 /* This is bogus. Either we missed some fragment (and the
2345 * outer TLVs were split across fragments), or some length
2346 * values were bogus. */
2347 teap_tvb = next_tvb;
2348 } else {
2349 teap_tvb = tvb_new_subset_length(next_tvb, tvb_reported_length(next_tvb) - outer_tlvs_length, outer_tlvs_length);
2350 }
2351 increment_dissection_depth(pinfo);
2352 call_dissector(teap_handle, teap_tvb, pinfo, eap_tree);
2353 decrement_dissection_depth(pinfo);
2354 if (tvb_reported_length(next_tvb) <= outer_tlvs_length) goto skip_tls_dissector;
2355 next_tvb = tvb_new_subset_length(next_tvb, 0, tvb_reported_length_remaining(next_tvb, outer_tlvs_length));
2356 }
2357 tls_set_appdata_dissector(tls_handle, pinfo, teap_handle);
2358 break;
2359 }
2360 increment_dissection_depth(pinfo);
2361 call_dissector(tls_handle, next_tvb, pinfo, eap_tree);
2362 decrement_dissection_depth(pinfo);
2363 }
2364 }
2365 }
2366skip_tls_dissector:
2367 break; /* EAP_TYPE_TLS */
2368
2369 /*********************************************************************
2370 Cisco's Lightweight EAP (LEAP)
2371 https://web.archive.org/web/20070623090417if_/http://www.missl.cs.umd.edu/wireless/ethereal/leap.txt
2372 **********************************************************************/
2373 case EAP_TYPE_LEAP17:
2374 {
2375 uint8_t count;
2376 unsigned namesize;
2377
2378 /* Warn that this is an insecure EAP type. */
2379 expert_add_info(pinfo, eap_type_item, &ei_eap_dictionary_attacks);
2380
2381 /* Version (byte) */
2382 proto_tree_add_item(eap_tree, hf_eap_leap_version, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2383 offset += 1;
2384
2385 /* Unused (byte) */
2386 proto_tree_add_item(eap_tree, hf_eap_leap_reserved, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2387 offset += 1;
2388
2389 /* Count (byte) */
2390 proto_tree_add_item_ret_uint8(eap_tree, hf_eap_leap_count, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &count);
2391 offset += 1;
2392
2393 /* Data (byte*Count) */
2394 /* This part is state-dependent. */
2395
2396 /* XXX - are duplicates possible (is_duplicate_id)?
2397 * If so, should we stop here to avoid modifying conversation_state? */
2398
2399 /* See if we've already remembered the state. */
2400 packet_state = (frame_state_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_FRAME_STATE_LEAP | p_proto_data_layer);
2401 if (packet_state == NULL((void*)0)) {
2402 /*
2403 * We haven't - compute the state based on the current
2404 * state in the conversation.
2405 */
2406 leap_state = conversation_state->leap_state;
2407
2408 /* Advance the state machine. */
2409 if (leap_state==0) leap_state = 1; else
2410 if (leap_state==1) leap_state = 2; else
2411 if (leap_state==2) leap_state = 3; else
2412 if (leap_state==3) leap_state = 4; else
2413 if (leap_state==4) leap_state = -1;
2414
2415 /*
2416 * Remember the state for subsequent accesses to this
2417 * frame.
2418 */
2419 packet_state = wmem_new(wmem_file_scope(), frame_state_t)((frame_state_t*)wmem_alloc((wmem_file_scope()), sizeof(frame_state_t
)))
;
2420 packet_state->info = leap_state;
2421 p_add_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_FRAME_STATE_LEAP | p_proto_data_layer, packet_state);
2422
2423 /*
2424 * Update the conversation's state.
2425 */
2426 conversation_state->leap_state = leap_state;
2427 }
2428
2429 /* Get the remembered state. */
2430 leap_state = packet_state->info;
2431
2432 switch (leap_state) {
2433 case 1:
2434 proto_tree_add_item(eap_tree, hf_eap_leap_peer_challenge, tvb, offset, count, ENC_NA0x00000000);
2435 break;
2436
2437 case 2:
2438 proto_tree_add_item(eap_tree, hf_eap_leap_peer_response, tvb, offset, count, ENC_NA0x00000000);
2439 break;
2440
2441 case 3:
2442 proto_tree_add_item(eap_tree, hf_eap_leap_ap_challenge, tvb, offset, count, ENC_NA0x00000000);
2443 break;
2444
2445 case 4:
2446 proto_tree_add_item(eap_tree, hf_eap_leap_ap_response, tvb, offset, count, ENC_NA0x00000000);
2447 break;
2448
2449 default:
2450 proto_tree_add_item(eap_tree, hf_eap_leap_data, tvb, offset, count, ENC_NA0x00000000);
2451 break;
2452 }
2453
2454 offset += count;
2455
2456 /* Name (Length-(8+Count)) */
2457 namesize = (eap_len > 8 + count) ? eap_len - (8 + count) : 0;
2458 proto_tree_add_item(eap_tree, hf_eap_leap_name, tvb, offset, namesize, ENC_ASCII0x00000000);
2459 }
2460
2461 break; /* EAP_TYPE_LEAP */
2462
2463 /*********************************************************************
2464 EAP-MSCHAPv2 - draft-kamath-pppext-eap-mschapv2-00.txt
2465 **********************************************************************/
2466 case EAP_TYPE_MSCHAPV226:
2467 dissect_eap_mschapv2(eap_tree, tvb, pinfo, offset, size);
2468 break; /* EAP_TYPE_MSCHAPV2 */
2469
2470 /*********************************************************************
2471 EAP-SIM - draft-haverinen-pppext-eap-sim-13.txt
2472 **********************************************************************/
2473 case EAP_TYPE_SIM18:
2474 dissect_eap_sim(eap_tree, tvb, pinfo, offset, size);
2475 break; /* EAP_TYPE_SIM */
2476
2477 /*********************************************************************
2478 EAP-AKA - draft-arkko-pppext-eap-aka-12.txt
2479 **********************************************************************/
2480 case EAP_TYPE_AKA23:
2481 case EAP_TYPE_AKA_PRIME50:
2482 dissect_eap_aka(eap_tree, tvb, pinfo, offset, size);
2483 break; /* EAP_TYPE_AKA */
2484
2485 /*********************************************************************
2486 EAP Expanded Type
2487 **********************************************************************/
2488 case EAP_TYPE_EXT254:
2489 {
2490 proto_tree *exptree;
2491
2492 exptree = proto_tree_add_subtree(eap_tree, tvb, offset, size, ett_eap_exp_attr, NULL((void*)0), "Expanded Type");
2493 dissect_exteap(exptree, tvb, offset, size, pinfo, eap_code, eap_identifier);
2494 }
2495 break;
2496
2497 /*********************************************************************
2498 EAP-PAX - RFC 4746
2499 **********************************************************************/
2500 case EAP_TYPE_PAX46:
2501 dissect_eap_pax(eap_tree, tvb, pinfo, offset, size);
2502 break; /* EAP_TYPE_PAX */
2503
2504 /*********************************************************************
2505 EAP-PSK - RFC 4764
2506 **********************************************************************/
2507 case EAP_TYPE_PSK47:
2508 dissect_eap_psk(eap_tree, tvb, pinfo, offset, size);
2509 break; /* EAP_TYPE_PSK */
2510
2511 /*********************************************************************
2512 EAP-SAKE - RFC 4763
2513 **********************************************************************/
2514 case EAP_TYPE_SAKE48:
2515 dissect_eap_sake(eap_tree, tvb, pinfo, offset, size);
2516 break; /* EAP_TYPE_SAKE */
2517
2518 /*********************************************************************
2519 EAP-GPSK - RFC 5433
2520 **********************************************************************/
2521 case EAP_TYPE_GPSK51:
2522 dissect_eap_gpsk(eap_tree, tvb, pinfo, offset, size);
2523 break; /* EAP_TYPE_GPSK */
2524
2525 /*********************************************************************
2526 EAP-IKEv2 - RFC 5106
2527 **********************************************************************/
2528 case EAP_TYPE_IKEV249:
2529 {
2530 bool_Bool more_fragments;
2531 bool_Bool has_length;
2532 bool_Bool icv_present;
2533
2534 /* Flags field, 1 byte */
2535 ti = proto_tree_add_item(eap_tree, hf_eap_ikev2_flags, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000);
2536 eap_tls_flags_tree = proto_item_add_subtree(ti, hf_eap_ikev2_flags);
2537 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_ikev2_flag_l, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &has_length);
2538 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_ikev2_flag_m, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &more_fragments);
2539 proto_tree_add_item_ret_boolean(eap_tls_flags_tree, hf_eap_ikev2_flag_i, tvb, offset, 1, ENC_BIG_ENDIAN0x00000000, &icv_present);
2540
2541 size -= 1;
2542 offset += 1;
2543
2544 /* Length field, 4 bytes, OPTIONAL. */
2545 if (has_length) {
2546 proto_tree_add_item(eap_tree, hf_eap_ikev2_len, tvb, offset, 4, ENC_BIG_ENDIAN0x00000000);
2547 size -= 4;
2548 offset += 4;
2549 }
2550
2551 if (size > 0) {
2552 tvbuff_t* next_tvb = NULL((void*)0);
2553
2554 if (has_length || more_fragments) {
2555 /* TODO: Add fragmentation support
2556 * Length of integrity check data needs to be determined in case of fragmentation. Chosen INTEG transform?
2557 */
2558 } else {
2559 next_tvb = tvb_new_subset_length(tvb, offset, size);
2560 unsigned tmp = call_dissector(ike_handle, next_tvb, pinfo, eap_tree);
2561 size -= tmp;
2562 offset += tmp;
2563
2564 if (icv_present && size > 0) {
2565 /* We assume that all data present is integrity check data. We cannot detect too short/long right now. */
2566 proto_tree_add_item(eap_tree, hf_eap_ikev2_int_chk_data, tvb, offset, size, ENC_NA0x00000000);
2567 }
2568 }
2569 }
2570
2571 break;
2572 } /* EAP_TYPE_IKEV2 */
2573
2574 /*********************************************************************
2575 MS-Authentication-TLV - MS-PEAP section 2.2.8.1
2576 **********************************************************************/
2577 case EAP_TYPE_MSAUTH_TLV33:
2578 dissect_eap_msauth_tlv(eap_tree, tvb, pinfo, offset, size);
2579 break; /* EAP_TYPE_MSAUTH_TLV */
2580
2581 /*********************************************************************
2582 **********************************************************************/
2583 default:
2584 proto_tree_add_item(eap_tree, hf_eap_data, tvb, offset, size, ENC_NA0x00000000);
2585 break;
2586 /*********************************************************************
2587 **********************************************************************/
2588 } /* switch (eap_type) */
2589
2590 }
2591
2592 } /* switch (eap_code) */
2593
2594 if (!visited)
2595 p_add_proto_data(wmem_file_scope(), pinfo, proto_eap, PROTO_DATA_EAP_VISITED | p_proto_data_layer, GINT_TO_POINTER(1)((gpointer) (glong) (1)));
2596
2597 p_set_proto_depth(pinfo, proto_eap, curr_layer_num);
2598
2599 return tvb_captured_length(tvb);
2600}
2601
2602void
2603proto_register_eap(void)
2604{
2605 static hf_register_info hf[] = {
2606 { &hf_eap_code, {
2607 "Code", "eap.code",
2608 FT_UINT8, BASE_DEC, VALS(eap_code_vals)((0 ? (const struct _value_string*)0 : ((eap_code_vals)))), 0x0,
2609 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2610
2611 { &hf_eap_identifier, {
2612 "Id", "eap.id",
2613 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2614 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2615
2616 { &hf_eap_len, {
2617 "Length", "eap.len",
2618 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
2619 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2620
2621 { &hf_eap_type, {
2622 "Type", "eap.type",
2623 FT_UINT8, BASE_DEC|BASE_EXT_STRING0x00000200, &eap_type_vals_ext, 0x0,
2624 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2625
2626 { &hf_eap_type_nak, {
2627 "Desired Auth Type", "eap.desired_type",
2628 FT_UINT8, BASE_DEC|BASE_EXT_STRING0x00000200, &eap_type_vals_ext, 0x0,
2629 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2630
2631 { &hf_eap_identity, {
2632 "Identity", "eap.identity",
2633 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2634 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2635
2636 { &hf_eap_identity_prefix, {
2637 "Identity Prefix", "eap.identity.prefix",
2638 FT_CHAR, BASE_HEX, NULL((void*)0), 0x0,
2639 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2640
2641 { &hf_eap_identity_type, {
2642 "Identity Type", "eap.identity.type",
2643 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2644 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2645
2646 { &hf_eap_identity_full, {
2647 "Identity (Full)", "eap.identity.full",
2648 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2649 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2650
2651 { &hf_eap_identity_certificate_sn, {
2652 "Certificate Serial Number", "eap.identity.cert_sn",
2653 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2654 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2655
2656 { &hf_eap_identity_mcc, {
2657 "Identity Mobile Country Code", "eap.identity.mcc",
2658 FT_UINT16, BASE_DEC|BASE_EXT_STRING0x00000200, &E212_codes_ext, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2659
2660 { &hf_eap_identity_mcc_mnc_2digits, {
2661 "Identity Mobile Network Code", "eap.identity.mnc",
2662 FT_UINT16, BASE_DEC|BASE_EXT_STRING0x00000200, &mcc_mnc_2digits_codes_ext, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2663
2664 { &hf_eap_identity_mcc_mnc_3digits, {
2665 "Identity Mobile Network Code", "eap.identity.mnc",
2666 FT_UINT16, BASE_DEC|BASE_EXT_STRING0x00000200, &mcc_mnc_3digits_codes_ext, 0x0, NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2667
2668 { &hf_eap_identity_padding, {
2669 "Padding", "eap.identity.padding",
2670 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2671 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2672
2673 { &hf_eap_identity_actual_len, {
2674 "Identity Actual Length", "eap.identity.actual_len",
2675 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
2676 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2677
2678 { &hf_eap_notification, {
2679 "Notification", "eap.notification",
2680 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2681 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2682
2683 { &hf_eap_md5_value_size, {
2684 "EAP-MD5 Value-Size", "eap.md5.value_size",
2685 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2686 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2687
2688 { &hf_eap_md5_value, {
2689 "EAP-MD5 Value", "eap.md5.value",
2690 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2691 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2692
2693 { &hf_eap_md5_extra_data, {
2694 "EAP-MD5 Extra Data", "eap.md5.extra_data",
2695 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2696 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2697
2698 { &hf_eap_gtc_challenge, {
2699 "Challenge", "eap.gtc.challenge",
2700 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2701 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2702
2703 { &hf_eap_gtc_response, {
2704 "Response", "eap.gtc.response",
2705 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2706 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2707
2708 { &hf_eap_tls_flags, {
2709 "EAP-TLS Flags", "eap.tls.flags",
2710 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
2711 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2712
2713 { &hf_eap_tls_flag_l, {
2714 "Length Included", "eap.tls.flags.len_included",
2715 FT_BOOLEAN, 8, NULL((void*)0), EAP_TLS_FLAG_L0x80,
2716 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2717
2718 { &hf_eap_tls_flag_m, {
2719 "More Fragments", "eap.tls.flags.more_fragments",
2720 FT_BOOLEAN, 8, NULL((void*)0), EAP_TLS_FLAG_M0x40,
2721 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2722
2723 { &hf_eap_tls_flag_s, {
2724 "Start", "eap.tls.flags.start",
2725 FT_BOOLEAN, 8, NULL((void*)0), EAP_TLS_FLAG_S0x20,
2726 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2727
2728 { &hf_eap_tls_flag_o, {
2729 "Outer TLV Length Included", "eap.tls.flags.outer_tlv_len_included",
2730 FT_BOOLEAN, 8, NULL((void*)0), EAP_TLS_FLAG_O0x10,
2731 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2732
2733 { &hf_eap_tls_flags_version, {
2734 "Version", "eap.tls.flags.version",
2735 FT_UINT8, BASE_DEC, NULL((void*)0), EAP_TLS_FLAGS_VERSION0x07,
2736 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2737
2738 { &hf_eap_tls_len, {
2739 "EAP-TLS Length", "eap.tls.len",
2740 FT_UINT32, BASE_DEC, NULL((void*)0), 0x0,
2741 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2742
2743 { &hf_eap_tls_outer_tlvs_len, {
2744 "TEAP Outer TLVs Length", "eap.tls.outer_tlvs_len",
2745 FT_UINT32, BASE_DEC, NULL((void*)0), 0x0,
2746 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2747
2748 { &hf_eap_tls_fragment, {
2749 "EAP-TLS Fragment", "eap.tls.fragment",
2750 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x0,
2751 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2752
2753 { &hf_eap_tls_fragments, {
2754 "EAP-TLS Fragments", "eap.tls.fragments",
2755 FT_NONE, BASE_NONE, NULL((void*)0), 0x0,
2756 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2757
2758 { &hf_eap_tls_fragment_overlap, {
2759 "Fragment Overlap", "eap.tls.fragment.overlap",
2760 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0,
2761 "Fragment overlaps with other fragments", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2762
2763 { &hf_eap_tls_fragment_overlap_conflict, {
2764 "Conflicting Data In Fragment Overlap", "eap.tls.fragment.overlap_conflict",
2765 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0,
2766 "Overlapping fragments contained conflicting data", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2767
2768 { &hf_eap_tls_fragment_multiple_tails, {
2769 "Multiple Tail Fragments Found", "eap.tls.fragment.multiple_tails",
2770 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0,
2771 "Several tails were found when defragmenting the packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2772
2773 { &hf_eap_tls_fragment_too_long_fragment,{
2774 "Fragment Too Long", "eap.tls.fragment.fragment.too_long",
2775 FT_BOOLEAN, BASE_NONE, NULL((void*)0), 0x0,
2776 "Fragment contained data past end of packet", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2777
2778 { &hf_eap_tls_fragment_error, {
2779 "Defragmentation Error", "eap.tls.fragment.error",
2780 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x0,
2781 "Defragmentation error due to illegal fragments", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2782
2783 { &hf_eap_tls_fragment_count, {
2784 "Fragment Count", "eap.tls.fragment.count",
2785 FT_UINT32, BASE_DEC, NULL((void*)0), 0x0,
2786 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2787
2788 { &hf_eap_tls_reassembled_in, {
2789 "Reassembled EAP-TLS PDU in frame", "eap.tls.reassembled_in",
2790 FT_FRAMENUM, BASE_NONE, NULL((void*)0), 0x0,
2791 "A PDU with a fragment from this frame is reassembled in this frame", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
2792
2793 { &hf_eap_tls_reassembled_length, {
2794 "Reassembled EAP-TLS Length", "eap.tls.reassembled.len",
2795 FT_UINT32, BASE_DEC, NULL((void*)0), 0x0,
2796 "Total length of the reassembled payload", HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2797
2798 { &hf_eap_sim_subtype, {
2799 "EAP-SIM Subtype", "eap.sim.subtype",
2800 FT_UINT8, BASE_DEC, VALS(eap_sim_subtype_vals)((0 ? (const struct _value_string*)0 : ((eap_sim_subtype_vals
))))
, 0x0,
2801 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2802
2803 { &hf_eap_sim_reserved, {
2804 "EAP-SIM Reserved", "eap.sim.reserved",
2805 FT_UINT16, BASE_HEX, NULL((void*)0), 0x0,
2806 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2807
2808 { &hf_eap_sim_subtype_attribute, {
2809 "EAP-SIM Attribute", "eap.sim.subtype.attribute",
2810 FT_NONE, BASE_NONE, NULL((void*)0), 0x0,
2811 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2812
2813 { &hf_eap_sim_subtype_type, {
2814 "EAP-SIM Type", "eap.sim.subtype.type",
2815 FT_UINT8, BASE_DEC|BASE_EXT_STRING0x00000200, &eap_sim_aka_attribute_vals_ext, 0x0,
2816 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2817
2818 { &hf_eap_sim_subtype_length, {
2819 "EAP-SIM Length", "eap.sim.subtype.len",
2820 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2821 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2822
2823 { &hf_eap_sim_notification_type, {
2824 "EAP-SIM Notification Type", "eap.sim.notification_type",
2825 FT_UINT16, BASE_DEC, VALS(eap_sim_aka_notification_vals)((0 ? (const struct _value_string*)0 : ((eap_sim_aka_notification_vals
))))
, 0x0,
2826 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2827
2828 { &hf_eap_sim_error_code_type, {
2829 "EAP-SIM Error Code", "eap.sim.error_code",
2830 FT_UINT16, BASE_DEC, VALS(eap_sim_aka_client_error_codes)((0 ? (const struct _value_string*)0 : ((eap_sim_aka_client_error_codes
))))
, 0x0,
2831 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2832
2833 { &hf_eap_sim_subtype_value, {
2834 "EAP-SIM Value", "eap.sim.subtype.value",
2835 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2836 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2837
2838 { &hf_eap_aka_subtype, {
2839 "EAP-AKA Subtype", "eap.aka.subtype",
2840 FT_UINT8, BASE_DEC, VALS(eap_aka_subtype_vals)((0 ? (const struct _value_string*)0 : ((eap_aka_subtype_vals
))))
, 0x0,
2841 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2842
2843 { &hf_eap_aka_reserved, {
2844 "EAP-AKA Reserved", "eap.aka.reserved",
2845 FT_UINT16, BASE_HEX, NULL((void*)0), 0x0,
2846 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2847
2848 { &hf_eap_aka_subtype_attribute, {
2849 "EAP-AKA Attribute", "eap.aka.subtype.attribute",
2850 FT_NONE, BASE_NONE, NULL((void*)0), 0x0,
2851 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2852
2853 { &hf_eap_aka_subtype_type, {
2854 "EAP-AKA Type", "eap.aka.subtype.type",
2855 FT_UINT8, BASE_DEC|BASE_EXT_STRING0x00000200, &eap_sim_aka_attribute_vals_ext, 0x0,
2856 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2857
2858 { &hf_eap_aka_subtype_length, {
2859 "EAP-AKA Length", "eap.aka.subtype.len",
2860 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2861 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2862
2863 { &hf_eap_aka_notification_type, {
2864 "EAP-AKA Notification Type", "eap.aka.notification_type",
2865 FT_UINT16, BASE_DEC, VALS(eap_sim_aka_notification_vals)((0 ? (const struct _value_string*)0 : ((eap_sim_aka_notification_vals
))))
, 0x0,
2866 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2867
2868 { &hf_eap_aka_error_code_type, {
2869 "EAP-AKA Error Code", "eap.aka.error_code",
2870 FT_UINT16, BASE_DEC, VALS(eap_sim_aka_client_error_codes)((0 ? (const struct _value_string*)0 : ((eap_sim_aka_client_error_codes
))))
, 0x0,
2871 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2872
2873 { &hf_eap_aka_rand, {
2874 "EAP-AKA RAND", "eap.aka.rand",
2875 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2876 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2877
2878 { &hf_eap_aka_autn, {
2879 "EAP-AKA AUTN", "eap.aka.autn",
2880 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2881 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2882
2883 { &hf_eap_aka_res_len, {
2884 "EAP-AKA RES Length", "eap.aka.res.len",
2885 FT_UINT16, BASE_DEC|BASE_UNIT_STRING0x00001000, UNS(&units_bit_bits)((0 ? (const struct unit_name_string*)0 : ((&units_bit_bits
))))
, 0x0,
2886 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2887
2888 { &hf_eap_aka_res, {
2889 "EAP-AKA RES", "eap.aka.res",
2890 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2891 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2892
2893 { &hf_eap_aka_auts, {
2894 "EAP-AKA AUTS", "eap.aka.auts",
2895 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2896 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2897
2898 { &hf_eap_aka_subtype_value, {
2899 "EAP-AKA Value", "eap.aka.subtype.value",
2900 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2901 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2902
2903 { &hf_eap_leap_version, {
2904 "EAP-LEAP Version", "eap.leap.version",
2905 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2906 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2907
2908 { &hf_eap_leap_reserved, {
2909 "EAP-LEAP Reserved", "eap.leap.reserved",
2910 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
2911 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2912
2913 { &hf_eap_leap_count, {
2914 "EAP-LEAP Count", "eap.leap.count",
2915 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2916 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2917
2918 { &hf_eap_leap_peer_challenge, {
2919 "EAP-LEAP Peer-Challenge", "eap.leap.peer_challenge",
2920 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2921 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2922
2923 { &hf_eap_leap_peer_response, {
2924 "EAP-LEAP Peer-Response", "eap.leap.peer_response",
2925 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2926 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2927
2928 { &hf_eap_leap_ap_challenge, {
2929 "EAP-LEAP AP-Challenge", "eap.leap.ap_challenge",
2930 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2931 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2932
2933 { &hf_eap_leap_ap_response, {
2934 "EAP-LEAP AP-Response", "eap.leap.ap_response",
2935 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2936 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2937
2938 { &hf_eap_leap_data, {
2939 "EAP-LEAP Data", "eap.leap.data",
2940 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2941 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2942
2943 { &hf_eap_leap_name, {
2944 "EAP-LEAP Name", "eap.leap.name",
2945 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2946 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2947
2948 { &hf_eap_ms_chap_v2_opcode, {
2949 "EAP-MS-CHAP-v2 OpCode", "eap.ms_chap_v2.opcode",
2950 FT_UINT8, BASE_DEC, VALS(eap_ms_chap_v2_opcode_vals)((0 ? (const struct _value_string*)0 : ((eap_ms_chap_v2_opcode_vals
))))
, 0x0,
2951 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2952
2953 { &hf_eap_ms_chap_v2_id, {
2954 "EAP-MS-CHAP-v2 Id", "eap.ms_chap_v2.id",
2955 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2956 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2957
2958 { &hf_eap_ms_chap_v2_length, {
2959 "EAP-MS-CHAP-v2 Length", "eap.ms_chap_v2.length",
2960 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
2961 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2962
2963 { &hf_eap_ms_chap_v2_value_size, {
2964 "EAP-MS-CHAP-v2 Value-Size", "eap.ms_chap_v2.value_size",
2965 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
2966 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2967
2968 { &hf_eap_ms_chap_v2_challenge, {
2969 "EAP-MS-CHAP-v2 Challenge", "eap.ms_chap_v2.challenge",
2970 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2971 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2972
2973 { &hf_eap_ms_chap_v2_name, {
2974 "EAP-MS-CHAP-v2 Name", "eap.ms_chap_v2.name",
2975 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
2976 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2977
2978 { &hf_eap_ms_chap_v2_peer_challenge, {
2979 "EAP-MS-CHAP-v2 Peer-Challenge", "eap.ms_chap_v2.peer_challenge",
2980 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2981 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2982
2983 { &hf_eap_ms_chap_v2_reserved, {
2984 "EAP-MS-CHAP-v2 Reserved", "eap.ms_chap_v2.reserved",
2985 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2986 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2987
2988 { &hf_eap_ms_chap_v2_nt_response, {
2989 "EAP-MS-CHAP-v2 NT-Response", "eap.ms_chap_v2.nt_response",
2990 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
2991 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2992
2993 { &hf_eap_ms_chap_v2_flags, {
2994 "EAP-MS-CHAP-v2 Flags", "eap.ms_chap_v2.flags",
2995 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
2996 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
2997
2998 { &hf_eap_ms_chap_v2_response, {
2999 "EAP-MS-CHAP-v2 Response (Unknown Length)", "eap.ms_chap_v2.response",
3000 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3001 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3002
3003 { &hf_eap_ms_chap_v2_message, {
3004 "EAP-MS-CHAP-v2 Message", "eap.ms_chap_v2.message",
3005 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3006 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3007
3008 { &hf_eap_ms_chap_v2_failure_request, {
3009 "EAP-MS-CHAP-v2 Failure-Request", "eap.ms_chap_v2.failure_request",
3010 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3011 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3012
3013 { &hf_eap_ms_chap_v2_data, {
3014 "EAP-MS-CHAP-v2 Data", "eap.ms_chap_v2.data",
3015 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3016 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3017
3018 { &hf_eap_pax_opcode, {
3019 "EAP-PAX OP-Code", "eap.pax.opcode",
3020 FT_UINT8, BASE_HEX, VALS(eap_pax_opcode_vals)((0 ? (const struct _value_string*)0 : ((eap_pax_opcode_vals)
)))
, 0x0,
3021 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3022
3023 { &hf_eap_pax_flags, {
3024 "EAP-PAX Flags", "eap.pax.flags",
3025 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
3026 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3027
3028 { &hf_eap_pax_flags_mf, {
3029 "more fragments", "eap.pax.flags.mf",
3030 FT_BOOLEAN, 8, NULL((void*)0), EAP_PAX_FLAG_MF0x01,
3031 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3032
3033 { &hf_eap_pax_flags_ce, {
3034 "certificate enabled", "eap.pax.flags.ce",
3035 FT_BOOLEAN, 8, NULL((void*)0), EAP_PAX_FLAG_CE0x02,
3036 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3037
3038 { &hf_eap_pax_flags_ai, {
3039 "ADE Included", "eap.pax.flags.ai",
3040 FT_BOOLEAN, 8, NULL((void*)0), EAP_PAX_FLAG_AI0x04,
3041 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3042
3043 { &hf_eap_pax_flags_reserved, {
3044 "reserved", "eap.pax.flags.reserved",
3045 FT_BOOLEAN, 8, NULL((void*)0), EAP_PAX_FLAG_RESERVED0xF8,
3046 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3047
3048 { &hf_eap_pax_mac_id, {
3049 "EAP-PAX MAC ID", "eap.pax.mac_id",
3050 FT_UINT8, BASE_HEX, VALS(eap_pax_mac_id_vals)((0 ? (const struct _value_string*)0 : ((eap_pax_mac_id_vals)
)))
, 0x0,
3051 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3052
3053 { &hf_eap_pax_dh_group_id, {
3054 "EAP-PAX DH Group ID", "eap.pax.dh_group_id",
3055 FT_UINT8, BASE_HEX, VALS(eap_pax_dh_group_id_vals)((0 ? (const struct _value_string*)0 : ((eap_pax_dh_group_id_vals
))))
, 0x0,
3056 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3057
3058 { &hf_eap_pax_public_key_id, {
3059 "EAP-PAX Public Key ID", "eap.pax.public_key_id",
3060 FT_UINT8, BASE_HEX, VALS(eap_pax_public_key_id_vals)((0 ? (const struct _value_string*)0 : ((eap_pax_public_key_id_vals
))))
, 0x0,
3061 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3062
3063 { &hf_eap_pax_a_len, {
3064 "EAP-PAX A len", "eap.pax.a.len",
3065 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3066 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3067
3068 { &hf_eap_pax_a, {
3069 "EAP-PAX A", "eap.pax.a",
3070 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3071 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3072
3073 { &hf_eap_pax_b_len, {
3074 "EAP-PAX B len", "eap.pax.b.len",
3075 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3076 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3077
3078 { &hf_eap_pax_b, {
3079 "EAP-PAX B", "eap.pax.b",
3080 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3081 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3082
3083 { &hf_eap_pax_cid_len, {
3084 "EAP-PAX CID len", "eap.pax.cid.len",
3085 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3086 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3087
3088 { &hf_eap_pax_cid, {
3089 "EAP-PAX CID", "eap.pax.cid",
3090 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3091 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3092
3093 { &hf_eap_pax_mac_ck_len, {
3094 "EAP-PAX MAC_CK len", "eap.pax.mac_ck.len",
3095 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3096 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3097
3098 { &hf_eap_pax_mac_ck, {
3099 "EAP-PAX MAC_CK", "eap.pax.mac_ck",
3100 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3101 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3102
3103 { &hf_eap_pax_ade_len, {
3104 "EAP-PAX ADE len", "eap.pax.ade.len",
3105 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3106 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3107
3108 { &hf_eap_pax_ade, {
3109 "EAP-PAX ADE", "eap.pax.ade",
3110 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3111 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3112
3113 { &hf_eap_pax_mac_icv, {
3114 "EAP-PAX ICV", "eap.pax.icv",
3115 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3116 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3117
3118 { &hf_eap_psk_flags, {
3119 "EAP-PSK Flags", "eap.psk.flags",
3120 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
3121 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3122
3123 { &hf_eap_psk_flags_t, {
3124 "T", "eap.psk.flags.t",
3125 FT_UINT8, BASE_HEX, NULL((void*)0), EAP_PSK_FLAGS_T_MASK0xC0,
3126 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3127
3128 { &hf_eap_psk_flags_reserved, {
3129 "Reserved", "eap.psk.flags.reserved",
3130 FT_UINT8, BASE_HEX, NULL((void*)0), 0x3F,
3131 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3132
3133 { &hf_eap_psk_rand_p, {
3134 "EAP-PSK RAND_P", "eap.psk.rand_p",
3135 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3136 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3137
3138 { &hf_eap_psk_rand_s, {
3139 "EAP-PSK RAND_S", "eap.psk.rand_s",
3140 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3141 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3142
3143 { &hf_eap_psk_mac_p, {
3144 "EAP-PSK MAC_P", "eap.psk.mac_p",
3145 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3146 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3147
3148 { &hf_eap_psk_mac_s, {
3149 "EAP-PSK MAC_S", "eap.psk.mac_s",
3150 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3151 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3152
3153 { &hf_eap_psk_id_p, {
3154 "EAP-PSK ID_P", "eap.psk.id_p",
3155 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3156 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3157
3158 { &hf_eap_psk_id_s, {
3159 "EAP-PSK ID_S", "eap.psk.id_s",
3160 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3161 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3162
3163 { &hf_eap_psk_pchannel, {
3164 "EAP-PSK Protected Channel (encrypted)", "eap.psk.pchannel",
3165 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3166 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3167
3168 { &hf_eap_sake_version, {
3169 "EAP-SAKE Version", "eap.sake.version",
3170 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
3171 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3172
3173 { &hf_eap_sake_session_id, {
3174 "EAP-SAKE Session ID", "eap.sake.session_id",
3175 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
3176 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3177
3178 { &hf_eap_sake_subtype, {
3179 "EAP-SAKE Subtype", "eap.sake.subtype",
3180 FT_UINT8, BASE_HEX, VALS(eap_sake_subtype_vals)((0 ? (const struct _value_string*)0 : ((eap_sake_subtype_vals
))))
, 0x0,
3181 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3182
3183 { &hf_eap_sake_attr_type, {
3184 "Attribute Type", "eap.sake.attr.type",
3185 FT_UINT8, BASE_HEX, VALS(eap_sake_attr_type_vals)((0 ? (const struct _value_string*)0 : ((eap_sake_attr_type_vals
))))
, 0x0,
3186 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3187
3188 { &hf_eap_sake_attr_len, {
3189 "Attribute Length", "eap.sake.attr.len",
3190 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
3191 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3192
3193 { &hf_eap_sake_attr_value, {
3194 "Attribute Value", "eap.sake.attr.val",
3195 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3196 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3197
3198 { &hf_eap_sake_attr_value_str, {
3199 "Attribute Value", "eap.sake.attr.val_str",
3200 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3201 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3202
3203 { &hf_eap_sake_attr_value_uint48, {
3204 "Attribute Value", "eap.sake.attr.val_uint48",
3205 FT_UINT48, BASE_DEC, NULL((void*)0), 0x0,
3206 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3207
3208 { &hf_eap_gpsk_opcode, {
3209 "EAP-GPSK OP-Code", "eap.gpsk.opcode",
3210 FT_UINT8, BASE_HEX, VALS(eap_gpsk_opcode_vals)((0 ? (const struct _value_string*)0 : ((eap_gpsk_opcode_vals
))))
, 0x0,
3211 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3212
3213 { &hf_eap_gpsk_id_server_len, {
3214 "EAP-GPSK ID_Server len", "eap.gpsk.id_server.len",
3215 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3216 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3217
3218 { &hf_eap_gpsk_id_server, {
3219 "EAP-GPSK ID_Server", "eap.gpsk.id_server",
3220 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3221 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3222
3223 { &hf_eap_gpsk_id_peer_len, {
3224 "EAP-GPSK ID_Peer len", "eap.gpsk.id_peer.len",
3225 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3226 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3227
3228 { &hf_eap_gpsk_id_peer, {
3229 "EAP-GPSK ID_Peer", "eap.gpsk.id_peer",
3230 FT_STRING, BASE_NONE, NULL((void*)0), 0x0,
3231 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3232
3233 { &hf_eap_gpsk_rand_server, {
3234 "EAP-GPSK Rand_Server", "eap.gpsk.rand_server",
3235 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3236 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3237
3238 { &hf_eap_gpsk_rand_peer, {
3239 "EAP-GPSK Rand_Peer", "eap.gpsk.rand_peer",
3240 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3241 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3242
3243 { &hf_eap_gpsk_csuite_list_len, {
3244 "Len", "eap.gpsk.csuite_list_len",
3245 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3246 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3247
3248 { &hf_eap_gpsk_csuite_vendor, {
3249 "Vendor", "eap.gpsk.csuite.vendor",
3250 FT_UINT32, BASE_HEX, NULL((void*)0), 0x0,
3251 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3252
3253 { &hf_eap_gpsk_csuite_specifier, {
3254 "Specifier", "eap.gpsk.csuite.specifier",
3255 FT_UINT16, BASE_HEX, NULL((void*)0), 0x0,
3256 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3257
3258 { &hf_eap_gpsk_pd_payload_len, {
3259 "EAP-GPSK PD_Payload len", "eap.gpsk.pd_payload.len",
3260 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3261 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3262
3263 { &hf_eap_gpsk_pd_payload, {
3264 "EAP-GPSK PD_Payload", "eap.gpsk.pd_payload",
3265 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3266 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3267
3268 { &hf_eap_gpsk_payload_mac, {
3269 "EAP-GPSK Payload MAC", "eap.gpsk.payload_mac",
3270 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3271 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3272
3273 { &hf_eap_gpsk_failure_code, {
3274 "EAP-GPSK Failure code", "eap.gpsk.failure_code",
3275 FT_UINT32, BASE_HEX, VALS(eap_gpsk_failure_code_vals)((0 ? (const struct _value_string*)0 : ((eap_gpsk_failure_code_vals
))))
, 0x0,
3276 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3277
3278 { &hf_eap_data, {
3279 "EAP Data", "eap.data",
3280 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3281 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3282
3283 { &hf_eap_fast_type, {
3284 "EAP-FAST Type", "eap.fast.type",
3285 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3286 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3287
3288 { &hf_eap_fast_length, {
3289 "EAP-FAST Length", "eap.fast.length",
3290 FT_UINT16, BASE_DEC, NULL((void*)0), 0x0,
3291 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3292
3293 { &hf_eap_fast_aidd, {
3294 "Authority ID Data", "eap.fast.authority_id_data",
3295 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3296 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3297
3298 { &hf_eap_msauth_tlv_mandatory, {
3299 "Mandatory", "eap.msauth-tlv.mandatory",
3300 FT_BOOLEAN, 16, NULL((void*)0), MSAUTH_TLV_MANDATORY0x8000,
3301 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3302
3303 { &hf_eap_msauth_tlv_reserved, {
3304 "Reserved", "eap.msauth-tlv.reserved",
3305 FT_BOOLEAN, 16, NULL((void*)0), MSAUTH_TLV_RESERVED0x4000,
3306 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3307
3308 { &hf_eap_msauth_tlv_type, {
3309 "Type", "eap.msauth-tlv.type",
3310 FT_UINT16, BASE_DEC, VALS(eap_msauth_tlv_type_vals)((0 ? (const struct _value_string*)0 : ((eap_msauth_tlv_type_vals
))))
, MSAUTH_TLV_TYPE0x3FFF,
3311 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3312
3313 { &hf_eap_msauth_tlv_len, {
3314 "Length", "eap.msauth-tlv.len",
3315 FT_UINT16, BASE_DEC, NULL((void*)0), 0x00,
3316 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3317
3318 { &hf_eap_msauth_tlv_val, {
3319 "Value", "eap.msauth-tlv.val",
3320 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3321 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3322
3323 { &hf_eap_msauth_tlv_status, {
3324 "Status", "eap.msauth-tlv.status",
3325 FT_UINT16, BASE_DEC, VALS(eap_msauth_tlv_status_vals)((0 ? (const struct _value_string*)0 : ((eap_msauth_tlv_status_vals
))))
, 0x0,
3326 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3327
3328 { &hf_eap_msauth_tlv_crypto_reserved, {
3329 "Reserved", "eap.msauth-tlv.crypto.reserved",
3330 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
3331 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3332
3333 { &hf_eap_msauth_tlv_crypto_version, {
3334 "Version", "eap.msauth-tlv.crypto.version",
3335 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
3336 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3337
3338 { &hf_eap_msauth_tlv_crypto_rcv_version, {
3339 "Received Version", "eap.msauth-tlv.crypto.received-version",
3340 FT_UINT8, BASE_DEC, NULL((void*)0), 0x0,
3341 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3342
3343 { &hf_eap_msauth_tlv_crypto_subtype, {
3344 "Subtype", "eap.msauth-tlv.crypto.subtype",
3345 FT_UINT8, BASE_DEC, VALS(eap_msauth_tlv_crypto_subtype_vals)((0 ? (const struct _value_string*)0 : ((eap_msauth_tlv_crypto_subtype_vals
))))
, 0x0,
3346 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3347
3348 { &hf_eap_msauth_tlv_crypto_nonce, {
3349 "Nonce", "eap.msauth-tlv.crypto.nonce",
3350 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3351 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3352
3353 { &hf_eap_msauth_tlv_crypto_cmac, {
3354 "Compound MAC", "eap.msauth-tlv.crypto.cmac",
3355 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3356 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3357
3358 /* Expanded type fields */
3359 { &hf_eap_ext_vendor_id, {
3360 "EAP-EXT Vendor Id", "eap.ext.vendor_id",
3361 FT_UINT24, BASE_HEX, VALS(eap_ext_vendor_id_vals)((0 ? (const struct _value_string*)0 : ((eap_ext_vendor_id_vals
))))
, 0x0,
3362 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3363
3364 { &hf_eap_ext_vendor_type, {
3365 "EAP-EXT Vendor Type", "eap.ext.vendor_type",
3366 FT_UINT32, BASE_HEX, VALS(eap_ext_vendor_type_vals)((0 ? (const struct _value_string*)0 : ((eap_ext_vendor_type_vals
))))
, 0x0,
3367 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) }},
3368
3369 { &hf_eap_ikev2_flags, {
3370 "EAP-IKEv2 Flags", "eap.ikev2.flags",
3371 FT_UINT8, BASE_HEX, NULL((void*)0), 0x0,
3372 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3373
3374 { &hf_eap_ikev2_flag_l, {
3375 "Length Included", "eap.ikve2.flags.len_included",
3376 FT_BOOLEAN, 8, NULL((void*)0), EAP_IKEV2_FLAG_L0x80,
3377 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3378
3379 { &hf_eap_ikev2_flag_m, {
3380 "More Fragments", "eap.ikev2.flags.more_fragments",
3381 FT_BOOLEAN, 8, NULL((void*)0), EAP_IKEV2_FLAG_M0x40,
3382 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3383
3384 { &hf_eap_ikev2_flag_i, {
3385 "Integrity Checksum Data present", "eap.ikev2.flags.icv_present",
3386 FT_BOOLEAN, 8, NULL((void*)0), EAP_IKEV2_FLAG_I0x20,
3387 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3388
3389 { &hf_eap_ikev2_len, {
3390 "EAP-IKEv2 Length", "eap.ikev2.len",
3391 FT_UINT32, BASE_DEC, NULL((void*)0), 0x0,
3392 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3393
3394 { &hf_eap_ikev2_int_chk_data, {
3395 "EAP-IKEv2 Integrity Checksum Data", "eap.ikev2.integrity_checksum_data",
3396 FT_BYTES, BASE_NONE, NULL((void*)0), 0x0,
3397 NULL((void*)0), HFILL-1, 0, HF_REF_TYPE_NONE, -1, ((void*)0) } },
3398 };
3399 static int *ett[] = {
3400 &ett_eap,
3401 &ett_eap_pax_flags,
3402 &ett_eap_psk_flags,
3403 &ett_eap_gpsk_csuite_list,
3404 &ett_eap_gpsk_csuite,
3405 &ett_eap_gpsk_csuite_sel,
3406 &ett_eap_sake_attr,
3407 &ett_eap_msauth_tlv,
3408 &ett_eap_msauth_tlv_tree,
3409 &ett_eap_tls_fragment,
3410 &ett_eap_tls_fragments,
3411 &ett_eap_sim_attr,
3412 &ett_eap_aka_attr,
3413 &ett_eap_exp_attr,
3414 &ett_eap_tls_flags,
3415 &ett_identity,
3416 &ett_eap_ikev2_flags,
3417 };
3418 static ei_register_info ei[] = {
3419 { &ei_eap_ms_chap_v2_length, { "eap.ms_chap_v2.length.invalid", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Invalid Length", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3420 { &ei_eap_mitm_attacks, { "eap.mitm_attacks", PI_SECURITY0x0a000000, PI_WARN0x00600000, "Vulnerable to MITM attacks. If possible, change EAP type.", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3421 { &ei_eap_md5_value_size_overflow, { "eap.md5.value_size.overflow", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Overflow", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3422 { &ei_eap_dictionary_attacks, { "eap.dictionary_attacks", PI_SECURITY0x0a000000, PI_WARN0x00600000,
3423 "Vulnerable to dictionary attacks. If possible, change EAP type."
3424 " See http://www.cisco.com/warp/public/cc/pd/witc/ao350ap/prodlit/2331_pp.pdf", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3425 { &ei_eap_identity_nonascii, { "eap.identity.nonascii", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Non-ASCII characters within identity", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3426 { &ei_eap_identity_invalid, { "eap.identity.invalid", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Invalid identity code", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3427 { &ei_eap_retransmission, { "eap.retransmission", PI_SEQUENCE0x02000000, PI_NOTE0x00400000, "This packet is a retransmission", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3428 { &ei_eap_bad_length, { "eap.bad_length", PI_PROTOCOL0x09000000, PI_WARN0x00600000, "Bad length (too small or too large)", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3429 { &ei_eap_tls_fragment_missing, { "eap.tls.fragment.missing", PI_REASSEMBLE0x06000000, PI_ERROR0x00800000, "Fragment missing", EXPFILL0, ((void*)0), 0, ((void*)0), {0, {((void*)0), ((void*)0), FT_NONE
, BASE_NONE, ((void*)0), 0, ((void*)0), -1, 0, HF_REF_TYPE_NONE
, -1, ((void*)0)}}
}},
3430 };
3431
3432 expert_module_t* expert_eap;
3433
3434 proto_eap = proto_register_protocol("Extensible Authentication Protocol",
3435 "EAP", "eap");
3436 proto_register_field_array(proto_eap, hf, array_length(hf)(sizeof (hf) / sizeof (hf)[0]));
3437 proto_register_subtree_array(ett, array_length(ett)(sizeof (ett) / sizeof (ett)[0]));
3438 expert_eap = expert_register_protocol(proto_eap);
3439 expert_register_field_array(expert_eap, ei, array_length(ei)(sizeof (ei) / sizeof (ei)[0]));
3440
3441 eap_handle = register_dissector("eap", dissect_eap, proto_eap);
3442
3443 reassembly_table_register(&eap_tls_reassembly_table,
3444 &addresses_reassembly_table_functions);
3445
3446 eap_expanded_type_dissector_table = register_dissector_table("eap.ext.vendor_id",
3447 "EAP-EXT Vendor Id",
3448 proto_eap, FT_UINT24,
3449 BASE_HEX);
3450
3451 register_external_value_string_ext("eap_type_vals_ext", &eap_type_vals_ext);
3452}
3453
3454void
3455proto_reg_handoff_eap(void)
3456{
3457 /*
3458 * Get a handle for the SSL/TLS dissector.
3459 */
3460 tls_handle = find_dissector_add_dependency("tls", proto_eap);
3461 diameter_avps_handle = find_dissector_add_dependency("diameter_avps", proto_eap);
3462 peap_handle = find_dissector_add_dependency("peap", proto_eap);
3463 teap_handle = find_dissector_add_dependency("teap", proto_eap);
3464
3465 ike_handle = find_dissector_add_dependency("ike", proto_eap);
3466
3467 dissector_add_uint("ppp.protocol", PPP_EAP0xc227, eap_handle);
3468 dissector_add_uint("eapol.type", EAPOL_EAP0, eap_handle);
3469}
3470/*
3471 * Editor modelines
3472 *
3473 * Local Variables:
3474 * c-basic-offset: 2
3475 * tab-width: 8
3476 * indent-tabs-mode: nil
3477 * End:
3478 *
3479 * ex: set shiftwidth=2 tabstop=8 expandtab:
3480 * :indentSize=2:tabSize=8:noTabs=true:
3481 */