Coverage Report

Created: 2026-11-12 07:01

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/epan/dissectors/packet-gsm_sim.c
Line
Count
Source
1
/* packet-gsm_sim.c
2
 * Routines for packet dissection of GSM SIM APDUs (GSM TS 11.11)
3
 *
4
 *  GSM TS 11.11 / 3GPP TS 51.011
5
 *  3GPP TS 31.102
6
 * Copyright 2010-2011 by Harald Welte <laforge@gnumonks.org>
7
 *
8
 * Wireshark - Network traffic analyzer
9
 * By Gerald Combs <gerald@wireshark.org>
10
 * Copyright 1998 Gerald Combs
11
 *
12
 * SPDX-License-Identifier: GPL-2.0-or-later
13
 */
14
15
#include "config.h"
16
17
#include <epan/packet.h>
18
#include <epan/tfs.h>
19
#include <epan/unit_strings.h>
20
#include <epan/expert.h>
21
#include <epan/prefs.h>
22
#include <epan/reassemble.h>
23
24
#include <wiretap/wtap.h>
25
26
#include "packet-gsmtap.h"
27
#include "packet-sgp22.h"
28
#include "packet-sgp32.h"
29
30
void proto_register_gsm_sim(void);
31
void proto_reg_handoff_gsm_sim(void);
32
33
static int proto_gsm_sim;
34
35
/* ISO 7816-4 APDU */
36
static int hf_apdu_cla_coding;
37
static int hf_apdu_cla_coding_ext;
38
static int hf_apdu_cla_secure_messaging_ind;
39
static int hf_apdu_cla_secure_messaging_ind_ext;
40
static int hf_apdu_cla_log_chan;
41
static int hf_apdu_cla_log_chan_ext;
42
static int hf_apdu_ins;
43
static int hf_apdu_p1;
44
static int hf_apdu_p2;
45
static int hf_apdu_p3;
46
static int hf_apdu_lc;
47
static int hf_apdu_lc_ext;
48
static int hf_apdu_le;
49
static int hf_apdu_le_ext;
50
static int hf_apdu_data;
51
static int hf_apdu_sw;
52
static int hf_apdu_unknown;
53
54
static int hf_file_id;
55
static int hf_aid;
56
static int hf_bin_offset;
57
static int hf_referencing;
58
static int hf_sfi;
59
static int hf_record_nr;
60
static int hf_record_id;
61
static int hf_record_file;
62
static int hf_record_mode;
63
static int hf_auth_rand_len;
64
static int hf_auth_rand;
65
static int hf_auth_autn_len;
66
static int hf_auth_autn;
67
static int hf_auth_reference;
68
static int hf_auth_rfu;
69
static int hf_auth_context;
70
static int hf_auth_challenge;
71
static int hf_auth_response;
72
static int hf_auth_status;
73
static int hf_auth_res_len;
74
static int hf_auth_res;
75
static int hf_auth_ck_len;
76
static int hf_auth_ck;
77
static int hf_auth_ik_len;
78
static int hf_auth_ik;
79
static int hf_auth_kc_len;
80
static int hf_auth_kc;
81
static int hf_auth_auts_len;
82
static int hf_auth_auts;
83
static int hf_auth_gsm_rand;
84
static int hf_auth_gsm_sres_len;
85
static int hf_auth_gsm_sres;
86
static int hf_auth_gsm_kc_len;
87
static int hf_auth_gsm_kc;
88
static int hf_chan_op;
89
static int hf_chan_nr;
90
91
static int hf_select_type;
92
static int hf_select_rfu;
93
static int hf_select_session_control;
94
static int hf_select_unused_p2;
95
static int hf_select_return_data;
96
static int hf_select_selection;
97
98
static int hf_status_application_status;
99
static int hf_status_return_data;
100
101
static int hf_template_tag;
102
static int hf_template_len;
103
104
/* FCP template */
105
static int hf_fcp;
106
static int hf_fcp_tag;
107
static int hf_fcp_len;
108
static int hf_fcp_value;
109
static int hf_fcp_file_size;
110
static int hf_fcp_file_id;
111
static int hf_fcp_df_name;
112
static int hf_fcp_file_rfu_byte;
113
static int hf_fcp_file_rfu;
114
static int hf_fcp_file_accessibility;
115
static int hf_fcp_file_type;
116
static int hf_fcp_file_type_ext;
117
static int hf_fcp_ef_structure;
118
static int hf_fcp_ef_structure_ext;
119
static int hf_fcp_data_coding_byte;
120
static int hf_fcp_lifecycle_status;
121
static int hf_fcp_security_attr_compact;
122
static int hf_fcp_security_attr_expanded;
123
static int hf_fcp_security_attr_referenced;
124
static int hf_fcp_pin_status_do;
125
static int hf_fcp_total_file_size;
126
static int hf_fcp_sfi;
127
static int hf_fcp_record_len;
128
static int hf_fcp_num_records;
129
static int hf_fcp_prop;
130
static int hf_fcp_prop_tag;
131
static int hf_fcp_prop_len;
132
static int hf_fcp_prop_value;
133
static int hf_fcp_prop_uicc_clock_stop_allowed;
134
static int hf_fcp_prop_uicc_clock_stop_rfu;
135
static int hf_fcp_prop_uicc_clock_stop_0;
136
static int hf_fcp_prop_uicc_clock_stop_1;
137
static int hf_fcp_prop_uicc_supply_voltage_a;
138
static int hf_fcp_prop_uicc_supply_voltage_b;
139
static int hf_fcp_prop_uicc_supply_voltage_c;
140
static int hf_fcp_prop_uicc_supply_voltage_d;
141
static int hf_fcp_prop_app_supply_voltage_class;
142
static int hf_fcp_prop_app_power_consumption;
143
static int hf_fcp_prop_app_frequency;
144
static int hf_fcp_prop_min_app_clock_freq;
145
static int hf_fcp_prop_avail_memory;
146
static int hf_fcp_prop_file_details_der_encoding;
147
static int hf_fcp_prop_file_details_rfu;
148
static int hf_fcp_prop_reserved_file_size;
149
static int hf_fcp_prop_max_file_size;
150
static int hf_fcp_prop_supported_sys_cmds_terminal_capability;
151
static int hf_fcp_prop_supported_sys_cmds_rfu;
152
static int hf_fcp_prop_uicc_env_conditions_temp_class;
153
static int hf_fcp_prop_uicc_env_conditions_high_humidity;
154
static int hf_fcp_prop_uicc_env_conditions_rfu;
155
static int hf_fcp_prop_platform_to_platform_cat_secured_apdu;
156
static int hf_fcp_prop_test_config_state;
157
static int hf_fcp_prop_test_config_criterion_type;
158
159
static int hf_search_ef_identifier;
160
static int hf_search_mode;
161
static int hf_search_enhanced_type;
162
static int hf_search_enhanced_mode;
163
static int hf_search_enhanced_offset;
164
static int hf_search_enhanced_value;
165
166
static int hf_suspend_uicc_op;
167
static int hf_suspend_uicc_min_time_unit;
168
static int hf_suspend_uicc_min_time_length;
169
static int hf_suspend_uicc_max_time_unit;
170
static int hf_suspend_uicc_max_time_length;
171
static int hf_suspend_uicc_resume_token;
172
173
static int hf_store_data_block;
174
static int hf_store_data_encryption;
175
static int hf_store_data_structure;
176
static int hf_store_data_rfu;
177
static int hf_store_data_iso_case;
178
static int hf_store_data_block_nr;
179
180
/* Chapter 5.2 TS 11.14 and TS 31.111 */
181
static int hf_tprof_b1;
182
static int hf_tprof_b2;
183
static int hf_tprof_b3;
184
static int hf_tprof_b4;
185
static int hf_tprof_b5;
186
static int hf_tprof_b6;
187
static int hf_tprof_b7;
188
static int hf_tprof_b8;
189
static int hf_tprof_b9;
190
static int hf_tprof_b10;
191
static int hf_tprof_b11;
192
static int hf_tprof_b12;
193
static int hf_tprof_b13;
194
static int hf_tprof_b14;
195
static int hf_tprof_b15;
196
static int hf_tprof_b16;
197
static int hf_tprof_b17;
198
static int hf_tprof_b18;
199
static int hf_tprof_b19;
200
static int hf_tprof_b20;
201
static int hf_tprof_b21;
202
static int hf_tprof_b22;
203
static int hf_tprof_b23;
204
static int hf_tprof_b24;
205
static int hf_tprof_b25;
206
static int hf_tprof_b26;
207
static int hf_tprof_b27;
208
static int hf_tprof_b28;
209
static int hf_tprof_b29;
210
static int hf_tprof_b30;
211
static int hf_tprof_b31;
212
static int hf_tprof_b32;
213
static int hf_tprof_b33;
214
static int hf_tprof_b34;
215
static int hf_tprof_b35;
216
static int hf_tprof_b36;
217
static int hf_tprof_b37;
218
static int hf_tprof_b38;
219
static int hf_tprof_b39;
220
static int hf_tprof_unknown_byte;
221
/* First byte */
222
static int hf_tp_prof_dld;
223
static int hf_tp_sms_data_dld;
224
static int hf_tp_cb_data_dld;
225
static int hf_tp_menu_sel;
226
static int hf_tp_sms_data_dld_support;
227
static int hf_tp_timer_exp;
228
static int hf_tp_cc_sim_support;
229
static int hf_tp_cc_sim_support2;
230
/* Second byte (Other) */
231
static int hf_tp_cmd_res;
232
static int hf_tp_cc_sim;
233
static int hf_tp_cc_sim_support3;
234
static int hf_tp_mo_sms_sim;
235
static int hf_tp_cc_sim_support4;
236
static int hf_tp_ucs2_entry;
237
static int hf_tp_ucs2_display;
238
static int hf_tp_display_ext;
239
/* 3rd byte (Proactive SIM) */
240
static int hf_tp_pa_display_text;
241
static int hf_tp_pa_get_inkey;
242
static int hf_tp_pa_get_input;
243
static int hf_tp_pa_more_time;
244
static int hf_tp_pa_play_tone;
245
static int hf_tp_pa_poll_intv;
246
static int hf_tp_pa_polling_off;
247
static int hf_tp_pa_refresh;
248
/* 4th byte (Proactive SIM) */
249
static int hf_tp_pa_select_item;
250
static int hf_tp_pa_send_sms;
251
static int hf_tp_pa_send_ss;
252
static int hf_tp_pa_send_ussd;
253
static int hf_tp_pa_set_up_call;
254
static int hf_tp_pa_set_up_menu;
255
static int hf_tp_pa_prov_loci;
256
static int hf_tp_pa_prov_loci_nmr;
257
/* 5th byte (Event drive information) */
258
static int hf_tp_pa_evt_list;
259
static int hf_tp_ev_mt_call;
260
static int hf_tp_ev_call_connected;
261
static int hf_tp_ev_call_disconnected;
262
static int hf_tp_ev_location_status;
263
static int hf_tp_ev_user_activity;
264
static int hf_tp_ev_idle_screen;
265
static int hf_tp_ev_cardreader_status;
266
/* 6th byte (Event drive information extension) */
267
static int hf_tp_ev_lang_sel;
268
static int hf_tp_ev_brows_term;
269
static int hf_tp_ev_data_avail;
270
static int hf_tp_ev_chan_status;
271
static int hf_tp_ev_access_techno_change;
272
static int hf_tp_ev_disp_params_changed;
273
static int hf_tp_ev_local_conn;
274
static int hf_tp_ev_nwk_search_mode_change;
275
/* 7th byte (Multiple card proactive commands) */
276
static int hf_tp_pa_power_on;
277
static int hf_tp_pa_power_off;
278
static int hf_tp_pa_perform_card_apdu;
279
static int hf_tp_pa_get_reader_status;
280
static int hf_tp_pa_get_reader_status_id;
281
static int hf_tp_rfu;
282
/* 8th byte (Proactive SIM) */
283
static int hf_tp_pa_timer_start_stop;
284
static int hf_tp_pa_timer_get_current;
285
static int hf_tp_pa_prov_loci_date_tz;
286
static int hf_tp_pa_get_inkey_binary;
287
static int hf_tp_pa_set_up_idle_mode_text;
288
static int hf_tp_pa_run_at_command;
289
static int hf_tp_pa_2nd_alpha_setup_call;
290
static int hf_tp_pa_2nd_cc_sim_support;
291
/* 9th byte */
292
static int hf_tp_display_text;
293
static int hf_tp_send_dtmf_cmd;
294
static int hf_tp_pa_prov_loci_nmr2;
295
static int hf_tp_pa_prov_loci_lang;
296
static int hf_tp_pa_prov_loci_ta;
297
static int hf_tp_pa_lang_notif;
298
static int hf_tp_pa_launch_browser;
299
static int hf_tp_pa_prov_loci_access_techno;
300
/* 10th byte */
301
static int hf_tp_soft_key_support_select_item;
302
static int hf_tp_soft_key_support_set_up_menu;
303
static int hf_tp_rfu2;
304
/* 11th byte */
305
static int hf_tp_soft_key_info_max_nb;
306
/* 12th byte (Proactive SIM) */
307
static int hf_tp_pa_open_chan;
308
static int hf_tp_pa_close_chan;
309
static int hf_tp_pa_recv_data;
310
static int hf_tp_pa_send_data;
311
static int hf_tp_pa_get_chan_status;
312
static int hf_tp_pa_serv_search;
313
static int hf_tp_pa_get_serv_info;
314
static int hf_tp_pa_decl_serv;
315
/* 13th byte (Proactive SIM) */
316
static int hf_tp_bip_csd;
317
static int hf_tp_bip_gprs;
318
static int hf_tp_bip_bluetooth;
319
static int hf_tp_bip_irda;
320
static int hf_tp_bip_rs232;
321
static int hf_tp_num_chans;
322
/* 14th byte (Screen height) */
323
static int hf_tp_char_height;
324
static int hf_tp_nd;
325
static int hf_tp_nk;
326
static int hf_tp_sizing_supp;
327
/* 15th byte (Screen width) */
328
static int hf_tp_char_width;
329
static int hf_tp_var_fonts;
330
/* 16th byte (Screen effects) */
331
static int hf_tp_display_resize;
332
static int hf_tp_text_wrapping;
333
static int hf_tp_text_scrolling;
334
static int hf_tp_text_attributes;
335
static int hf_tp_rfu3;
336
static int hf_tp_width_red_menu;
337
/* 17th byte (Proactive SIM) */
338
static int hf_tp_bip_tcp_remote;
339
static int hf_tp_bip_udp_remote;
340
static int hf_tp_bip_tcp_server;
341
static int hf_tp_bip_tcp_local;
342
static int hf_tp_bip_udp_local;
343
static int hf_tp_bip_direct_com;
344
static int hf_tp_bip_eutran;
345
static int hf_tp_bip_hsdpa;
346
/* 18th byte */
347
static int hf_tp_pa_display_text_var_time_out;
348
static int hf_tp_pa_get_inkey_help;
349
static int hf_tp_bip_usb;
350
static int hf_tp_pa_get_inkey_var_time_out;
351
static int hf_tp_pa_prov_loci_esn;
352
static int hf_tp_cc_gprs;
353
static int hf_tp_pa_prov_loci_imeisv;
354
static int hf_tp_pa_prov_loci_search_mode_change;
355
/* 19th byte (TIA/EIA-136) */
356
static int hf_tp_tia_eia_version;
357
static int hf_tp_rfu4;
358
/* 20th byte (TIA/EIA/IS-820-A) */
359
static int hf_tp_tia_iea_is820a_reserved;
360
/* 21th byte (Extended Launch Browser Capability) */
361
static int hf_tp_ext_launch_browser_wml;
362
static int hf_tp_ext_launch_browser_xhtml;
363
static int hf_tp_ext_launch_browser_html;
364
static int hf_tp_ext_launch_browser_chtml;
365
static int hf_tp_rfu5;
366
/* 22th byte */
367
static int hf_tp_utran_ps_ext_params;
368
static int hf_tp_pa_prov_loci_batt_state;
369
static int hf_tp_pa_play_tone_melody;
370
static int hf_tp_mm_call_set_up_call;
371
static int hf_tp_toolkit_initiated_gba;
372
static int hf_tp_pa_retrieve_mm_msg;
373
static int hf_tp_pa_submit_mm_msg;
374
static int hf_tp_pa_display_mm_msg;
375
/* 23th byte */
376
static int hf_tp_pa_set_frames;
377
static int hf_tp_pa_get_frames_status;
378
static int hf_tp_mms_notif_download;
379
static int hf_tp_alpha_id_refresh_cmd;
380
static int hf_tp_geo_loc_report;
381
static int hf_tp_pa_prov_loci_meid;
382
static int hf_tp_pa_prov_loci_nmr_utran_eutran;
383
static int hf_tp_ussd_data_download;
384
/* 24th byte (Class "i") */
385
static int hf_tp_class_i_max_nb_frames;
386
static int hf_tp_rfu6;
387
/* 25th byte (Event driven information extensions) */
388
static int hf_tp_evt_browsing_status;
389
static int hf_tp_evt_mms_transfer_status;
390
static int hf_tp_evt_frame_info_changed;
391
static int hf_tp_evt_iwlan_access_status;
392
static int hf_tp_evt_nw_reject_geran_utran;
393
static int hf_tp_evt_hci_connectivity;
394
static int hf_tp_evt_nw_reject_eutran;
395
static int hf_tp_evt_mult_access_techno_change;
396
/* 26th byte (Event driven information extensions) */
397
static int hf_tp_evt_csg_cell_select;
398
static int hf_tp_evt_contactless_state_req;
399
static int hf_tp_rfu7;
400
/* 27th byte (Event driven information extensions) */
401
static int hf_tp_rfu8;
402
/* 28th byte (Text attributes) */
403
static int hf_tp_text_align_left;
404
static int hf_tp_text_align_centre;
405
static int hf_tp_text_align_right;
406
static int hf_tp_text_font_size_normal;
407
static int hf_tp_text_font_size_large;
408
static int hf_tp_text_font_size_small;
409
static int hf_tp_rfu9;
410
/* 29th byte (Text attributes) */
411
static int hf_tp_text_style_normal;
412
static int hf_tp_text_style_bold;
413
static int hf_tp_text_style_italic;
414
static int hf_tp_text_style_underlined;
415
static int hf_tp_text_style_strikethrough;
416
static int hf_tp_text_style_text_fg_colour;
417
static int hf_tp_text_style_text_bg_colour;
418
static int hf_tp_rfu10;
419
/* 30th byte */
420
static int hf_tp_bip_iwlan;
421
static int hf_tp_pa_prov_loci_wsid;
422
static int hf_tp_term_app;
423
static int hf_tp_steering_roaming_refresh;
424
static int hf_tp_pa_activate;
425
static int hf_tp_pa_geo_loc_req;
426
static int hf_tp_pa_prov_loci_broadcast_nw_info;
427
static int hf_tp_steering_roaming_iwlan_refresh;
428
/* 31th byte */
429
static int hf_tp_pa_contactless_state_changed;
430
static int hf_tp_csg_cell_discovery;
431
static int hf_tp_cnf_params_support_open_chan_server_mode;
432
static int hf_tp_com_ctrl_ims;
433
static int hf_tp_cat_over_modem_itf;
434
static int hf_tp_evt_incoming_data_ims;
435
static int hf_tp_evt_ims_registration;
436
static int hf_tp_pa_prof_env_cont;
437
/* 32th byte */
438
static int hf_tp_bip_ims;
439
static int hf_tp_pa_prov_loci_henb_ip_addr;
440
static int hf_tp_pa_prov_loci_henb_surround_macro;
441
static int hf_tp_launch_params_support_open_chan_server_mode;
442
static int hf_tp_direct_com_support_open_chan_server_mode;
443
static int hf_tp_pa_sec_prof_env_cont;
444
static int hf_tp_cat_serv_list_ecat_client;
445
static int hf_tp_support_refresh_enforcement_policy;
446
/* 33th byte */
447
static int hf_tp_support_dns_addr_req;
448
static int hf_tp_support_nw_access_name_reuse;
449
static int hf_tp_ev_poll_intv_nego;
450
static int hf_tp_prose_usage_info_reporting;
451
static int hf_tp_pa_prov_loci_rat;
452
static int hf_tp_evt_wlan_access_status;
453
static int hf_tp_wlan_bearer;
454
static int hf_tp_pa_prov_loci_wlan_id;
455
/* 34th byte */
456
static int hf_tp_uri_send_short_msg;
457
static int hf_tp_ims_uri_setup_call;
458
static int hf_tp_media_type_voice_setup_call;
459
static int hf_tp_media_type_video_setup_call;
460
static int hf_tp_pa_prov_loci_eutran_timing_advance_info;
461
static int hf_tp_refresh_euicc_profile_state_change;
462
static int hf_tp_ext_rej_cause_code_nw_reject_eutran;
463
static int hf_tp_deprecated_b34;
464
/* 35th byte */
465
static int hf_tp_pa_get_input_var_timeout;
466
static int hf_tp_data_conn_status_change_pdp;
467
static int hf_tp_data_conn_status_change_pdn;
468
static int hf_tp_refresh_app_update;
469
static int hf_tp_pa_lsi_proactive_session_request;
470
static int hf_tp_pa_lsi_uicc_platform_reset;
471
static int hf_tp_rfu11;
472
/* 36th byte */
473
static int hf_tp_data_conn_status_change_pdu;
474
static int hf_tp_evt_nw_reject_ng_ran;
475
static int hf_tp_non_ip_data_delivery;
476
static int hf_tp_prov_loci_slice_info;
477
static int hf_tp_refresh_sor_cmci_param;
478
static int hf_tp_evt_nw_reject_satellite_ng_ran;
479
static int hf_tp_cag_feature;
480
static int hf_tp_evt_slices_status_change;
481
/* 37th byte */
482
static int hf_tp_prov_loci_rejected_slice_info;
483
static int hf_tp_ext_info_pli;
484
static int hf_tp_chaining_pli_env_cmds;
485
static int hf_tp_5g_prose_usage_info_reporting;
486
static int hf_tp_rfu12;
487
/* 38th byte */
488
static int hf_tp_rfu13;
489
/* 39th byte */
490
static int hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info;
491
static int hf_tp_rfu14;
492
493
/* Terminal Capability */
494
static int hf_tc;
495
static int hf_tc_tag;
496
static int hf_tc_len;
497
static int hf_tc_value;
498
static int hf_tc_actual_used_supply_voltage_class;
499
static int hf_tc_max_available_power_supply;
500
static int hf_tc_actual_used_clock_frequency;
501
static int hf_tc_additional_interfaces_uicc_clf;
502
static int hf_tc_additional_interfaces_rfu;
503
static int hf_tc_sgp22_luid;
504
static int hf_tc_sgp22_lpdd;
505
static int hf_tc_sgp22_ldsd;
506
static int hf_tc_sgp22_luie;
507
static int hf_tc_sgp22_rfu;
508
static int hf_tc_sgp32_ipad;
509
static int hf_tc_sgp32_rfu;
510
511
static int hf_cat_ber_tag;
512
513
static int hf_related_to;
514
static int hf_response_in;
515
static int hf_response_to;
516
static int hf_response_time;
517
518
static int ett_sim;
519
static int ett_tprof_b1;
520
static int ett_tprof_b2;
521
static int ett_tprof_b3;
522
static int ett_tprof_b4;
523
static int ett_tprof_b5;
524
static int ett_tprof_b6;
525
static int ett_tprof_b7;
526
static int ett_tprof_b8;
527
static int ett_tprof_b9;
528
static int ett_tprof_b10;
529
static int ett_tprof_b11;
530
static int ett_tprof_b12;
531
static int ett_tprof_b13;
532
static int ett_tprof_b14;
533
static int ett_tprof_b15;
534
static int ett_tprof_b16;
535
static int ett_tprof_b17;
536
static int ett_tprof_b18;
537
static int ett_tprof_b19;
538
static int ett_tprof_b20;
539
static int ett_tprof_b21;
540
static int ett_tprof_b22;
541
static int ett_tprof_b23;
542
static int ett_tprof_b24;
543
static int ett_tprof_b25;
544
static int ett_tprof_b26;
545
static int ett_tprof_b27;
546
static int ett_tprof_b28;
547
static int ett_tprof_b29;
548
static int ett_tprof_b30;
549
static int ett_tprof_b31;
550
static int ett_tprof_b32;
551
static int ett_tprof_b33;
552
static int ett_tprof_b34;
553
static int ett_tprof_b35;
554
static int ett_tprof_b36;
555
static int ett_tprof_b37;
556
static int ett_tprof_b38;
557
static int ett_tprof_b39;
558
static int ett_terminal_capability;
559
static int ett_auth_challenge;
560
static int ett_auth_response;
561
static int ett_fcp;
562
static int ett_fcp_proprietary;
563
564
static expert_field ei_unknown_bytes;
565
566
static dissector_handle_t sub_handle_cap;
567
static dissector_handle_t sim_handle, sim_part_handle;
568
569
/* The response contains no channel number to compare to and the spec explicitly
570
 * prohibits interleaving of command/response pairs, regardless of logical channels.
571
 */
572
typedef struct gsm_sim_transaction {
573
  uint32_t cmd_frame;
574
  uint32_t rsp_frame;
575
  nstime_t cmd_time;
576
  uint8_t  cmd_ins;
577
  uint8_t  cmd_p1;
578
  uint8_t  cmd_p2;
579
580
  /* Related transaction used for GET RESPONSE and APDU reassembly. May point to self. */
581
  struct gsm_sim_transaction *related_trans;
582
} gsm_sim_transaction_t;
583
584
static wmem_tree_t *transactions;
585
586
/* eUICC type as indicated by the ISD-R proprietary application template, or inferred
587
 * from the ES10 messages seen, keyed by frame number. */
588
typedef enum {
589
  RSP_TYPE_UNKNOWN,
590
  RSP_TYPE_SGP22,
591
  RSP_TYPE_SGP32
592
} rsp_type_t;
593
594
static const enum_val_t rsp_type_vals[] = {
595
  { "auto",  "Automatic", RSP_TYPE_UNKNOWN },
596
  { "sgp22", "SGP.22",    RSP_TYPE_SGP22 },
597
  { "sgp32", "SGP.32",    RSP_TYPE_SGP32 },
598
  { NULL, NULL, 0 }
599
};
600
601
static int pref_rsp_type = RSP_TYPE_UNKNOWN;
602
static wmem_tree_t *rsp_types;
603
604
static reassembly_table gsm_sim_reassembly_table;
605
606
static int hf_gsm_sim_fragments;
607
static int hf_gsm_sim_fragment;
608
static int hf_gsm_sim_fragment_overlap;
609
static int hf_gsm_sim_fragment_overlap_conflicts;
610
static int hf_gsm_sim_fragment_multiple_tails;
611
static int hf_gsm_sim_fragment_too_long_fragment;
612
static int hf_gsm_sim_fragment_error;
613
static int hf_gsm_sim_fragment_count;
614
static int hf_gsm_sim_reassembled_in;
615
static int hf_gsm_sim_reassembled_length;
616
617
static int ett_gsm_sim_fragment;
618
static int ett_gsm_sim_fragments;
619
620
static const fragment_items gsm_sim_frag_items = {
621
  /* Fragment subtrees */
622
  &ett_gsm_sim_fragment,
623
  &ett_gsm_sim_fragments,
624
  /* Fragment fields */
625
  &hf_gsm_sim_fragments,
626
  &hf_gsm_sim_fragment,
627
  &hf_gsm_sim_fragment_overlap,
628
  &hf_gsm_sim_fragment_overlap_conflicts,
629
  &hf_gsm_sim_fragment_multiple_tails,
630
  &hf_gsm_sim_fragment_too_long_fragment,
631
  &hf_gsm_sim_fragment_error,
632
  &hf_gsm_sim_fragment_count,
633
  /* Reassembled in field */
634
  &hf_gsm_sim_reassembled_in,
635
  /* Reassembled length field */
636
  &hf_gsm_sim_reassembled_length,
637
  /* Reassembled data field */
638
  NULL,
639
  /* Tag */
640
  "APDU fragments"
641
};
642
643
static int * const tprof_b1_fields[] = {
644
  &hf_tp_prof_dld,
645
  &hf_tp_sms_data_dld,
646
  &hf_tp_cb_data_dld,
647
  &hf_tp_menu_sel,
648
  &hf_tp_sms_data_dld_support,
649
  &hf_tp_timer_exp,
650
  &hf_tp_cc_sim_support,
651
  &hf_tp_cc_sim_support2,
652
  NULL
653
};
654
655
static int * const tprof_b2_fields[] = {
656
  &hf_tp_cmd_res,
657
  &hf_tp_cc_sim,
658
  &hf_tp_cc_sim_support3,
659
  &hf_tp_mo_sms_sim,
660
  &hf_tp_cc_sim_support4,
661
  &hf_tp_ucs2_entry,
662
  &hf_tp_ucs2_display,
663
  &hf_tp_display_ext,
664
  NULL
665
};
666
667
static int * const tprof_b3_fields[] = {
668
  &hf_tp_pa_display_text,
669
  &hf_tp_pa_get_inkey,
670
  &hf_tp_pa_get_input,
671
  &hf_tp_pa_more_time,
672
  &hf_tp_pa_play_tone,
673
  &hf_tp_pa_poll_intv,
674
  &hf_tp_pa_polling_off,
675
  &hf_tp_pa_refresh,
676
  NULL
677
};
678
679
static int * const tprof_b4_fields[] = {
680
  &hf_tp_pa_select_item,
681
  &hf_tp_pa_send_sms,
682
  &hf_tp_pa_send_ss,
683
  &hf_tp_pa_send_ussd,
684
  &hf_tp_pa_set_up_call,
685
  &hf_tp_pa_set_up_menu,
686
  &hf_tp_pa_prov_loci,
687
  &hf_tp_pa_prov_loci_nmr,
688
  NULL
689
};
690
691
static int * const tprof_b5_fields[] = {
692
  &hf_tp_pa_evt_list,
693
  &hf_tp_ev_mt_call,
694
  &hf_tp_ev_call_connected,
695
  &hf_tp_ev_call_disconnected,
696
  &hf_tp_ev_location_status,
697
  &hf_tp_ev_user_activity,
698
  &hf_tp_ev_idle_screen,
699
  &hf_tp_ev_cardreader_status,
700
  NULL
701
};
702
703
static int * const tprof_b6_fields[] = {
704
  &hf_tp_ev_lang_sel,
705
  &hf_tp_ev_brows_term,
706
  &hf_tp_ev_data_avail,
707
  &hf_tp_ev_chan_status,
708
  &hf_tp_ev_access_techno_change,
709
  &hf_tp_ev_disp_params_changed,
710
  &hf_tp_ev_local_conn,
711
  &hf_tp_ev_nwk_search_mode_change,
712
  NULL
713
};
714
715
static int * const tprof_b7_fields[] = {
716
  &hf_tp_pa_power_on,
717
  &hf_tp_pa_power_off,
718
  &hf_tp_pa_perform_card_apdu,
719
  &hf_tp_pa_get_reader_status,
720
  &hf_tp_pa_get_reader_status_id,
721
  &hf_tp_rfu,
722
  NULL
723
};
724
725
static int * const tprof_b8_fields[] = {
726
  &hf_tp_pa_timer_start_stop,
727
  &hf_tp_pa_timer_get_current,
728
  &hf_tp_pa_prov_loci_date_tz,
729
  &hf_tp_pa_get_inkey_binary,
730
  &hf_tp_pa_set_up_idle_mode_text,
731
  &hf_tp_pa_run_at_command,
732
  &hf_tp_pa_2nd_alpha_setup_call,
733
  &hf_tp_pa_2nd_cc_sim_support,
734
  NULL
735
};
736
737
static int * const tprof_b9_fields[] = {
738
  &hf_tp_display_text,
739
  &hf_tp_send_dtmf_cmd,
740
  &hf_tp_pa_prov_loci_nmr2,
741
  &hf_tp_pa_prov_loci_lang,
742
  &hf_tp_pa_prov_loci_ta,
743
  &hf_tp_pa_lang_notif,
744
  &hf_tp_pa_launch_browser,
745
  &hf_tp_pa_prov_loci_access_techno,
746
  NULL
747
};
748
749
static int * const tprof_b10_fields[] = {
750
  &hf_tp_soft_key_support_select_item,
751
  &hf_tp_soft_key_support_set_up_menu,
752
  &hf_tp_rfu2,
753
  NULL
754
};
755
756
static int * const tprof_b11_fields[] = {
757
  &hf_tp_soft_key_info_max_nb,
758
  NULL
759
};
760
761
static int * const tprof_b12_fields[] = {
762
  &hf_tp_pa_open_chan,
763
  &hf_tp_pa_close_chan,
764
  &hf_tp_pa_recv_data,
765
  &hf_tp_pa_send_data,
766
  &hf_tp_pa_get_chan_status,
767
  &hf_tp_pa_serv_search,
768
  &hf_tp_pa_get_serv_info,
769
  &hf_tp_pa_decl_serv,
770
  NULL
771
};
772
773
static int * const tprof_b13_fields[] = {
774
  &hf_tp_bip_csd,
775
  &hf_tp_bip_gprs,
776
  &hf_tp_bip_bluetooth,
777
  &hf_tp_bip_irda,
778
  &hf_tp_bip_rs232,
779
  &hf_tp_num_chans,
780
  NULL
781
};
782
783
static int * const tprof_b14_fields[] = {
784
  &hf_tp_char_height,
785
  &hf_tp_nd,
786
  &hf_tp_nk,
787
  &hf_tp_sizing_supp,
788
  NULL
789
};
790
791
static int * const tprof_b15_fields[] = {
792
  &hf_tp_char_width,
793
  &hf_tp_var_fonts,
794
  NULL
795
};
796
797
static int * const tprof_b16_fields[] = {
798
  &hf_tp_display_resize,
799
  &hf_tp_text_wrapping,
800
  &hf_tp_text_scrolling,
801
  &hf_tp_text_attributes,
802
  &hf_tp_rfu3,
803
  &hf_tp_width_red_menu,
804
  NULL
805
};
806
static int * const tprof_b17_fields[] = {
807
  &hf_tp_bip_tcp_remote,
808
  &hf_tp_bip_udp_remote,
809
  &hf_tp_bip_tcp_server,
810
  &hf_tp_bip_tcp_local,
811
  &hf_tp_bip_udp_local,
812
  &hf_tp_bip_direct_com,
813
  &hf_tp_bip_eutran,
814
  &hf_tp_bip_hsdpa,
815
  NULL
816
};
817
static int * const tprof_b18_fields[] = {
818
  &hf_tp_pa_display_text_var_time_out,
819
  &hf_tp_pa_get_inkey_help,
820
  &hf_tp_bip_usb,
821
  &hf_tp_pa_get_inkey_var_time_out,
822
  &hf_tp_pa_prov_loci_esn,
823
  &hf_tp_cc_gprs,
824
  &hf_tp_pa_prov_loci_imeisv,
825
  &hf_tp_pa_prov_loci_search_mode_change,
826
  NULL
827
};
828
static int * const tprof_b19_fields[] = {
829
  &hf_tp_tia_eia_version,
830
  &hf_tp_rfu4,
831
  NULL
832
};
833
834
static int * const tprof_b20_fields[] = {
835
  &hf_tp_tia_iea_is820a_reserved,
836
  NULL
837
};
838
839
static int * const tprof_b21_fields[] = {
840
  &hf_tp_ext_launch_browser_wml,
841
  &hf_tp_ext_launch_browser_xhtml,
842
  &hf_tp_ext_launch_browser_html,
843
  &hf_tp_ext_launch_browser_chtml,
844
  &hf_tp_rfu5,
845
  NULL
846
};
847
848
static int * const tprof_b22_fields[] = {
849
  &hf_tp_utran_ps_ext_params,
850
  &hf_tp_pa_prov_loci_batt_state,
851
  &hf_tp_pa_play_tone_melody,
852
  &hf_tp_mm_call_set_up_call,
853
  &hf_tp_toolkit_initiated_gba,
854
  &hf_tp_pa_retrieve_mm_msg,
855
  &hf_tp_pa_submit_mm_msg,
856
  &hf_tp_pa_display_mm_msg,
857
  NULL
858
};
859
860
static int * const tprof_b23_fields[] = {
861
  &hf_tp_pa_set_frames,
862
  &hf_tp_pa_get_frames_status,
863
  &hf_tp_mms_notif_download,
864
  &hf_tp_alpha_id_refresh_cmd,
865
  &hf_tp_geo_loc_report,
866
  &hf_tp_pa_prov_loci_meid,
867
  &hf_tp_pa_prov_loci_nmr_utran_eutran,
868
  &hf_tp_ussd_data_download,
869
  NULL
870
};
871
872
static int * const tprof_b24_fields[] = {
873
  &hf_tp_class_i_max_nb_frames,
874
  &hf_tp_rfu6,
875
  NULL
876
};
877
878
static int * const tprof_b25_fields[] = {
879
  &hf_tp_evt_browsing_status,
880
  &hf_tp_evt_mms_transfer_status,
881
  &hf_tp_evt_frame_info_changed,
882
  &hf_tp_evt_iwlan_access_status,
883
  &hf_tp_evt_nw_reject_geran_utran,
884
  &hf_tp_evt_hci_connectivity,
885
  &hf_tp_evt_nw_reject_eutran,
886
  &hf_tp_evt_mult_access_techno_change,
887
  NULL
888
};
889
890
static int * const tprof_b26_fields[] = {
891
  &hf_tp_evt_csg_cell_select,
892
  &hf_tp_evt_contactless_state_req,
893
  &hf_tp_rfu7,
894
  NULL
895
};
896
897
static int * const tprof_b27_fields[] = {
898
  &hf_tp_rfu8,
899
  NULL
900
};
901
902
static int * const tprof_b28_fields[] = {
903
  &hf_tp_text_align_left,
904
  &hf_tp_text_align_centre,
905
  &hf_tp_text_align_right,
906
  &hf_tp_text_font_size_normal,
907
  &hf_tp_text_font_size_large,
908
  &hf_tp_text_font_size_small,
909
  &hf_tp_rfu9,
910
  NULL
911
};
912
913
static int * const tprof_b29_fields[] = {
914
  &hf_tp_text_style_normal,
915
  &hf_tp_text_style_bold,
916
  &hf_tp_text_style_italic,
917
  &hf_tp_text_style_underlined,
918
  &hf_tp_text_style_strikethrough,
919
  &hf_tp_text_style_text_fg_colour,
920
  &hf_tp_text_style_text_bg_colour,
921
  &hf_tp_rfu10,
922
  NULL
923
};
924
925
static int * const tprof_b30_fields[] = {
926
  &hf_tp_bip_iwlan,
927
  &hf_tp_pa_prov_loci_wsid,
928
  &hf_tp_term_app,
929
  &hf_tp_steering_roaming_refresh,
930
  &hf_tp_pa_activate,
931
  &hf_tp_pa_geo_loc_req,
932
  &hf_tp_pa_prov_loci_broadcast_nw_info,
933
  &hf_tp_steering_roaming_iwlan_refresh,
934
  NULL
935
};
936
937
static int * const tprof_b31_fields[] = {
938
  &hf_tp_pa_contactless_state_changed,
939
  &hf_tp_csg_cell_discovery,
940
  &hf_tp_cnf_params_support_open_chan_server_mode,
941
  &hf_tp_com_ctrl_ims,
942
  &hf_tp_cat_over_modem_itf,
943
  &hf_tp_evt_incoming_data_ims,
944
  &hf_tp_evt_ims_registration,
945
  &hf_tp_pa_prof_env_cont,
946
  NULL
947
};
948
949
static int * const tprof_b32_fields[] = {
950
  &hf_tp_bip_ims,
951
  &hf_tp_pa_prov_loci_henb_ip_addr,
952
  &hf_tp_pa_prov_loci_henb_surround_macro,
953
  &hf_tp_launch_params_support_open_chan_server_mode,
954
  &hf_tp_direct_com_support_open_chan_server_mode,
955
  &hf_tp_pa_sec_prof_env_cont,
956
  &hf_tp_cat_serv_list_ecat_client,
957
  &hf_tp_support_refresh_enforcement_policy,
958
  NULL
959
};
960
961
static int * const tprof_b33_fields[] = {
962
  &hf_tp_support_dns_addr_req,
963
  &hf_tp_support_nw_access_name_reuse,
964
  &hf_tp_ev_poll_intv_nego,
965
  &hf_tp_prose_usage_info_reporting,
966
  &hf_tp_pa_prov_loci_rat,
967
  &hf_tp_evt_wlan_access_status,
968
  &hf_tp_wlan_bearer,
969
  &hf_tp_pa_prov_loci_wlan_id,
970
  NULL
971
};
972
973
static int * const tprof_b34_fields[] = {
974
  &hf_tp_uri_send_short_msg,
975
  &hf_tp_ims_uri_setup_call,
976
  &hf_tp_media_type_voice_setup_call,
977
  &hf_tp_media_type_video_setup_call,
978
  &hf_tp_pa_prov_loci_eutran_timing_advance_info,
979
  &hf_tp_refresh_euicc_profile_state_change,
980
  &hf_tp_ext_rej_cause_code_nw_reject_eutran,
981
  &hf_tp_deprecated_b34,
982
  NULL
983
};
984
985
static int * const tprof_b35_fields[] = {
986
  &hf_tp_pa_get_input_var_timeout,
987
  &hf_tp_data_conn_status_change_pdp,
988
  &hf_tp_data_conn_status_change_pdn,
989
  &hf_tp_refresh_app_update,
990
  &hf_tp_pa_lsi_proactive_session_request,
991
  &hf_tp_pa_lsi_uicc_platform_reset,
992
  &hf_tp_rfu11,
993
  NULL
994
};
995
996
static int * const tprof_b36_fields[] = {
997
  &hf_tp_data_conn_status_change_pdu,
998
  &hf_tp_evt_nw_reject_ng_ran,
999
  &hf_tp_non_ip_data_delivery,
1000
  &hf_tp_prov_loci_slice_info,
1001
  &hf_tp_refresh_sor_cmci_param,
1002
  &hf_tp_evt_nw_reject_satellite_ng_ran,
1003
  &hf_tp_cag_feature,
1004
  &hf_tp_evt_slices_status_change,
1005
  NULL
1006
};
1007
1008
static int * const tprof_b37_fields[] = {
1009
  &hf_tp_prov_loci_rejected_slice_info,
1010
  &hf_tp_ext_info_pli,
1011
  &hf_tp_chaining_pli_env_cmds,
1012
  &hf_tp_5g_prose_usage_info_reporting,
1013
  &hf_tp_rfu12,
1014
  NULL
1015
};
1016
1017
static int * const tprof_b38_fields[] = {
1018
  &hf_tp_rfu13,
1019
  NULL
1020
};
1021
1022
static int * const tprof_b39_fields[] = {
1023
  &hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info,
1024
  &hf_tp_rfu14,
1025
  NULL
1026
};
1027
1028
/* According to Section 7.2 of ETSI TS 101 220 / Chapter 7.2 */
1029
/* BER-TLV tag CAT templates */
1030
static const value_string ber_tlv_cat_tag_vals[] = {
1031
  { 0xcf, "Reserved for proprietary use (terminal->UICC)" },
1032
  { 0xd0, "Proactive Command" },
1033
  { 0xd1, "GSM/3GPP/3GPP2 - SMS-PP Download" },
1034
  { 0xd2, "GSM/3GPP/3GPP2 - Cell Broadcast Download" },
1035
  { 0xd3, "Menu selection" },
1036
  { 0xd4, "Call Control" },
1037
  { 0xd5, "GSM/3GPP - MO Short Message control" },
1038
  { 0xd6, "Event Download" },
1039
  { 0xd7, "Timer Expiration" },
1040
  { 0xd8, "Reserved for intra-UICC communication" },
1041
  { 0xd9, "3GPP - USSD Download" },
1042
  { 0xda, "MMS Transfer status" },
1043
  { 0xdb, "MMS notification download" },
1044
  { 0xdc, "Terminal application" },
1045
  { 0xdd, "3GPP - Geographical Location Reporting" },
1046
  { 0xde, "Envelope Container" },
1047
  { 0xdf, "3GPP - ProSe Report tag" },
1048
  { 0, NULL }
1049
};
1050
1051
static const value_string template_tag_vals[] = {
1052
  { 0x62, "FCP template" },
1053
  { 0x6F, "FCI template" },
1054
  { 0xA9, "Terminal Capability" },
1055
  { 0, NULL }
1056
};
1057
1058
static const value_string supply_voltage_class_vals[] = {
1059
  { 0x01, "Class A (4.5 - 5.5 V)" },
1060
  { 0x02, "Class B (2.7 - 3.3 V)" },
1061
  { 0x04, "Class C (1.62 - 1.98 V)" },
1062
  { 0x08, "Class D (1.1 - 1.3 V)" },
1063
  { 0x10, "Class E (RFU)" },
1064
  { 0, NULL }
1065
};
1066
1067
/* FCP template tags (ETSI TS 102.221) */
1068
static const value_string fcp_tag_vals[] = {
1069
  { 0x80, "File size" },
1070
  { 0x81, "Total file size" },
1071
  { 0x82, "File Descriptor" },
1072
  { 0x83, "File Identifier" },
1073
  { 0x84, "DF name (AID)" },
1074
  { 0x88, "Short File Identifier (SFI)" },
1075
  { 0x8A, "Life Cycle Status Integer" },
1076
  { 0x8B, "Security attributes (referenced to expanded format)" },
1077
  { 0x8C, "Security attributes (compact format)" },
1078
  { 0xA5, "Proprietary information" },
1079
  { 0xAB, "Security attributes (expanded format)" },
1080
  { 0xC6, "PIN Status Template DO" },
1081
  { 0xE0, "ISD-R Proprietary Application Template"},
1082
  { 0xE1, "ISD-R Proprietary Application Template IoT"},
1083
  { 0, NULL }
1084
};
1085
1086
static const true_false_string fcp_file_accessibility_tfs = {
1087
  "Shareable file",
1088
  "Not shareable file"
1089
};
1090
1091
static const value_string fcp_file_type_vals[] = {
1092
  { 0x0, "Working EF" },
1093
  { 0x1, "Internal EF" },
1094
  { 0x2, "RFU" },
1095
  { 0x3, "RFU" },
1096
  { 0x4, "RFU" },
1097
  { 0x5, "RFU" },
1098
  { 0x6, "RFU" },
1099
  { 0, NULL }
1100
};
1101
1102
static const value_string fcp_file_type_ext_vals[] = {
1103
  { 0x38, "DF or ADF" },
1104
  { 0, NULL }
1105
};
1106
1107
static const value_string fcp_ef_structure_vals[] = {
1108
  { 0x00, "No information given" },
1109
  { 0x01, "Transparent structure" },
1110
  { 0x02, "Linear fixed structure" },
1111
  { 0x03, "RFU" },
1112
  { 0x04, "RFU" },
1113
  { 0x05, "RFU" },
1114
  { 0x06, "Cyclic structure" },
1115
  { 0x07, "RFU" },
1116
  { 0, NULL }
1117
};
1118
1119
static const value_string fcp_ef_structure_ext_vals[] = {
1120
  { 0x39, "BER-TLV structure" },
1121
  { 0, NULL }
1122
};
1123
1124
static const range_string fcp_lifecycle_status_vals[] = {
1125
  { 0x00, 0x00, "No information given" },
1126
  { 0x01, 0x01, "Creation state" },
1127
  { 0x02, 0x02, "RFU" },
1128
  { 0x03, 0x03, "Initialization state" },
1129
  { 0x04, 0x04, "Operational state - deactivated" },
1130
  { 0x05, 0x05, "Operational state - activated" },
1131
  { 0x06, 0x06, "Operational state - deactivated" },
1132
  { 0x07, 0x07, "Operational state - activated" },
1133
  { 0x08, 0x0B, "RFU" },
1134
  { 0x0C, 0x0F, "Termination state" },
1135
  { 0x10, 0xFF, "Proprietary" },
1136
  { 0, 0, NULL }
1137
};
1138
1139
static const value_string fcp_prop_tag_vals[] = {
1140
  { 0x80, "UICC characteristics" },
1141
  { 0x81, "Application power consumption" },
1142
  { 0x82, "Minimum application clock frequency" },
1143
  { 0x83, "Amount of available memory" },
1144
  { 0x84, "File details" },
1145
  { 0x85, "Reserved file size" },
1146
  { 0x86, "Maximum file size" },
1147
  { 0x87, "Supported system commands" },
1148
  { 0x88, "Specific UICC environmental conditions" },
1149
  { 0x89, "Platform to Platform CAT Secured APDU" },
1150
  { 0x8A, "Test configuration state" },
1151
  { 0x8B, "Test configuration criterion type" },
1152
  { 0, NULL }
1153
};
1154
1155
static const value_string fcp_uicc_clock_stop_0_vals[] = {
1156
  { 0x00, "Never" },
1157
  { 0x01, "Unless at high level" },
1158
  { 0x02, "Unless at low level"},
1159
  { 0x03, "RFU" },
1160
  { 0, NULL }
1161
};
1162
1163
static const value_string fcp_uicc_clock_stop_1_vals[] = {
1164
  { 0x00, "No preferred level" },
1165
  { 0x01, "High level preferred" },
1166
  { 0x02, "Low level preferred" },
1167
  { 0x03, "RFU" },
1168
  { 0, NULL }
1169
};
1170
1171
static const value_string fcp_uicc_env_conditions_temp_class_vals[] = {
1172
  { 0x00, "Standard temperature range" },
1173
  { 0x01, "Temperature class A" },
1174
  { 0x02, "Temperature class B" },
1175
  { 0x03, "Temperature class C" },
1176
  { 0x04, "RFU" },
1177
  { 0x05, "RFU" },
1178
  { 0x06, "RFU" },
1179
  { 0x07, "RFU" },
1180
  { 0, NULL }
1181
};
1182
1183
static const value_string terminal_capability_tag_vals[] = {
1184
  { 0x80, "Terminal power supply" },
1185
  { 0x81, "Extended logical channels terminal support" },
1186
  { 0x82, "Additional interfaces support" },
1187
  { 0x83, "RSP Device Capabilities (SGP.22)" },
1188
  { 0x84, "IoT Device Capabilities (SGP.32)" },
1189
  { 0, NULL }
1190
};
1191
1192
static const value_string chan_op_vals[] = {
1193
  { 0x00, "Open Channel" },
1194
  { 0x80, "Close Channel" },
1195
  { 0, NULL }
1196
};
1197
1198
static const value_string suspend_uicc_vals[] = {
1199
  { 0x00, "Suspend the UICC" },
1200
  { 0x01, "Resume the UICC" },
1201
  { 0, NULL }
1202
};
1203
1204
static const value_string suspend_time_unit_vals[] = {
1205
  { 0x00, "Seconds" },
1206
  { 0x01, "Minutes" },
1207
  { 0x02, "Hours" },
1208
  { 0x03, "Days" },
1209
  { 0x04, "10 Days" },
1210
  { 0, NULL }
1211
};
1212
1213
static const value_string apdu_le_vals[] = {
1214
  { 0x00, "Any number in the range 1 to 256" },
1215
  { 0, NULL }
1216
};
1217
1218
static const value_string apdu_le_vals_ext[] = {
1219
  { 0x00, "Any number in the range 1 to 65535" },
1220
  { 0, NULL }
1221
};
1222
1223
static const value_string apdu_cla_coding_vals[] = {
1224
  { 0x00, "ISO/IEC 7816-4" },
1225
  { 0x08, "ETSI TS 102.221" },
1226
  { 0x0a, "ISO/IEC 7816-4 unless stated otherwise" },
1227
  { 0, NULL }
1228
};
1229
1230
static const value_string apdu_cla_coding_ext_vals[] = {
1231
  { 0x01, "ISO/IEC 7816-4" },
1232
  { 0x03, "ETSI TS 102.221" },
1233
  { 0, NULL }
1234
};
1235
1236
static const value_string apdu_cla_secure_messaging_ind_vals[] = {
1237
  { 0x00, "No SM used between terminal and card" },
1238
  { 0x01, "Proprietary SM format" },
1239
  { 0x02, "Command header not authenticated" },
1240
  { 0x03, "Command header authenticated" },
1241
  { 0, NULL }
1242
};
1243
1244
static const true_false_string apdu_cla_secure_messaging_ind_ext_val = {
1245
  "Command header not authenticated",
1246
  "No SM used between terminal and card"
1247
};
1248
1249
static const true_false_string apdu_auth_reference_val = {
1250
  "Specific reference data (e.g. DF specific/application dependent KEY)",
1251
  "Global reference data (e.g. MF specific KEY)"
1252
};
1253
1254
static const value_string apdu_auth_context_vals[] = {
1255
  { 0x00, "GSM context" },
1256
  { 0x01, "3G/EPS/5G context" },
1257
  { 0x02, "VGCS/VBS context" },
1258
  { 0x04, "GBA context" },
1259
  { 0, NULL }
1260
};
1261
1262
static const value_string apdu_auth_status_vals[] = {
1263
  { 0xDB, "Successful 3G authentication" },
1264
  { 0xDC, "Synchronisation failure" },
1265
  { 0, NULL }
1266
};
1267
1268
/* Table 9 of GSM TS 11.11 */
1269
static const value_string apdu_ins_vals[] = {
1270
  { 0xA4, "SELECT" },
1271
  { 0xF2, "STATUS" },
1272
  { 0xB0, "READ BINARY" },
1273
  { 0xD6, "UPDATE BINARY" },
1274
  { 0xB2, "READ RECORD" },
1275
  { 0xDC, "UPDATE RECORD" },
1276
  { 0xA2, "SEARCH RECORD" },
1277
  { 0x32, "INCREASE" },
1278
  { 0x20, "VERIFY CHV" },
1279
  { 0x24, "CHANGE CHV" },
1280
  { 0x26, "DISABLE CHV" },
1281
  { 0x28, "ENABLE CHV" },
1282
  { 0x2C, "UNBLOCK CHV" },
1283
  { 0x04, "INVALIDATE / REHABILITATE" },
1284
  { 0x44, "REHABILITATE / ACTIVATE" },
1285
  { 0x88, "RUN GSM ALGORITHM / AUTHENTICATE" },
1286
  { 0xFA, "SLEEP" },
1287
  { 0xC0, "GET RESPONSE" },
1288
  { 0x10, "TERMINAL PROFILE" },
1289
  { 0xC2, "ENVELOPE" },
1290
  { 0x12, "FETCH" },
1291
  { 0x14, "TERMINAL RESPONSE" },
1292
  /* Only in TS 102 221 v9.2.0 */
1293
  { 0xCB, "RETRIEVE DATA" },
1294
  { 0xDB, "SET DATA" },
1295
  { 0x89, "RUN GSM ALGORITHM / AUTHENTICATE" },
1296
  { 0x84, "GET CHALLENGE" },
1297
  { 0xAA, "TERMINAL CAPABILITY" },
1298
  { 0x70, "MANAGE CHANNEL" },
1299
  { 0x73, "MANAGE SECURE CHANNEL" },
1300
  { 0x75, "TRANSACT DATA" },
1301
  { 0x76, "SUSPEND UICC" },
1302
  /* TS 102 221 v15.11.0 */
1303
  { 0x78, "GET IDENTITY" },
1304
  { 0x7A, "EXCHANGE CAPABILITIES" },
1305
  { 0x7C, "MANAGE LSI" },
1306
  /* GSMA SGP.02 v4.2 */
1307
  { 0xCA, "GET DATA" },
1308
  /* TS TS 102 222 */
1309
  { 0xE0, "CREATE FILE" },
1310
  { 0xE4, "DELETE FILE" },
1311
  { 0xE6, "TERMINATE DF" },
1312
  { 0xE8, "TERMINATE EF" },
1313
  { 0xFE, "TERMINATE CARD USAGE" },
1314
  /* GlobalPlatform Card Specification */
1315
  { 0xE2, "STORE DATA" },
1316
  { 0, NULL }
1317
};
1318
1319
/* Section 7.3.7 */
1320
1321
static const value_string search_ef_identifier_vals[] = {
1322
  { 0, "Currently selected EF" },
1323
  { 31, "Reserved for future use" },
1324
  { 0, NULL}
1325
};
1326
1327
static const value_string search_mode_vals[] = {
1328
  { 0x00, "Forward from first occurrence" },
1329
  { 0x01, "Backward from last occurrence" },
1330
  { 0x02, "Forward from next occurrence" },
1331
  { 0x03, "Backward from previous occurrence" },
1332
  { 0x04, "Forward from P1" },
1333
  { 0x05, "Backward from P1" },
1334
  { 0x06, "Enhanced search" },
1335
  { 0x07, "Proprietary search" },
1336
  { 0, NULL }
1337
};
1338
1339
static const value_string search_enhanced_type[] = {
1340
  { 0x00, "The subsequent byte is an offset (start from that position)" },
1341
  { 0x01, "The subsequent byte is a value (start after the first occurrence)" },
1342
  { 0, NULL }
1343
};
1344
1345
static const value_string search_enhanced_mode_vals[] = {
1346
  { 0x00, "Forward from first occurrence" },
1347
  { 0x01, "Backward from last occurrence" },
1348
  { 0x02, "Forward from next occurrence" },
1349
  { 0x03, "Backward from previous occurrence" },
1350
  { 0x04, "Forward from P1" },
1351
  { 0x05, "Backward from P1" },
1352
  { 0x06, "Forward from next record" },
1353
  { 0x07, "Backward from previous record" },
1354
  { 0, NULL }
1355
};
1356
1357
/* Section 10.7 */
1358
1359
1360
/* The FID space is not a global namespace, but a per-directory one. As such,
1361
 * we should have code that tracks the currently selected (sub-)directory, and
1362
 * decode the FID based on that knowledge.  As we don't do that yet, the
1363
 * current work-around is to simply merge all of them into one value_string
1364
 * array */
1365
1366
/* N.B. this combined value_string has lots of duplicate values... */
1367
1368
/* Files at the MF level */
1369
static const value_string mf_dfs[] = {
1370
  { 0x3f00, "MF" },
1371
  { 0x7f10, "DF.TELECOM" },
1372
  { 0x7f20, "DF.GSM" },
1373
  { 0x7f22, "DF.IS-41" },
1374
  { 0x7f23, "DF.FP-CTS" },
1375
  { 0x7f25, "DF.CDMA" },
1376
  { 0x7f31, "DF.iDEN" },
1377
  { 0x7f80, "DF.PDC" },
1378
  { 0x7f90, "DF.TETRA" },
1379
  { 0x7fff, "ADF" },
1380
#if 0
1381
  { 0, NULL }
1382
};
1383
static const value_string mf_efs[] = {
1384
#endif
1385
  { 0x2f00, "EF.DIR" },
1386
//  { 0x2f05, "EF.ELP" },
1387
  { 0x2f05, "EF.PL" },
1388
  { 0x2f06, "EF.ARR" },
1389
  { 0x2f08, "EF.UMPC" },
1390
  { 0x2fe2, "EF.ICCID" },
1391
#if 0
1392
  { 0, NULL }
1393
};
1394
1395
/* Elementary files at the DF.TELECOM level */
1396
static const value_string df_telecom_efs[] = {
1397
#endif
1398
  { 0x6f06, "EF.ARR" },
1399
  { 0x6f3a, "EF.ADN" },
1400
  { 0x6f3b, "EF.FDN" },
1401
  { 0x6f3c, "EF.SMS" },
1402
  { 0x6f3d, "EF.CCP" },
1403
  { 0x6f40, "EF.MSISDN" },
1404
  { 0x6f42, "EF.SMSP" },
1405
  { 0x6f43, "EF.SMSS" },
1406
  { 0x6f44, "EF.LND" },
1407
  { 0x6f47, "EF.SMSR" },
1408
  { 0x6f49, "EF.SDN" },
1409
  { 0x6f4a, "EF.EXT1" },
1410
  { 0x6f4b, "EF.EXT2" },
1411
  { 0x6f4c, "EF.EXT3" },
1412
  { 0x6f4d, "EF.BDN" },
1413
  { 0x6f4e, "EF.EXT4" },
1414
  { 0x6f4f, "EF.ECCP" },
1415
  { 0x6f54, "EF.SUME" },
1416
#if 0
1417
  { 0, NULL }
1418
};
1419
1420
/* Elementary Files at the DF.GSM level */
1421
static const value_string df_gsm_efs[] = {
1422
#endif
1423
  { 0x6f05, "EF.LP" },
1424
  { 0x6f07, "EF.IMSI" },
1425
  { 0x6f20, "EF.Kc" },
1426
  { 0x6f30, "EF.PLMNsel" },
1427
  { 0x6f31, "EF.HPPLMN" },
1428
  { 0x6f37, "EF.ACMax" },
1429
  { 0x6f38, "EF.SST" },
1430
  { 0x6f39, "EF.ACM" },
1431
  { 0x6f3e, "EF.GID1" },
1432
  { 0x6f3f, "EF.GID2" },
1433
  { 0x6f41, "EF.PUCT" },
1434
  { 0x6f45, "EF.CBMI" },
1435
  { 0x6f46, "EF.SPN" },
1436
  { 0x6f74, "EF.BCCH" },
1437
  { 0x6f78, "EF.ACC" },
1438
  { 0x6f7b, "EF.FPLMN" },
1439
  { 0x6f7e, "EF.LOCI" },
1440
  { 0x6fad, "EF.AD" },
1441
  { 0x6fae, "EF.PHASE" },
1442
  { 0x6fb1, "EF.VGCS" },
1443
  { 0x6fb2, "EF.VGCSS" },
1444
  { 0x6fb3, "EF.VBS" },
1445
  { 0x6fb4, "EF.VBSS" },
1446
  { 0x6fb5, "EF.eMLPP" },
1447
  { 0x6fb6, "EF.AAeM" },
1448
  { 0x6fb7, "EF.ECC" },
1449
  { 0x6f50, "EF.CBMIR" },
1450
  { 0x6f51, "EF.NIA" },
1451
  { 0x6f52, "EF.KcGPRS" },
1452
  { 0x6f53, "EF.LOCIGPRS" },
1453
  { 0x6f54, "EF.SUME" },
1454
  { 0x6f60, "EF.PLMNwAcT" },
1455
  { 0x6f61, "EF.OPLMNwAcT" },
1456
  { 0x6f62, "EF.HPLMNAcT" },
1457
  { 0x6f63, "EF.CPBCCH" },
1458
  { 0x6f64, "EF.INVSCAN" },
1459
#if 0
1460
  { 0, NULL }
1461
};
1462
1463
static const value_string df_gsm_dfs[] = {
1464
#endif
1465
  { 0x5f30, "DF.IRIDIUM" },
1466
  { 0x5f31, "DF.GLOBST" },
1467
  { 0x5f32, "DF.ICO" },
1468
  { 0x5f33, "DF.ACeS" },
1469
  { 0x5f3c, "DF.MExE" },
1470
  { 0x5f40, "DF.EIA/TIA-533/DF.WLAN" },
1471
  { 0x5f60, "DF.CTS" },
1472
  { 0x5f70, "DF.SoLSA" },
1473
#if 0
1474
  { 0, NULL }
1475
};
1476
1477
static const value_string adf_usim_dfs[] = {
1478
#endif
1479
  { 0x5f3a, "DF.PHONEBOOK" },
1480
  { 0x5f3b, "DF.GSM-ACCESS" },
1481
//  { 0x5f3c, "DF.MexE" },
1482
//  { 0x5f70, "DF.SoLSA" },
1483
//  { 0x5f40, "DF.WLAN" },
1484
  { 0x5f50, "DF.HNB" },
1485
  { 0x5f90, "DF.ProSe" },
1486
  { 0x5fa0, "DF.ACDC" },
1487
  { 0x5fb0, "DF.TV" },
1488
  { 0x5fc0, "DF.5GS" },
1489
#if 0
1490
  { 0, NULL }
1491
};
1492
1493
static const value_string adf_usim_efs[] = {
1494
#endif
1495
  { 0x6f00, "EF.5GAuthKeys" },
1496
  { 0x6f01, "EF.5GS3GPPAccessNASSecCtxt" },
1497
  { 0x6f02, "EF.5GSnon3GPPAccessNASSecCtxt" },
1498
  { 0x6f03, "EF.SCICI" },
1499
  { 0x6f04, "EF.UACAccessIdConfig" },
1500
  { 0x6f06, "EF.ARR" },
1501
  { 0x6f07, "EF.IMSI" },
1502
  { 0x6f08, "EF.Keys" },
1503
  { 0x6f09, "EF.KeysPS" },
1504
  { 0x6f2c, "EF.DCK" },
1505
  { 0x6f31, "EF.HPPLMN" },
1506
  { 0x6f32, "EF.CNL" },
1507
  { 0x6f37, "EF.ACMax" },
1508
  { 0x6f39, "EF.ACM" },
1509
  { 0x6f3b, "EF.FDN" },
1510
  { 0x6f3c, "EF.SMS" },
1511
  { 0x6f3e, "EF.GID1" },
1512
  { 0x6f3f, "EF.GID2" },
1513
  { 0x6f40, "EF.MSISDN" },
1514
  { 0x6f42, "EF.SMSP" },
1515
  { 0x6f43, "EF.SMSS" },
1516
  { 0x6f45, "EF.CBMI" },
1517
  { 0x6f46, "EF.SPN" },
1518
  { 0x6f47, "EF.SMSR" },
1519
  { 0x6f48, "EF.CBMID" },
1520
  { 0x6f4b, "EF.EXT2" },
1521
  { 0x6f4c, "EF.EXT3" },
1522
  { 0x6f4d, "EF.BDN" },
1523
  { 0x6f50, "EF.CBMIR" },
1524
  { 0x6f55, "EF.EXT4" },
1525
  { 0x6f56, "EF.EST" },
1526
  { 0x6f57, "EF.ACL" },
1527
  { 0x6f58, "EF.CMI" },
1528
  { 0x6f5b, "EF.START-HFN" },
1529
  { 0x6f5c, "EF.THRESHOLD" },
1530
  { 0x6f60, "EF.PLMNwAcT" },
1531
  { 0x6f61, "EF.OPLMNwAcT" },
1532
  { 0x6f62, "EF.HPLMNAcT" },
1533
  { 0x6f73, "EF.PSLOCI" },
1534
  { 0x6f78, "EF.ACC" },
1535
  { 0x6f7b, "EF.FPLMN" },
1536
  { 0x6f7e, "EF.LOCI" },
1537
  { 0x6f80, "EF.ICI" },
1538
  { 0x6f81, "EF.OCI" },
1539
  { 0x6f82, "EF.ICT" },
1540
  { 0x6f83, "EF.OCT" },
1541
  { 0x6fad, "EF.AD" },
1542
  { 0x6fb1, "EF.VGCS" },
1543
  { 0x6fb2, "EF.VGCSS" },
1544
  { 0x6fb3, "EF.VBS" },
1545
  { 0x6fb4, "EF.VBSS" },
1546
  { 0x6fb5, "EF.eMLPP" },
1547
  { 0x6fb6, "EF.AAeM" },
1548
  { 0x6fb7, "EF.ECC" },
1549
  { 0x6fc3, "EF.Hiddenkey" },
1550
  { 0x6fc4, "EF.NETPAR" },
1551
  { 0x6fc5, "EF.PNN" },
1552
  { 0x6fc6, "EF.OPL" },
1553
  { 0x6fc7, "EF.MBDN" },
1554
  { 0x6fc8, "EF.EXT6" },
1555
  { 0x6fc9, "EF.MBI" },
1556
  { 0x6fca, "EF.MWIS" },
1557
  { 0x6fcb, "EF.CFIS" },
1558
  { 0x6fcc, "EF.EXT7" },
1559
  { 0x6fcd, "EF.SPDI" },
1560
  { 0x6fce, "EF.MMSN" },
1561
  { 0x6fcf, "EF.EXT8" },
1562
  { 0x6fd0, "EF.MMSICP" },
1563
  { 0x6fd1, "EF.MMSUP" },
1564
  { 0x6fd2, "EF.MMSUCP" },
1565
  { 0x6fd3, "EF.NIA" },
1566
  { 0x6fd4, "EF.VGCSCA" },
1567
  { 0x6fd5, "EF.VBSCA" },
1568
  { 0x6fd6, "EF.GBAP" },
1569
  { 0x6fd7, "EF.MSK" },
1570
  { 0x6fd8, "EF.MUK" },
1571
  { 0x6fd9, "EF.EHPLMN" },
1572
  { 0x6fda, "EF.GBANL" },
1573
  { 0x6fdb, "EF.EHPLMNPI" },
1574
  { 0x6fdc, "EF.LRPLMNSI" },
1575
  { 0x6fdd, "EF.NAFKCA" },
1576
  { 0x6fde, "EF.SPNI" },
1577
  { 0x6fdf, "EF.PNNI" },
1578
  { 0x6fe2, "EF.NCP-IP" },
1579
  { 0x6fe3, "EF.EPSLOCI" },
1580
  { 0x6fe4, "EF.EPSNSC" },
1581
  { 0x6fe6, "EF.UFC" },
1582
  { 0x6fe7, "EF.UICCIARI" },
1583
  { 0x6fec, "EF.PWS" },
1584
  { 0x6fed, "EF.FDNURI" },
1585
  { 0x6fee, "EF.BDNURI" },
1586
  { 0x6fef, "EF.SDNURI" },
1587
  { 0x6ff0, "EF.IWL" },
1588
  { 0x6ff1, "EF.IPS" },
1589
  { 0x6ff2, "EF.IPD" },
1590
  { 0x6ff3, "EF.ePDGId" },
1591
  { 0x6ff4, "EF.ePDGSelection" },
1592
  { 0x6ff5, "EF.ePDGIdEm" },
1593
  { 0x6ff6, "EF.ePDGSelection" },
1594
  { 0x6ff7, "EF.FromPreferred" },
1595
  { 0x6ff9, "EF.3GPPPSDATAOFF" },
1596
  { 0x6ffa, "EF.3GPPPSDATAOFFservicelist" },
1597
  { 0x6ffb, "EF.TVCONFIG" },
1598
  { 0x6ffc, "EF.XCAPConfigData" },
1599
  { 0x6ffd, "EF.EARFCNList" },
1600
  { 0x6ffe, "EF.5GS3GPPLocationInformation" },
1601
  { 0x6fff, "EF.5GSnon3GPPLocationInformation" },
1602
#if 0
1603
  { 0, NULL }
1604
};
1605
1606
static const value_string adf_5gs_efs[] = {
1607
#endif
1608
  { 0x4f01, "EF.5GS3GPPLOCI" },
1609
  { 0x4f02, "EF.5GSN3GPPLOCI" },
1610
  { 0x4f03, "EF.5GS3GPPNSC" },
1611
  { 0x4f04, "EF.5GSN3GPPNSC" },
1612
  { 0x4f05, "EF.5GAUTHKEYS" },
1613
  { 0x4f06, "EF.UAC_AIC" },
1614
  { 0x4f07, "EF.SUCI_Calc_Info" },
1615
  { 0x4f08, "EF.OPL5G" },
1616
  { 0x4f09, "EF.EFSUPI_NAI/EF.PBC" },
1617
  { 0x4f0a, "EF.Routing_Indicator/EF.PBC1" },
1618
  { 0x4f0b, "EF.URSP" },
1619
  { 0x4f0c, "EF.TN3GPPSNN" },
1620
#if 0
1621
  { 0, NULL }
1622
};
1623
1624
static const value_string df_phonebook_efs[] = {
1625
#endif
1626
//  { 0x4f09, "EF.PBC" },
1627
//  { 0x4f0a, "EF.PBC1" },
1628
  { 0x4f11, "EF.ANRA" },
1629
  { 0x4f12, "EF.ANRA1" },
1630
  { 0x4f13, "EF.ANRB" },
1631
  { 0x4f14, "EF.ANRB1" },
1632
  { 0x4f15, "EF.ANRC" },
1633
  { 0x4f16, "EF.ANRC1" },
1634
  { 0x4f19, "EF.SNE" },
1635
  { 0x4f1a, "EF.SNE1" },
1636
  { 0x4f20, "EF.UID1" },
1637
  { 0x4f21, "EF.UID" },
1638
  { 0x4f22, "EF.FSC" },
1639
  { 0x4f23, "EF.CC" },
1640
  { 0x4f24, "EF.PUID" },
1641
  { 0x4f25, "EF.GRP1" },
1642
  { 0x4f26, "EF.GRP" },
1643
  { 0x4f30, "EF.PBR" },
1644
  { 0x4f3a, "EF.ADN" },
1645
  { 0x4f3b, "EF.ADN1" },
1646
  { 0x4f4a, "EF.EXT1" },
1647
  { 0x4f4b, "EF.AAS" },
1648
  { 0x4f4c, "EF.GAS" },
1649
  { 0x4f50, "EF.EMAIL" },
1650
  { 0x4f51, "EF.EMAIL1" },
1651
  { 0, NULL }
1652
};
1653
1654
/* Section 9.4 of TS 11.11 */
1655
static const value_string sw_vals[] = {
1656
  /* we only list the non-wildcard commands here */
1657
  { 0x9000, "Normal ending of the command" },
1658
  { 0x9300, "SIM Application Toolkit is busy" },
1659
  { 0x9240, "Memory problem" },
1660
  { 0x9400, "No EF selected" },
1661
  { 0x9402, "Out of range (invalid address)" },
1662
  { 0x9404, "File ID not found" },
1663
  { 0x9408, "File is inconsistent with the command" },
1664
  { 0x9802, "No CHV initialized" },
1665
  { 0x9804, "Access condition not fulfilled / authentication failed" },
1666
  { 0x9808, "In contradiction with CHV status" },
1667
  { 0x9810, "In contradiction with invalidation status" },
1668
  { 0x9840, "Unsuccessful CHV verification, no attempt left / CHV blocked" },
1669
  { 0x9850, "Application errors: Increase cannot be performed, max value reached" },
1670
  { 0x6b00, "Incorrect parameter P1 or P2" },
1671
  /* Section 10.2.1.3 of TS 102 221 */
1672
  { 0x6200, "Warning: No information given, state of volatile memory unchanged" },
1673
  { 0x6281, "Warning: Part of returned data may be corrupted" },
1674
  { 0x6282, "Warning: End of file/record reached before reading Le bytes" },
1675
  { 0x6283, "Warning: Selected file invalidated" },
1676
  { 0x6285, "Warning: Selected file in termination state" },
1677
  { 0x62f1, "Warning: More data available" },
1678
  { 0x62f2, "Warning: More data available and proactive command pending" },
1679
  { 0x62f3, "Warning: Response data available" },
1680
  { 0x63f1, "Warning: More data expected" },
1681
  { 0x63f2, "Warning: More data expected and proactive command pending" },
1682
  /* Section 10.2.1.4 of TS 102 221 */
1683
  { 0x6400, "Execution error: No information given, memory unchanged" },
1684
  { 0x6500, "Execution error: No information given, memory changed" },
1685
  { 0x6581, "Execution error: Memory problem" },
1686
  /* Section 10.2.1.5 of TS 102 221 */
1687
  { 0x6700, "Wrong length" },
1688
  { 0x6d00, "Instruction code not supported or invalid" },
1689
  { 0x6e00, "Class not supported" },
1690
  { 0x6f00, "Technical problem, no precise diagnosis" },
1691
  /* Section 10.2.1.5.1 of TS 102 221 */
1692
  { 0x6800, "Function in CLA not supported" },
1693
  { 0x6881, "Function in CLA not supported: Logical channel not supported" },
1694
  { 0x6882, "Function in CLA not supported: Secure messaging not supported" },
1695
  /* Section 10.2.1.5.2 of TS 102 221 */
1696
  { 0x6900, "Command not allowed" },
1697
  { 0x6981, "Command not allowed: Command incompatible with file structure" },
1698
  { 0x6982, "Command not allowed: Security status not satisfied" },
1699
  { 0x6983, "Command not allowed: Authentication/PIN method blocked" },
1700
  { 0x6984, "Command not allowed: Referenced data invalid" },
1701
  { 0x6985, "Command not allowed: Conditions of use not satisfied" },
1702
  { 0x6986, "Command not allowed: No EF selected" },
1703
  { 0x6989, "Command not allowed: Secure channel - security not satisfied" },
1704
  /* Section 10.2.1.5.3 of TS 102 221 */
1705
  { 0x6a80, "Wrong parameters: Incorrect parameters in the data field" },
1706
  { 0x6a81, "Wrong parameters: Function not supported" },
1707
  { 0x6a82, "Wrong parameters: File not found" },
1708
  { 0x6a83, "Wrong parameters: Record not found" },
1709
  { 0x6a84, "Wrong parameters: Not enough memory space" },
1710
  { 0x6a86, "Wrong parameters: Incorrect P1 to P2" },
1711
  { 0x6a87, "Wrong parameters: Lc inconsistent with P1 to P2" },
1712
  { 0x6a88, "Wrong parameters: Referenced data not found" },
1713
  /* Section 10.2.1.6 of TS 102 221 */
1714
  { 0x9862, "Application errors: Authentication error, application specific" },
1715
  { 0x9863, "Application errors: Security session or association expired" },
1716
  { 0x9864, "Application errors: Minimum UICC suspension time is too long" },
1717
  { 0, NULL }
1718
};
1719
1720
static const value_string select_type_vals[] = {
1721
  { 0x00, "Select DF, EF or MF by file id" },
1722
  { 0x01, "Select child DF of the current DF" },
1723
  { 0x03, "Select parent DF of the current DF" },
1724
  { 0x04, "Selection by DF name (selection by AID)" },
1725
  { 0x08, "Select by path from MF" },
1726
  { 0x09, "Select by path from current DF" },
1727
  { 0, NULL }
1728
};
1729
1730
static const value_string select_session_control_vals[] = {
1731
  { 0x00, "Activation / Reset" },
1732
  { 0x01, "Reserved / Force Reset" },
1733
  { 0x02, "Termination" },
1734
  { 0x03, "RFU" },
1735
  { 0, NULL }
1736
};
1737
1738
static const value_string select_return_data_vals[] = {
1739
  { 0x01, "Response FCP template" },
1740
  { 0x03, "No data returned" },
1741
  { 0, NULL }
1742
};
1743
1744
static const value_string select_selection_vals[] = {
1745
  { 0x00, "First or only occurrence" },
1746
  { 0x01, "Last occurrence" },
1747
  { 0x02, "Next occurrence" },
1748
  { 0x03, "Previous occurrence" },
1749
  { 0, NULL }
1750
};
1751
1752
static const value_string status_application_status_vals[] = {
1753
  { 0x00, "No indication" },
1754
  { 0x01, "Current application is initialized in the terminal" },
1755
  { 0x02, "The terminal will initiate the termination of the current application" },
1756
  { 0, NULL }
1757
};
1758
1759
static const value_string status_return_data_vals[] = {
1760
  { 0x00, "Response parameters and data are identical to the response parameters and data of the SELECT command" },
1761
  { 0x01, "The DF name TLV-object of the currently selected application is returned" },
1762
  { 0x0C, "No data returned" },
1763
  { 0, NULL }
1764
};
1765
1766
static const value_string record_file_vals[] = {
1767
  { 0, "Currently selected EF" },
1768
  { 0, NULL}
1769
};
1770
1771
static const value_string record_mode_vals[] = {
1772
  { 0x02, "Next record" },
1773
  { 0x03, "Previous record" },
1774
  { 0x04, "Absolute/current mode, the record number is given in P1 with P1='00' denoting the current record" },
1775
  { 0, NULL }
1776
};
1777
1778
static const true_false_string store_data_iso_case_tfs = {
1779
  "ISO case 4 command (response data may be returned)",
1780
  "ISO case 3 command (no response data expected)"
1781
};
1782
1783
static const value_string store_data_structure_vals[] = {
1784
  { 0x00, "No general data structure information" },
1785
  { 0x01, "DGI format of the command data field" },
1786
  { 0x02, "BER-TLV format of the command data field" },
1787
  { 0x03, "RFU" },
1788
  { 0, NULL }
1789
};
1790
1791
static const value_string store_data_encryption_vals[] = {
1792
  { 0x00, "No general encryption information or non-encrypted data" },
1793
  { 0x01, "Application dependent encryption of the data" },
1794
  { 0x02, "RFU" },
1795
  { 0x03, "Encrypted data" },
1796
  { 0, NULL }
1797
};
1798
1799
static const true_false_string store_data_block_tfs = {
1800
  "Last block",
1801
  "More blocks"
1802
};
1803
1804
static const char *get_sw_string(wmem_allocator_t *scope, uint16_t sw)
1805
0
{
1806
0
  uint8_t sw1 = sw >> 8;
1807
0
  uint8_t sw2 = sw & 0xFF;
1808
1809
0
  switch (sw1) {
1810
0
  case 0x91:
1811
0
    return "Normal ending of command with info from proactive SIM";
1812
0
  case 0x9e:
1813
0
    return "Length of the response data given / SIM data download error";
1814
0
  case 0x9f:
1815
0
    return wmem_strdup_printf(scope, "Length of the response data, Length is %u", sw2 ? sw2 : 256);
1816
0
  case 0x92:
1817
0
    if ((sw & 0xf0) == 0x00)
1818
0
      return "Command successful but after internal retry routine";
1819
0
    break;
1820
0
  case 0x61:
1821
0
    return wmem_strdup_printf(scope, "Response ready, Response length is %u", sw2 ? sw2 : 256);
1822
0
  case 0x67:
1823
0
    if (sw2 == 0x00)
1824
0
      return "Wrong length"; /* TS 102.221 / Section 10.2.1.5 */
1825
0
    else
1826
0
      return "Incorrect parameter P3"; /* TS 51.011 / Section 9.4.6 */
1827
0
  case 0x6c:
1828
0
    return wmem_strdup_printf(scope, "Terminal should repeat command, Length for repeated command is %u", sw2 ? sw2 : 256);
1829
0
  case 0x6d:
1830
0
    return "Unknown instruction code";
1831
0
  case 0x6e:
1832
0
    return "Wrong instruction class";
1833
0
  case 0x6f:
1834
0
    return "Technical problem with no diagnostic";
1835
0
  }
1836
0
  return val_to_str(scope, sw, sw_vals, "Unknown status word: %04x");
1837
0
}
1838
1839
/* Parse BER-TLV tag */
1840
static int
1841
get_ber_tlv_tag(tvbuff_t *tvb, int offset, uint32_t *tag, uint8_t *tag_size)
1842
0
{
1843
0
  *tag = tvb_get_uint8(tvb, offset++);
1844
0
  *tag_size = 1;
1845
1846
0
  if ((*tag & 0x1F) == 0x1F) {
1847
    /* Extended tag */
1848
0
    *tag = 0;
1849
0
    while (tvb_reported_length_remaining(tvb, offset) > 0) {
1850
0
      uint8_t tag_byte = tvb_get_uint8(tvb, offset++);
1851
0
      *tag = (*tag << 7) | (tag_byte & 0x7F);
1852
0
      (*tag_size)++;
1853
1854
0
      if ((tag_byte & 0x80) == 0) {
1855
0
        break; /* Last tag byte */
1856
0
      }
1857
0
    }
1858
0
  }
1859
1860
0
  return offset;
1861
0
}
1862
1863
/* Parse BER-TLV length */
1864
static int
1865
get_ber_tlv_len(tvbuff_t *tvb, int offset, uint32_t *len, uint8_t *len_size)
1866
0
{
1867
0
  *len = tvb_get_uint8(tvb, offset++);
1868
0
  *len_size = 1;
1869
1870
0
  if (*len & 0x80) {
1871
0
    int n = *len & 0x7F;
1872
0
    if (n > 4)
1873
0
      n = 4;
1874
0
    *len = 0;
1875
0
    while (n--) {
1876
0
      *len = (*len << 8) | tvb_get_uint8(tvb, offset++);
1877
0
      (*len_size)++;
1878
0
    }
1879
0
  }
1880
1881
0
  return offset;
1882
0
}
1883
1884
static void
1885
power_consumption_frequency_cf(char *result, uint32_t frequency)
1886
0
{
1887
0
  if (frequency == 0xFF) {
1888
0
    snprintf(result, ITEM_LABEL_LENGTH, "No frequency");
1889
0
  } else {
1890
0
    double freq_mhz = frequency * 0.1;
1891
0
    snprintf(result, ITEM_LABEL_LENGTH, "%.1f MHz", freq_mhz);
1892
0
  }
1893
0
}
1894
1895
/* Dissect FCP proprietary information */
1896
static int
1897
dissect_fcp_proprietary_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
1898
0
{
1899
0
  proto_item *prop_ti;
1900
0
  proto_tree *prop_tree;
1901
0
  uint32_t tag, len;
1902
0
  uint8_t tag_size, len_size;
1903
0
  bool clock_stop_allowed;
1904
1905
0
  int start_offset;
1906
0
  int end_offset = offset + length;
1907
1908
0
  while (offset < end_offset) {
1909
0
    start_offset = offset;
1910
1911
0
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
1912
0
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
1913
1914
0
    prop_ti = proto_tree_add_bytes_format(tree, hf_fcp_prop, tvb, start_offset,
1915
0
        tag_size + len_size + len, NULL, "%s%s%s",
1916
0
        val_to_str(pinfo->pool, tag, fcp_prop_tag_vals, "Unknown tag '%02x'"),
1917
0
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
1918
0
    prop_tree = proto_item_add_subtree(prop_ti, ett_fcp_proprietary);
1919
1920
0
    proto_tree_add_item(prop_tree, hf_fcp_prop_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
1921
0
    proto_tree_add_uint(prop_tree, hf_fcp_prop_len, tvb, start_offset + tag_size, len_size, len);
1922
1923
0
    if (len == 0) {
1924
      /* No value field */
1925
0
      continue;
1926
0
    }
1927
1928
0
    switch (tag) {
1929
0
    case 0x80: /* UICC characteristics */
1930
0
      proto_tree_add_item_ret_boolean(prop_tree, hf_fcp_prop_uicc_clock_stop_allowed, tvb, offset, 1, ENC_NA, &clock_stop_allowed);
1931
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_rfu, tvb, offset, 1, ENC_NA);
1932
0
      if (clock_stop_allowed) {
1933
0
        proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_1, tvb, offset, 1, ENC_NA);
1934
0
      } else {
1935
0
        proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_clock_stop_0, tvb, offset, 1, ENC_NA);
1936
0
      }
1937
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_a, tvb, offset, 1, ENC_NA);
1938
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_b, tvb, offset, 1, ENC_NA);
1939
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_c, tvb, offset, 1, ENC_NA);
1940
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_supply_voltage_d, tvb, offset, 1, ENC_NA);
1941
0
      break;
1942
0
    case 0x81: /* Application power consumption */
1943
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_supply_voltage_class, tvb, offset, 1, ENC_NA);
1944
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_power_consumption, tvb, offset+1, 1, ENC_NA);
1945
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_app_frequency, tvb, offset+2, 1, ENC_NA);
1946
0
      break;
1947
0
    case 0x82: /* Minimum application clock frequency */
1948
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_min_app_clock_freq, tvb, offset, 1, ENC_NA);
1949
0
      break;
1950
0
    case 0x83: /* Amount of available memory */
1951
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_avail_memory, tvb, offset, len, ENC_BIG_ENDIAN);
1952
0
      break;
1953
0
    case 0x84: /* File details */
1954
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_file_details_der_encoding, tvb, offset, 1, ENC_NA);
1955
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_file_details_rfu, tvb, offset, 1, ENC_NA);
1956
0
      break;
1957
0
    case 0x85: /* Reserved file size */
1958
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_reserved_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
1959
0
      break;
1960
0
    case 0x86: /* Maximum file size */
1961
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_max_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
1962
0
      break;
1963
0
    case 0x87: /* Supported system commands */
1964
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_supported_sys_cmds_terminal_capability, tvb, offset, 1, ENC_NA);
1965
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_supported_sys_cmds_rfu, tvb, offset, 1, ENC_NA);
1966
0
      break;
1967
0
    case 0x88: /* Specific UICC environmental conditions */
1968
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_temp_class, tvb, offset, 1, ENC_NA);
1969
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_high_humidity, tvb, offset, 1, ENC_NA);
1970
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_uicc_env_conditions_rfu, tvb, offset, 1, ENC_NA);
1971
0
      break;
1972
0
    case 0x89: /* Platform to Platform CAT Secured APDU */
1973
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_platform_to_platform_cat_secured_apdu, tvb, offset, len, ENC_NA);
1974
0
      break;
1975
0
    case 0x8A: /* Test configuration state */
1976
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_test_config_state, tvb, offset, len, ENC_NA);
1977
0
      break;
1978
0
    case 0x8B: /* Test configuration criterion type */
1979
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_test_config_criterion_type, tvb, offset, len, ENC_NA);
1980
0
      break;
1981
0
    default:
1982
      /* Unknown proprietary tag */
1983
0
      proto_tree_add_item(prop_tree, hf_fcp_prop_value, tvb, offset, len, ENC_NA);
1984
0
      break;
1985
0
    }
1986
1987
0
    offset += len;
1988
0
  }
1989
1990
0
  return offset;
1991
0
}
1992
1993
static void
1994
set_rsp_type(packet_info *pinfo, rsp_type_t rsp_type)
1995
0
{
1996
0
  if (!PINFO_FD_VISITED(pinfo)) {
1997
0
    wmem_tree_insert32(rsp_types, pinfo->num, GUINT_TO_POINTER(rsp_type));
1998
0
  }
1999
0
}
2000
2001
/* Dissect FCP (File Control Parameters) template as defined in ETSI TS 102.221 */
2002
static int
2003
dissect_fcp_template(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
2004
0
{
2005
0
  proto_item *value_ti;
2006
0
  proto_tree *value_tree;
2007
0
  tvbuff_t *subtvb;
2008
0
  uint32_t tag, len;
2009
0
  uint8_t tag_size, len_size;
2010
0
  uint8_t byte;
2011
0
  rsp_type_t rsp_type = RSP_TYPE_UNKNOWN;
2012
2013
0
  int start_offset = offset;
2014
0
  int end_offset = offset + length;
2015
2016
0
  offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2017
  /* Check for FCP and FCI template tags */
2018
0
  if (tag != 0x62 && tag != 0x6F) {
2019
0
    return 0;
2020
0
  }
2021
0
  offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2022
2023
0
  proto_tree_add_item(tree, hf_template_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2024
0
  proto_tree_add_uint(tree, hf_template_len, tvb, start_offset + tag_size, len_size, len);
2025
2026
0
  while (offset < end_offset) {
2027
0
    start_offset = offset;
2028
2029
0
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2030
0
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2031
2032
0
    value_ti = proto_tree_add_bytes_format(tree, hf_fcp, tvb, start_offset,
2033
0
        tag_size + len_size + len, NULL, "%s%s%s",
2034
0
        val_to_str(pinfo->pool, tag, fcp_tag_vals, "Unknown tag '%02x'"),
2035
0
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
2036
0
    value_tree = proto_item_add_subtree(value_ti, ett_fcp);
2037
2038
0
    proto_tree_add_item(value_tree, hf_fcp_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2039
0
    proto_tree_add_uint(value_tree, hf_fcp_len, tvb, start_offset + tag_size, len_size, len);
2040
2041
0
    if (len == 0) {
2042
      /* No value field */
2043
0
      continue;
2044
0
    }
2045
2046
0
    switch (tag) {
2047
0
    case 0x80: /* File size */
2048
0
      proto_tree_add_item(value_tree, hf_fcp_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
2049
0
      break;
2050
0
    case 0x81: /* Total file size */
2051
0
      proto_tree_add_item(value_tree, hf_fcp_total_file_size, tvb, offset, len, ENC_BIG_ENDIAN);
2052
0
      break;
2053
0
    case 0x82: /* File Descriptor */
2054
0
      byte = tvb_get_uint8(tvb, offset);
2055
0
      if (byte & 0x80) {
2056
0
        proto_tree_add_item(value_tree, hf_fcp_file_rfu_byte, tvb, offset, 1, ENC_NA);
2057
0
      } else {
2058
0
        proto_tree_add_item(value_tree, hf_fcp_file_rfu, tvb, offset, 1, ENC_NA);
2059
0
        proto_tree_add_item(value_tree, hf_fcp_file_accessibility, tvb, offset, 1, ENC_NA);
2060
0
        if ((byte & 0x3F) == 0x38) { /* DF or ADF */
2061
0
          proto_tree_add_item(value_tree, hf_fcp_file_type_ext, tvb, offset, 1, ENC_NA);
2062
0
        } else if ((byte & 0x3F) == 0x39) { /* BER-TLV structure */
2063
0
          proto_tree_add_item(value_tree, hf_fcp_ef_structure_ext, tvb, offset, 1, ENC_NA);
2064
0
        } else {
2065
0
          proto_tree_add_item(value_tree, hf_fcp_file_type, tvb, offset, 1, ENC_NA);
2066
0
          proto_tree_add_item(value_tree, hf_fcp_ef_structure, tvb, offset, 1, ENC_NA);
2067
0
        }
2068
0
      }
2069
0
      if (len >= 2) {
2070
0
        proto_tree_add_item(value_tree, hf_fcp_data_coding_byte, tvb, offset + 1, 1, ENC_NA);
2071
0
      }
2072
0
      if (len >= 5) {
2073
0
        proto_tree_add_item(value_tree, hf_fcp_record_len, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
2074
0
        proto_tree_add_item(value_tree, hf_fcp_num_records, tvb, offset + 4, 1, ENC_NA);
2075
0
      }
2076
0
      break;
2077
0
    case 0x83: /* File Identifier */
2078
0
      proto_tree_add_item(value_tree, hf_fcp_file_id, tvb, offset, len, ENC_BIG_ENDIAN);
2079
0
      break;
2080
0
    case 0x84: /* DF name (AID) */
2081
0
      proto_tree_add_item(value_tree, hf_fcp_df_name, tvb, offset, len, ENC_NA);
2082
0
      break;
2083
0
    case 0x88: /* Short File Identifier (SFI) */
2084
0
      proto_tree_add_item(value_tree, hf_fcp_sfi, tvb, offset, len, ENC_NA);
2085
0
      break;
2086
0
    case 0x8A: /* Life Cycle Status Integer */
2087
0
      proto_tree_add_item(value_tree, hf_fcp_lifecycle_status, tvb, offset, len, ENC_NA);
2088
0
      break;
2089
0
    case 0x8B: /* Security attributes (referenced to expanded format) */
2090
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_referenced, tvb, offset, len, ENC_NA);
2091
0
      break;
2092
0
    case 0x8C: /* Security attributes (compact format) */
2093
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_compact, tvb, offset, len, ENC_NA);
2094
0
      break;
2095
0
    case 0xA5: /* Proprietary information */
2096
0
      dissect_fcp_proprietary_info(tvb, pinfo, value_tree, offset, len);
2097
0
      break;
2098
0
    case 0xAB: /* Security attributes (expanded format) */
2099
0
      proto_tree_add_item(value_tree, hf_fcp_security_attr_expanded, tvb, offset, len, ENC_NA);
2100
0
      break;
2101
0
    case 0xC6: /* PIN Status Template DO */
2102
0
      proto_tree_add_item(value_tree, hf_fcp_pin_status_do, tvb, offset, len, ENC_NA);
2103
0
      break;
2104
0
    case 0xE0: /* ISDRProprietaryApplicationTemplate (SGP.22) */
2105
0
      subtvb = tvb_new_subset_length(tvb, start_offset, tag_size + len_size + len);
2106
0
      dissect_sgp22_ISDRProprietaryApplicationTemplate_PDU(subtvb, pinfo, value_tree, NULL);
2107
0
      rsp_type = RSP_TYPE_SGP22;
2108
0
      break;
2109
0
    case 0xE1: /* ISDRProprietaryApplicationTemplateIoT (SGP.32) */
2110
0
      subtvb = tvb_new_subset_length(tvb, start_offset, tag_size + len_size + len);
2111
0
      dissect_sgp32_ISDRProprietaryApplicationTemplateIoT_PDU(subtvb, pinfo, value_tree, NULL);
2112
0
      rsp_type = RSP_TYPE_SGP32;
2113
0
      break;
2114
0
    default:
2115
      /* Unknown tag */
2116
0
      proto_tree_add_item(value_tree, hf_fcp_value, tvb, offset, len, ENC_NA);
2117
0
      break;
2118
0
    }
2119
2120
0
    offset += len;
2121
0
  }
2122
2123
0
  if (rsp_type != RSP_TYPE_UNKNOWN) {
2124
0
    set_rsp_type(pinfo, rsp_type);
2125
0
  }
2126
2127
0
  return offset;
2128
0
}
2129
2130
/* Dissect SGP.22 or SGP.32 ES10 messages, depending on the eUICC type. */
2131
static void
2132
dissect_rsp_store_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, bool is_response)
2133
0
{
2134
0
  rsp_type_t rsp_type = (rsp_type_t)GPOINTER_TO_UINT(wmem_tree_lookup32_le(rsp_types, pinfo->num));
2135
0
  bool is_sgp22 = is_response ? is_sgp22_response(tvb) : is_sgp22_request(tvb);
2136
0
  bool is_sgp32 = is_response ? is_sgp32_response(tvb) : is_sgp32_request(tvb);
2137
2138
0
  if (is_sgp22 && is_sgp32) {
2139
    /* Message redefined in SGP.32 */
2140
0
    if (pref_rsp_type != RSP_TYPE_UNKNOWN) {
2141
0
      rsp_type = (rsp_type_t)pref_rsp_type;
2142
0
    }
2143
2144
    /* Use SGP.32 if the eUICC type is unknown, as it extends the SGP.22 messages. */
2145
0
    is_sgp22 = (rsp_type == RSP_TYPE_SGP22);
2146
0
    is_sgp32 = !is_sgp22;
2147
0
  } else if (is_sgp32 && rsp_type == RSP_TYPE_UNKNOWN) {
2148
    /* Message only defined in SGP.32 */
2149
0
    set_rsp_type(pinfo, RSP_TYPE_SGP32);
2150
0
  }
2151
2152
0
  if (is_sgp32) {
2153
0
    if (is_response) {
2154
0
      dissect_sgp32_response(tvb, pinfo, tree, NULL);
2155
0
    } else {
2156
0
      dissect_sgp32_request(tvb, pinfo, tree, NULL);
2157
0
    }
2158
0
  } else if (is_sgp22) {
2159
0
    if (is_response) {
2160
0
      dissect_sgp22_response(tvb, pinfo, tree, NULL);
2161
0
    } else {
2162
0
      dissect_sgp22_request(tvb, pinfo, tree, NULL);
2163
0
    }
2164
0
  }
2165
0
}
2166
2167
static int
2168
dissect_terminal_capability(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int length)
2169
0
{
2170
0
  proto_item *value_ti;
2171
0
  proto_tree *value_tree;
2172
0
  uint32_t tag, len;
2173
0
  uint8_t tag_size, len_size;
2174
2175
0
  int start_offset = offset;
2176
0
  int end_offset = offset + length;
2177
2178
0
  offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2179
0
  if (tag != 0xA9) {
2180
0
    return 0;
2181
0
  }
2182
0
  offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2183
2184
0
  proto_tree_add_item(tree, hf_template_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2185
0
  proto_tree_add_uint(tree, hf_template_len, tvb, start_offset + tag_size, len_size, len);
2186
2187
0
  while (offset < end_offset) {
2188
0
    start_offset = offset;
2189
2190
0
    offset = get_ber_tlv_tag(tvb, offset, &tag, &tag_size);
2191
0
    offset = get_ber_tlv_len(tvb, offset, &len, &len_size);
2192
2193
0
    value_ti = proto_tree_add_bytes_format(tree, hf_tc, tvb, start_offset,
2194
0
        tag_size + len_size + len, NULL, "%s%s%s",
2195
0
        val_to_str(pinfo->pool, tag, terminal_capability_tag_vals, "Unknown tag '%02x'"),
2196
0
        (len ? ": " : ""), tvb_bytes_to_str(pinfo->pool, tvb, offset, len));
2197
0
    value_tree = proto_item_add_subtree(value_ti, ett_terminal_capability);
2198
2199
0
    proto_tree_add_item(value_tree, hf_tc_tag, tvb, start_offset, tag_size, ENC_BIG_ENDIAN);
2200
0
    proto_tree_add_uint(value_tree, hf_tc_len, tvb, start_offset + tag_size, len_size, len);
2201
2202
0
    if (len == 0) {
2203
      /* No value field */
2204
0
      continue;
2205
0
    }
2206
2207
0
    switch (tag) {
2208
0
    case 0x80: /* Terminal power supply */
2209
0
      proto_tree_add_item(value_tree, hf_tc_actual_used_supply_voltage_class, tvb, offset, 1, ENC_NA);
2210
0
      proto_tree_add_item(value_tree, hf_tc_max_available_power_supply, tvb, offset+1, 1, ENC_NA);
2211
0
      proto_tree_add_item(value_tree, hf_tc_actual_used_clock_frequency, tvb, offset+2, 1, ENC_NA);
2212
0
      break;
2213
0
    case 0x81: /* Extended logical channels terminal support */
2214
0
      break;
2215
0
    case 0x82: /* Additional interfaces support */
2216
0
      proto_tree_add_item(value_tree, hf_tc_additional_interfaces_uicc_clf, tvb, offset, 1, ENC_NA);
2217
0
      proto_tree_add_item(value_tree, hf_tc_additional_interfaces_rfu, tvb, offset, 1, ENC_NA);
2218
0
      break;
2219
0
    case 0x83: /* RSP Device Capabilities (SGP.22) */
2220
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_luid, tvb, offset, 1, ENC_NA);
2221
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_lpdd, tvb, offset, 1, ENC_NA);
2222
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_ldsd, tvb, offset, 1, ENC_NA);
2223
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_luie, tvb, offset, 1, ENC_NA);
2224
0
      proto_tree_add_item(value_tree, hf_tc_sgp22_rfu, tvb, offset, 1, ENC_NA);
2225
0
      break;
2226
0
    case 0x84: /* IoT Device Capabilities (SGP.32) */
2227
0
      proto_tree_add_item(value_tree, hf_tc_sgp32_ipad, tvb, offset, 1, ENC_NA);
2228
0
      proto_tree_add_item(value_tree, hf_tc_sgp32_rfu, tvb, offset, 1, ENC_NA);
2229
0
      break;
2230
0
    default:
2231
      /* Unknown tag */
2232
0
      proto_tree_add_item(value_tree, hf_tc_value, tvb, offset, len, ENC_NA);
2233
0
      break;
2234
0
    }
2235
2236
0
    offset += len;
2237
0
  }
2238
2239
0
  return offset;
2240
0
}
2241
2242
static int
2243
dissect_bertlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
2244
2
{
2245
2
  unsigned int pos = 0;
2246
2
  proto_tree *top_tree = data ? (proto_tree *)data : tree;
2247
2248
5
  while (pos < tvb_reported_length(tvb)) {
2249
5
    uint8_t tag;
2250
5
    uint32_t len;
2251
5
    tvbuff_t *subtvb;
2252
2253
    /* FIXME: properly follow BER coding rules */
2254
5
    proto_tree_add_item_ret_uint8(tree, hf_cat_ber_tag, tvb, pos, 1, ENC_BIG_ENDIAN, &tag);
2255
5
    pos++;
2256
5
    col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
2257
5
        val_to_str(pinfo->pool, tag, ber_tlv_cat_tag_vals, "%02x "));
2258
5
    len = tvb_get_uint8(tvb, pos++);
2259
5
    switch (len) {
2260
0
    case 0x81:
2261
0
      len = tvb_get_uint8(tvb, pos++);
2262
0
      break;
2263
0
    case 0x82:
2264
0
      len = tvb_get_ntohs(tvb, pos);
2265
0
      pos += 2;
2266
0
      break;
2267
0
    case 0x83:
2268
0
      len = tvb_get_ntoh24(tvb, pos);
2269
0
      pos += 3;
2270
0
      break;
2271
5
    default:
2272
5
      break;
2273
5
    }
2274
2275
5
    subtvb = tvb_new_subset_length(tvb, pos, len);
2276
5
    switch (tag) {
2277
0
    case 0xD0:  /* proactive command */
2278
0
    case 0xD1:  /* sms-pp download */
2279
0
    case 0xD6:  /* event download */
2280
2
    case 0xD7:  /* timer expiration */
2281
2
      call_dissector_with_data(sub_handle_cap, subtvb, pinfo, top_tree, GUINT_TO_POINTER((unsigned)tag));
2282
2
      break;
2283
5
    }
2284
2285
3
    pos += len;
2286
3
  }
2287
0
  return tvb_captured_length(tvb);
2288
2
}
2289
2290
2291
#define ADD_TP_BYTE(byte) \
2292
0
    if ((offset - start_offset) >= p3) break; \
2293
0
    proto_tree_add_bitmask(sim_tree, tvb, offset++, hf_tprof_b##byte, ett_tprof_b##byte, tprof_b##byte##_fields, ENC_BIG_ENDIAN);
2294
2295
3
#define P1_OFFS   0
2296
3
#define P2_OFFS   1
2297
3
#define P3_OFFS   2
2298
3
#define DATA_OFFS 3
2299
2300
static const value_string sfi_vals[] = {
2301
  { 0x01, "Emergency call codes" },
2302
  { 0x02, "Language indication" },
2303
  { 0x03, "Administrative data" },
2304
  { 0x04, "USIM service table" },
2305
  { 0x05, "Enabled services table" },
2306
  { 0x06, "Access control class" },
2307
  { 0x07, "IMSI" },
2308
  { 0x08, "Ciphering and integrity keys" },
2309
  { 0x09, "Ciphering and integrity keys for packet switched domain" },
2310
  { 0x0A, "User PLMN selector" },
2311
  { 0x0B, "Location information" },
2312
  { 0x0C, "Packet switched location information" },
2313
  { 0x0D, "Forbidden PLMNs" },
2314
  { 0x0E, "CBMID" },
2315
  { 0x0F, "Hyperframe number" },
2316
  { 0x10, "Maximum value of hyperframe number" },
2317
  { 0x11, "Operator PLMN selector" },
2318
  { 0x12, "Higher Priority PLMN search period" },
2319
  { 0x13, "Preferred HPLMN access technology" },
2320
  { 0x14, "Incoming call information" },
2321
  { 0x15, "Outgoing call information" },
2322
  { 0x16, "Capability configuration parameters 2" },
2323
  { 0x17, "Access Rule Reference" },
2324
  { 0x18, "EPS NAS Security Context" },
2325
  { 0x19, "PLMN Network Name" },
2326
  { 0x1A, "Operator Network List" },
2327
  { 0x1B, "Service Provider Display Information" },
2328
  { 0x1C, "Accumulated Call Meter" },
2329
  { 0x1D, "Equivalent HPLMN" },
2330
  { 0x1E, "EPS location information" },
2331
  { 0, NULL }
2332
};
2333
2334
static const value_string sfi_referencing_vals[] = {
2335
  { 0x04, "SFI referencing used" },
2336
  { 0, NULL }
2337
};
2338
2339
static int
2340
dissect_auth_challenge(uint8_t context, tvbuff_t *tvb, proto_tree *tree, int offset, int length)
2341
0
{
2342
0
  proto_item *ti;
2343
0
  proto_tree *sub_tree;
2344
0
  uint32_t len;
2345
2346
0
  ti = proto_tree_add_item(tree, hf_auth_challenge, tvb, offset, length, ENC_NA);
2347
0
  sub_tree = proto_item_add_subtree(ti, ett_auth_challenge);
2348
2349
0
  switch (context) {
2350
0
  case 0x00: /* GSM context */
2351
0
  case 0x01: /* 3G/EPS/5G context */
2352
0
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_rand_len, tvb, offset, 1, ENC_NA, &len);
2353
0
    offset += 1;
2354
0
    proto_tree_add_item(sub_tree, hf_auth_rand, tvb, offset, len, ENC_NA);
2355
0
    offset += len;
2356
0
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_autn_len, tvb, offset, 1, ENC_NA, &len);
2357
0
    offset += 1;
2358
0
    proto_tree_add_item(sub_tree, hf_auth_autn, tvb, offset, len, ENC_NA);
2359
0
    offset += len;
2360
0
    break;
2361
0
  default:
2362
    /* XXX - Dissect according to authentication context */
2363
0
    offset += length;
2364
0
    break;
2365
0
  }
2366
2367
0
  return offset;
2368
0
}
2369
2370
static int
2371
dissect_auth_response(uint8_t context, tvbuff_t *tvb, proto_tree *tree, int offset, int length)
2372
0
{
2373
0
  proto_item *ti;
2374
0
  proto_tree *sub_tree;
2375
0
  uint32_t status = 0;
2376
0
  uint32_t len;
2377
2378
0
  if (context == 0x01) {
2379
    /* 3G/EPS/5G context - put status outside the response tree */
2380
0
    proto_tree_add_item_ret_uint(tree, hf_auth_status, tvb, offset, 1, ENC_NA, &status);
2381
0
  }
2382
2383
0
  ti = proto_tree_add_item(tree, hf_auth_response, tvb, offset, length, ENC_NA);
2384
0
  sub_tree = proto_item_add_subtree(ti, ett_auth_response);
2385
2386
0
  switch (context) {
2387
0
  case 0x00: /* GSM context */
2388
0
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_gsm_sres_len, tvb, offset, 1, ENC_NA, &len);
2389
0
    offset += 1;
2390
0
    proto_tree_add_item(sub_tree, hf_auth_gsm_sres, tvb, offset, len, ENC_NA);
2391
0
    offset += len;
2392
0
    proto_tree_add_item_ret_uint(sub_tree, hf_auth_gsm_kc_len, tvb, offset, 1, ENC_NA, &len);
2393
0
    offset += 1;
2394
0
    proto_tree_add_item(sub_tree, hf_auth_gsm_kc, tvb, offset, len, ENC_NA);
2395
0
    offset += len;
2396
0
    break;
2397
0
  case 0x01: /* 3G/EPS/5G context */
2398
0
    offset += 1; /* Skip status byte already added above */
2399
0
    if (status == 0xDB) {
2400
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_res_len, tvb, offset, 1, ENC_NA, &len);
2401
0
      offset += 1;
2402
0
      proto_tree_add_item(sub_tree, hf_auth_res, tvb, offset, len, ENC_NA);
2403
0
      offset += len;
2404
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_ck_len, tvb, offset, 1, ENC_NA, &len);
2405
0
      offset += 1;
2406
0
      proto_tree_add_item(sub_tree, hf_auth_ck, tvb, offset, len, ENC_NA);
2407
0
      offset += len;
2408
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_ik_len, tvb, offset, 1, ENC_NA, &len);
2409
0
      offset += 1;
2410
0
      proto_tree_add_item(sub_tree, hf_auth_ik, tvb, offset, len, ENC_NA);
2411
0
      offset += len;
2412
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_kc_len, tvb, offset, 1, ENC_NA, &len);
2413
0
      offset += 1;
2414
0
      proto_tree_add_item(sub_tree, hf_auth_kc, tvb, offset, len, ENC_NA);
2415
0
      offset += len;
2416
0
    } else if (status == 0xDC) {
2417
0
      proto_tree_add_item_ret_uint(sub_tree, hf_auth_auts_len, tvb, offset, 1, ENC_NA, &len);
2418
0
      offset += 1;
2419
0
      proto_tree_add_item(sub_tree, hf_auth_auts, tvb, offset, len, ENC_NA);
2420
0
      offset += len;
2421
0
    }
2422
0
    break;
2423
0
  default:
2424
    /* XXX - Dissect according to authentication context */
2425
0
    offset += length;
2426
0
  }
2427
2428
0
  return offset;
2429
0
}
2430
2431
static void
2432
dissect_apdu_lc(proto_tree *tree, tvbuff_t *tvb, int offset, bool extended_len)
2433
1
{
2434
1
  if (extended_len) {
2435
0
    proto_tree_add_item(tree, hf_apdu_lc_ext, tvb, offset, 3, ENC_BIG_ENDIAN);
2436
1
  } else {
2437
1
    proto_tree_add_item(tree, hf_apdu_lc, tvb, offset, 1, ENC_BIG_ENDIAN);
2438
1
  }
2439
1
}
2440
2441
static void
2442
dissect_apdu_le(proto_tree *tree, tvbuff_t *tvb, int offset, bool extended_len, bool first)
2443
2
{
2444
2
  if (extended_len) {
2445
0
    proto_tree_add_item(tree, hf_apdu_le_ext, tvb, offset, first ? 3 : 2, ENC_BIG_ENDIAN);
2446
2
  } else {
2447
2
    proto_tree_add_item(tree, hf_apdu_le, tvb, offset, 1, ENC_BIG_ENDIAN);
2448
2
  }
2449
2
}
2450
2451
static void
2452
dissect_storage_data_command(tvbuff_t *tvb, int offset, int length, packet_info *pinfo,
2453
           proto_tree *tree, proto_tree *sim_tree, gsm_sim_transaction_t *gsm_sim_trans)
2454
0
{
2455
0
  bool last_block = gsm_sim_trans->cmd_p1 & 0x80; /* Block chaining bit */
2456
0
  uint32_t frag_number = gsm_sim_trans->cmd_p2;   /* Block number */
2457
0
  tvbuff_t *subtvb;
2458
2459
0
  if (frag_number == 0 && last_block) {
2460
    /* No reassembly needed. */
2461
0
    subtvb = tvb_new_subset_length(tvb, offset, length);
2462
0
  } else {
2463
0
    fragment_head *frag_msg;
2464
2465
    /* The APDU reassembly is using the first command frame number as id. */
2466
0
    frag_msg = fragment_add_seq_check(&gsm_sim_reassembly_table, tvb, offset, pinfo,
2467
0
              gsm_sim_trans->related_trans->cmd_frame, NULL,
2468
0
              frag_number, length, !last_block);
2469
0
    subtvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled APDU",
2470
0
              frag_msg, &gsm_sim_frag_items, NULL, sim_tree);
2471
0
  }
2472
2473
0
  if (subtvb && ((gsm_sim_trans->cmd_p1 & 0x78) == 0x10)) {
2474
0
    dissect_rsp_store_data(subtvb, pinfo, tree, false);
2475
0
  }
2476
0
}
2477
2478
static tvbuff_t *
2479
gsm_sim_apdu_reassemble(tvbuff_t *tvb, int offset, packet_info *pinfo, gsm_sim_transaction_t *gsm_sim_trans,
2480
      proto_tree *sim_tree, uint8_t *apdu_ins, uint8_t *apdu_p1, uint8_t *apdu_p2)
2481
2
{
2482
2
  unsigned tvb_len = tvb_reported_length(tvb);
2483
2
  unsigned apdu_len = tvb_len - offset - 2;
2484
2
  tvbuff_t *subtvb = NULL;
2485
2
  uint8_t sw1;
2486
2487
2
  if (!gsm_sim_trans || gsm_sim_trans->rsp_frame != pinfo->num) {
2488
    /* No transaction found, return the current tvb subset */
2489
0
    return tvb_new_subset_length(tvb, offset, apdu_len);
2490
0
  }
2491
2492
  /* Try reassembly if SW1 is "Response ready" or instruction is "GET RESPONSE" */
2493
2
  sw1 = tvb_get_uint8(tvb, tvb_len - 2);
2494
2
  if (sw1 == 0x61 || gsm_sim_trans->cmd_ins == 0xC0) {
2495
0
    fragment_head *frag_msg;
2496
2497
    /* The APDU reassembly is using the command frame number + 1 as id. */
2498
0
    frag_msg = fragment_add_seq_next(&gsm_sim_reassembly_table, tvb, offset, pinfo,
2499
0
             gsm_sim_trans->related_trans->cmd_frame + 1, NULL,
2500
0
             apdu_len, sw1 == 0x61);
2501
0
    subtvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled APDU",
2502
0
              frag_msg, &gsm_sim_frag_items, NULL, sim_tree);
2503
0
  }
2504
2505
2
  if (!subtvb) {
2506
2
    subtvb = tvb_new_subset_length(tvb, offset, apdu_len);
2507
2
  }
2508
2509
2
  if (gsm_sim_trans != gsm_sim_trans->related_trans) {
2510
    /* Use INS, P1 and P2 from the related command */
2511
0
    *apdu_ins = gsm_sim_trans->related_trans->cmd_ins;
2512
0
    *apdu_p1 = gsm_sim_trans->related_trans->cmd_p1;
2513
0
    *apdu_p2 = gsm_sim_trans->related_trans->cmd_p2;
2514
0
  }
2515
2516
2
  return subtvb;
2517
2
}
2518
2519
static int
2520
dissect_gsm_apdu(uint8_t ins, uint8_t p1, uint8_t p2, uint16_t p3, bool extended_len,
2521
     tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_tree *sim_tree,
2522
     gsm_sim_transaction_t *gsm_sim_trans)
2523
3
{
2524
3
  uint16_t g16;
2525
3
  tvbuff_t *subtvb;
2526
3
  int i, start_offset;
2527
3
  uint8_t first_byte = 0;
2528
3
  const int data_offs = DATA_OFFS + (extended_len ? 2 : 0);
2529
2530
3
  col_append_fstr(pinfo->cinfo, COL_INFO, "%s ",
2531
3
      val_to_str(pinfo->pool, ins, apdu_ins_vals, "%02x"));
2532
2533
3
  switch (ins) {
2534
0
  case 0xA4: /* SELECT */
2535
0
    proto_tree_add_item(sim_tree, hf_select_type, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2536
0
    proto_tree_add_item(sim_tree, hf_select_rfu, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2537
0
    if (p1 == 0x04) { /* Selection by DF name (selection by AID) */
2538
0
      proto_tree_add_item(sim_tree, hf_select_session_control, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2539
0
    } else {
2540
0
      proto_tree_add_item(sim_tree, hf_select_unused_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2541
0
    }
2542
0
    proto_tree_add_item(sim_tree, hf_select_return_data, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2543
0
    proto_tree_add_item(sim_tree, hf_select_selection, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2544
0
    break;
2545
0
  case 0xF2: /* STATUS */
2546
0
    proto_tree_add_item(sim_tree, hf_status_application_status, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2547
0
    proto_tree_add_item(sim_tree, hf_status_return_data, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2548
0
    if (p1 == 0x01) {
2549
0
      col_append_str(pinfo->cinfo, COL_INFO, "(initialized) ");
2550
0
    } else if (p1 == 0x02) {
2551
0
      col_append_str(pinfo->cinfo, COL_INFO, "(terminate) ");
2552
0
    }
2553
0
    break;
2554
0
  case 0xB0: /* READ BINARY */
2555
0
  case 0xD6: /* UPDATE BINARY */
2556
0
    if (p1 & 0x80) {
2557
0
      proto_tree_add_item(sim_tree, hf_referencing, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2558
0
      proto_tree_add_item(sim_tree, hf_sfi, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2559
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "Offset=%u ", p2);
2560
0
      proto_tree_add_item(sim_tree, hf_bin_offset, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2561
0
    } else {
2562
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "Offset=%u ", p1 << 8 | p2);
2563
0
      proto_tree_add_item(sim_tree, hf_bin_offset, tvb, offset+P1_OFFS, 2, ENC_BIG_ENDIAN);
2564
0
    }
2565
0
    break;
2566
0
  case 0xB2: /* READ RECORD */
2567
0
  case 0xDC: /* UPDATE RECORD */
2568
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "RecordNr=%u ", p1);
2569
0
    proto_tree_add_item(sim_tree, hf_record_nr, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2570
0
    proto_tree_add_item(sim_tree, hf_record_file, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2571
0
    proto_tree_add_item(sim_tree, hf_record_mode, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2572
0
    break;
2573
0
  case 0xA2: /* SEARCH RECORD */
2574
0
    first_byte = tvb_get_uint8(tvb, offset+data_offs);
2575
0
    if (((p2 & 0x04) == 0) || (((p2 & 0x07) == 0x06) && ((first_byte & 0x04) == 0))) {
2576
0
      proto_tree_add_item(sim_tree, hf_record_id, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2577
0
    } else {
2578
0
      proto_tree_add_item(sim_tree, hf_record_nr, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2579
0
    }
2580
0
    proto_tree_add_item(sim_tree, hf_search_ef_identifier, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2581
0
    proto_tree_add_item(sim_tree, hf_search_mode, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2582
0
    break;
2583
0
  case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2584
0
    proto_tree_add_item(sim_tree, hf_apdu_p1, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2585
0
    if (p2 != 0) {
2586
0
      proto_tree_add_item(sim_tree, hf_auth_reference, tvb, offset+P2_OFFS, 1, ENC_NA);
2587
0
      proto_tree_add_item(sim_tree, hf_auth_rfu, tvb, offset+P2_OFFS, 1, ENC_NA);
2588
0
      proto_tree_add_item(sim_tree, hf_auth_context, tvb, offset+P2_OFFS, 1, ENC_NA);
2589
0
    }
2590
0
    break;
2591
0
  case 0x70: /* MANAGE CHANNEL */
2592
0
    proto_tree_add_item(sim_tree, hf_chan_op, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2593
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "Operation=%s ", val_to_str(pinfo->pool, p1, chan_op_vals, "%02x"));
2594
0
    proto_tree_add_item(sim_tree, hf_chan_nr, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2595
0
    if (p1 == 0 && p2 == 0) {
2596
      /* Logical channels are assigned by the card when P2 is 0. */
2597
0
      col_append_str(pinfo->cinfo, COL_INFO, "(assign channel) ");
2598
0
    } else {
2599
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "(channel: %d) ", p2);
2600
0
    }
2601
0
    break;
2602
0
  case 0x76: /* SUSPEND UICC */
2603
0
    proto_tree_add_item(sim_tree, hf_suspend_uicc_op, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2604
0
    proto_tree_add_item(sim_tree, hf_apdu_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2605
0
    break;
2606
0
  case 0xE2: /* STORE DATA */
2607
0
    proto_tree_add_item(sim_tree, hf_store_data_block, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2608
0
    proto_tree_add_item(sim_tree, hf_store_data_encryption, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2609
0
    proto_tree_add_item(sim_tree, hf_store_data_structure, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2610
0
    proto_tree_add_item(sim_tree, hf_store_data_rfu, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2611
0
    proto_tree_add_item(sim_tree, hf_store_data_iso_case, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2612
0
    proto_tree_add_item(sim_tree, hf_store_data_block_nr, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2613
0
    if (p1 & 0x80) {
2614
0
      col_append_str(pinfo->cinfo, COL_INFO, "(last block) ");
2615
0
    } else {
2616
0
      col_append_str(pinfo->cinfo, COL_INFO, "(more blocks) ");
2617
0
    }
2618
0
    break;
2619
3
  default:
2620
    /* Generic P1 and P2 */
2621
3
    proto_tree_add_item(sim_tree, hf_apdu_p1, tvb, offset+P1_OFFS, 1, ENC_BIG_ENDIAN);
2622
3
    proto_tree_add_item(sim_tree, hf_apdu_p2, tvb, offset+P2_OFFS, 1, ENC_BIG_ENDIAN);
2623
3
    break;
2624
3
  }
2625
2626
3
  switch (ins) {
2627
0
  case 0xA4: /* SELECT */
2628
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2629
0
    if (p3 < 2) {
2630
0
      offset += data_offs;
2631
0
      break;
2632
0
    }
2633
0
    switch (p1) {
2634
0
    case 0x03:  /* parent DF */
2635
0
      col_append_str(pinfo->cinfo, COL_INFO, "Parent DF ");
2636
0
      break;
2637
0
    case 0x04:  /* select by AID */
2638
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "Application %s ",
2639
0
          tvb_bytes_to_str(pinfo->pool, tvb, offset+data_offs, p3));
2640
0
      proto_tree_add_item(sim_tree, hf_aid, tvb, offset+data_offs, p3, ENC_NA);
2641
0
      break;
2642
2643
0
    case 0x09:  /* select by relative path */
2644
0
      col_append_str(pinfo->cinfo, COL_INFO, ".");
2645
      /* fallthrough */
2646
0
    case 0x08:  /* select by absolute path */
2647
0
      for (i = 0; i < p3; i += 2) {
2648
0
        g16 = tvb_get_ntohs(tvb, offset+data_offs+i);
2649
0
        col_append_fstr(pinfo->cinfo, COL_INFO, "/%s",
2650
0
            val_to_str(pinfo->pool, g16, mf_dfs, "%04x"));
2651
0
        proto_tree_add_item(sim_tree, hf_file_id, tvb, offset+data_offs+i, 2, ENC_BIG_ENDIAN);
2652
0
      }
2653
0
      col_append_str(pinfo->cinfo, COL_INFO, " ");
2654
0
      break;
2655
0
    default:
2656
0
      g16 = tvb_get_ntohs(tvb, offset+data_offs);
2657
0
      col_append_fstr(pinfo->cinfo, COL_INFO, "File %s ",
2658
0
          val_to_str(pinfo->pool, g16, mf_dfs, "%04x"));
2659
0
      proto_tree_add_item(sim_tree, hf_file_id, tvb, offset+data_offs, p3, ENC_BIG_ENDIAN);
2660
0
      break;
2661
0
    }
2662
0
    offset += data_offs + p3;
2663
0
    if (tvb_reported_length_remaining(tvb, offset)) {
2664
0
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2665
0
      offset += (extended_len ? 2 : 1);
2666
0
    }
2667
0
    break;
2668
0
  case 0xF2: /* STATUS */
2669
0
    if (tvb_reported_length_remaining(tvb, offset+P3_OFFS)) {
2670
0
      dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2671
0
    }
2672
0
    offset += data_offs;
2673
0
    break;
2674
0
  case 0xB0: /* READ BINARY */
2675
0
  case 0xB2: /* READ RECORD */
2676
2
  case 0x12: /* FETCH */
2677
2
  case 0x78: /* GET IDENTITY */
2678
2
  case 0xC0: /* GET RESPONSE */
2679
2
  case 0xCA: /* GET DATA */
2680
2
    dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2681
2
    offset += data_offs;
2682
2
    break;
2683
0
  case 0xD6: /* UPDATE BINARY */
2684
0
  case 0xDC: /* UPDATE RECORD */
2685
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2686
0
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2687
0
    offset += data_offs + p3;
2688
0
    break;
2689
0
  case 0xA2: /* SEARCH RECORD */
2690
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2691
0
    offset += data_offs;
2692
0
    if ((p2 & 0x07) == 0x06) { /* Enhanced search */
2693
0
      proto_tree_add_item(sim_tree, hf_search_enhanced_type, tvb, offset, 1, ENC_BIG_ENDIAN);
2694
0
      proto_tree_add_item(sim_tree, hf_search_enhanced_mode, tvb, offset, 1, ENC_BIG_ENDIAN);
2695
0
      offset++;
2696
0
      if ((first_byte & 0xF8) == 0) {
2697
0
        proto_tree_add_item(sim_tree, hf_search_enhanced_offset, tvb, offset++, 1, ENC_BIG_ENDIAN);
2698
0
      } else {
2699
0
        proto_tree_add_item(sim_tree, hf_search_enhanced_value, tvb, offset++, 1, ENC_BIG_ENDIAN);
2700
0
      }
2701
0
      p3 -= 2; /* Reduced by 2 bytes for the enhanced search indication */
2702
0
    }
2703
0
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, p3, ENC_NA);
2704
0
    offset += p3;
2705
0
    if (tvb_reported_length_remaining(tvb, offset)) {
2706
0
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2707
0
      offset += (extended_len ? 2 : 1);
2708
0
    }
2709
0
    break;
2710
0
  case 0x32: /* INCREASE */
2711
0
    offset += data_offs;
2712
0
    break;
2713
0
  case 0x20: /* VERIFY CHV */
2714
0
  case 0x24: /* CHANGE CHV */
2715
0
  case 0x26: /* DISABLE CHV */
2716
0
  case 0x28: /* ENABLE CHV */
2717
0
  case 0x2C: /* UNBLOCK CHV */
2718
0
    col_append_fstr(pinfo->cinfo, COL_INFO, "CHV=%u ", p2);
2719
0
    offset += data_offs;
2720
    /* FIXME: actual PIN/PUK code */
2721
0
    break;
2722
0
  case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2723
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2724
0
    offset += data_offs;
2725
2726
0
    if (p2 == 0) {
2727
      /* GSM ALGORITHM */
2728
0
      proto_tree_add_item(sim_tree, hf_auth_gsm_rand, tvb, offset, 16, ENC_NA);
2729
0
      offset += 16;
2730
0
    } else {
2731
0
      dissect_auth_challenge(p2 & 0x07, tvb, sim_tree, offset, p3);
2732
0
      offset += p3;
2733
0
    }
2734
0
    if (tvb_reported_length_remaining(tvb, offset)) {
2735
0
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2736
0
      offset += (extended_len ? 2 : 1);
2737
0
    }
2738
0
    break;
2739
0
  case 0x10: /* TERMINAL PROFILE */
2740
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2741
0
    offset += data_offs;
2742
0
    start_offset = offset;
2743
0
    ADD_TP_BYTE(1);
2744
0
    ADD_TP_BYTE(2);
2745
0
    ADD_TP_BYTE(3);
2746
0
    ADD_TP_BYTE(4);
2747
0
    ADD_TP_BYTE(5);
2748
0
    ADD_TP_BYTE(6);
2749
0
    ADD_TP_BYTE(7);
2750
0
    ADD_TP_BYTE(8);
2751
0
    ADD_TP_BYTE(9);
2752
0
    ADD_TP_BYTE(10);
2753
0
    ADD_TP_BYTE(11);
2754
0
    ADD_TP_BYTE(12);
2755
0
    ADD_TP_BYTE(13);
2756
0
    ADD_TP_BYTE(14);
2757
0
    ADD_TP_BYTE(15);
2758
0
    ADD_TP_BYTE(16);
2759
0
    ADD_TP_BYTE(17);
2760
0
    ADD_TP_BYTE(18);
2761
0
    ADD_TP_BYTE(19);
2762
0
    ADD_TP_BYTE(20);
2763
0
    ADD_TP_BYTE(21);
2764
0
    ADD_TP_BYTE(22);
2765
0
    ADD_TP_BYTE(23);
2766
0
    ADD_TP_BYTE(24);
2767
0
    ADD_TP_BYTE(25);
2768
0
    ADD_TP_BYTE(26);
2769
0
    ADD_TP_BYTE(27);
2770
0
    ADD_TP_BYTE(28);
2771
0
    ADD_TP_BYTE(29);
2772
0
    ADD_TP_BYTE(30);
2773
0
    ADD_TP_BYTE(31);
2774
0
    ADD_TP_BYTE(32);
2775
0
    ADD_TP_BYTE(33);
2776
0
    ADD_TP_BYTE(34);
2777
0
    ADD_TP_BYTE(35);
2778
0
    ADD_TP_BYTE(36);
2779
0
    ADD_TP_BYTE(37);
2780
0
    ADD_TP_BYTE(38);
2781
0
    ADD_TP_BYTE(39);
2782
0
    while ((offset - start_offset) < p3) {
2783
0
      proto_tree_add_item(sim_tree, hf_tprof_unknown_byte, tvb, offset++, 1, ENC_BIG_ENDIAN);
2784
0
    }
2785
0
    break;
2786
1
  case 0x14: /* TERMINAL RESPONSE */
2787
1
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2788
1
    subtvb = tvb_new_subset_length(tvb, offset+data_offs, p3);
2789
1
    call_dissector_with_data(sub_handle_cap, subtvb, pinfo, tree, GUINT_TO_POINTER(0x14));
2790
1
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2791
1
    offset += data_offs + p3;
2792
1
    break;
2793
0
  case 0xAA: /* TERMINAL CAPABILITY */
2794
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2795
0
    dissect_terminal_capability(tvb, pinfo, sim_tree, offset+data_offs, p3);
2796
0
    offset += data_offs + p3;
2797
0
    break;
2798
0
  case 0x70: /* MANAGE CHANNEL */
2799
0
    if (tvb_reported_length_remaining(tvb, offset+P3_OFFS)) {
2800
0
      dissect_apdu_le(sim_tree, tvb, offset+P3_OFFS, extended_len, true);
2801
0
    }
2802
0
    offset += data_offs;
2803
0
    break;
2804
0
  case 0xC2: /* ENVELOPE */
2805
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2806
0
    subtvb = tvb_new_subset_length(tvb, offset+data_offs, p3);
2807
0
    dissect_bertlv(subtvb, pinfo, sim_tree, tree);
2808
0
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2809
0
    offset += data_offs + p3;
2810
0
    if (tvb_reported_length_remaining(tvb, offset)) {
2811
0
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2812
0
      offset += (extended_len ? 2 : 1);
2813
0
    }
2814
0
    break;
2815
0
  case 0x76: /* SUSPEND UICC */
2816
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2817
0
    if ((p1 & 0x01) == 0x00) {
2818
      /* Suspend the UICC */
2819
0
      col_append_str(pinfo->cinfo, COL_INFO, "(suspend) ");
2820
0
      proto_tree_add_item(sim_tree, hf_suspend_uicc_min_time_unit, tvb, offset+data_offs, 1, ENC_BIG_ENDIAN);
2821
0
      proto_tree_add_item(sim_tree, hf_suspend_uicc_min_time_length, tvb, offset+data_offs+1, 1, ENC_BIG_ENDIAN);
2822
0
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_unit, tvb, offset+data_offs+2, 1, ENC_BIG_ENDIAN);
2823
0
      proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_length, tvb, offset+data_offs+3, 1, ENC_BIG_ENDIAN);
2824
0
      dissect_apdu_le(sim_tree, tvb, offset+data_offs+4, extended_len, false);
2825
0
      offset += (extended_len ? 2 : 1);
2826
0
    } else {
2827
      /* Resume the UICC */
2828
0
      col_append_str(pinfo->cinfo, COL_INFO, "(resume) ");
2829
0
      proto_tree_add_item(sim_tree, hf_suspend_uicc_resume_token, tvb, offset+data_offs, p3, ENC_NA);
2830
0
    }
2831
0
    offset += data_offs + p3;
2832
0
    break;
2833
0
  case 0xE2: /* STORE DATA */
2834
0
    dissect_apdu_lc(sim_tree, tvb, offset+P3_OFFS, extended_len);
2835
0
    proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset+data_offs, p3, ENC_NA);
2836
0
    dissect_storage_data_command(tvb, offset+data_offs, p3, pinfo, tree, sim_tree, gsm_sim_trans);
2837
0
    offset += data_offs + p3;
2838
0
    if ((p1 & 0x80) && tvb_reported_length_remaining(tvb, offset)) {
2839
      /* Le is only present for "Last block" and not present for "More blocks" */
2840
0
      dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
2841
0
      offset += (extended_len ? 2 : 1);
2842
0
    }
2843
0
    break;
2844
0
  case 0x04: /* INVALIDATE */
2845
0
  case 0x44: /* REHABILITATE */
2846
0
  case 0xFA: /* SLEEP */
2847
    /* FIXME: parse command */
2848
0
  default:
2849
0
    return -1;
2850
3
  }
2851
2852
2
  return offset;
2853
3
}
2854
2855
static int
2856
dissect_rsp_apdu_tvb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_tree *sim_tree)
2857
2
{
2858
2
  uint16_t sw;
2859
2
  proto_item *ti = NULL;
2860
2
  unsigned tvb_len = tvb_reported_length(tvb);
2861
2
  gsm_sim_transaction_t *gsm_sim_trans = NULL;
2862
2
  wmem_tree_key_t key[4];
2863
2
  uint32_t interface_id = 0;
2864
2
  uint32_t layer_num = pinfo->curr_layer_num;
2865
2
  uint32_t frame_num = pinfo->num;
2866
2
  uint8_t ins = 0x00;
2867
2
  uint8_t p1 = 0x00;
2868
2
  uint8_t p2 = 0x00;
2869
2
  bool response_only = true;
2870
2871
  /* Structure of response APDU: [Data] SW1 SW2 */
2872
2873
2
  if (!sim_tree) {
2874
0
    ti = proto_tree_add_item(tree, proto_gsm_sim, tvb, 0, -1, ENC_NA);
2875
0
    sim_tree = proto_item_add_subtree(ti, ett_sim);
2876
0
  }
2877
2878
2
  if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
2879
0
    interface_id = pinfo->rec->rec_header.packet_header.interface_id;
2880
0
  }
2881
2882
2
  key[0].length = 1;
2883
2
  key[0].key = &interface_id;
2884
2
  key[1].length = 1;
2885
2
  key[1].key = &layer_num;
2886
2
  key[2].length = 1;
2887
2
  key[2].key = &frame_num;
2888
2
  key[3].length = 0;
2889
2
  key[3].key = NULL;
2890
2891
  /* Receive the largest key that is less than or equal to our frame number */
2892
2
  gsm_sim_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
2893
2
  if (!PINFO_FD_VISITED(pinfo) && gsm_sim_trans && gsm_sim_trans->rsp_frame == 0) {
2894
2
    if (gsm_sim_trans->cmd_ins == 0xC0) { /* GET RESPONSE */
2895
      /* Make a reference to the first APDU this GET RESPONSE is related to */
2896
0
      gsm_sim_transaction_t *prev_trans;
2897
0
      frame_num = gsm_sim_trans->cmd_frame - 1;
2898
0
      prev_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
2899
0
      if (prev_trans) {
2900
0
        gsm_sim_trans->related_trans = prev_trans->related_trans;
2901
0
      }
2902
0
    }
2903
2
    gsm_sim_trans->rsp_frame = pinfo->num;
2904
2
  }
2905
2906
2
  if (offset < 0 || tvb_len < (unsigned)offset + 2) {
2907
    /* Too short for a status word */
2908
0
    proto_tree_add_expert_remaining(sim_tree, pinfo, &ei_unknown_bytes, tvb, offset < 0 ? 0 : (unsigned)offset);
2909
0
    return tvb_captured_length(tvb);
2910
0
  }
2911
2912
2
  if ((tvb_len-offset) > 2) {
2913
2
    tvbuff_t *subtvb;
2914
2
    unsigned apdu_len;
2915
2
    uint8_t apdu_ins;
2916
2917
    /* Use INS, P1 and P2 from the command */
2918
2
    if (gsm_sim_trans && gsm_sim_trans->rsp_frame == pinfo->num) {
2919
2
      ins = gsm_sim_trans->cmd_ins;
2920
2
      p1 = gsm_sim_trans->cmd_p1;
2921
2
      p2 = gsm_sim_trans->cmd_p2;
2922
2
    }
2923
2924
2
    apdu_len = tvb_len - offset - 2;
2925
2
    apdu_ins = ins;
2926
2927
2
    subtvb = gsm_sim_apdu_reassemble(tvb, offset, pinfo, gsm_sim_trans, sim_tree, &apdu_ins, &p1, &p2);
2928
2929
2
    switch (apdu_ins) {
2930
2
    case 0x12: /* FETCH */
2931
2
      dissect_bertlv(subtvb, pinfo, sim_tree, tree);
2932
2
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2933
2
      response_only = false;
2934
2
      break;
2935
0
    case 0x70: /* MANAGE CHANNEL */
2936
0
      if (p1 == 0 && p2 == 0) {
2937
        /* Logical channels are assigned by the card when P2 is 0. */
2938
0
        proto_tree_add_item(sim_tree, hf_chan_nr, tvb, offset, apdu_len, ENC_BIG_ENDIAN);
2939
0
      }
2940
0
      break;
2941
0
    case 0x76: /* SUSPEND UICC */
2942
0
      if (apdu_len >= 2) {
2943
0
        proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_unit, tvb, offset, 1, ENC_BIG_ENDIAN);
2944
0
        proto_tree_add_item(sim_tree, hf_suspend_uicc_max_time_length, tvb, offset+1, 1, ENC_BIG_ENDIAN);
2945
0
        proto_tree_add_item(sim_tree, hf_suspend_uicc_resume_token, tvb, offset+2, apdu_len - 2, ENC_NA);
2946
0
      }
2947
0
      break;
2948
0
    case 0x88: /* RUN GSM ALGORITHM / AUTHENTICATE */
2949
0
      if (p2 == 0) {
2950
        /* GSM ALGORITHM */
2951
0
        proto_tree_add_item(sim_tree, hf_auth_gsm_sres, tvb, offset, 4, ENC_NA);
2952
0
        proto_tree_add_item(sim_tree, hf_auth_gsm_kc, tvb, offset+4, 8, ENC_NA);
2953
0
      } else {
2954
0
        dissect_auth_response(p2 & 0x07, tvb, sim_tree, offset, apdu_len);
2955
0
      }
2956
0
      break;
2957
0
    case 0xE2: /* STORE DATA */
2958
0
      if (subtvb && ((p1 & 0x78) == 0x10)) {
2959
0
        dissect_rsp_store_data(subtvb, pinfo, tree, true);
2960
0
      }
2961
0
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2962
0
      break;
2963
0
    case 0xF2: /* STATUS */
2964
0
    case 0xA4: /* SELECT */
2965
0
      if (!dissect_fcp_template(tvb, pinfo, sim_tree, offset, apdu_len)) {
2966
0
        proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2967
0
      }
2968
0
      break;
2969
0
    default:
2970
0
      proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, apdu_len, ENC_NA);
2971
0
      break;
2972
2
    }
2973
2
  }
2974
0
  offset = tvb_len - 2;
2975
2976
  /* obtain status word */
2977
0
  sw = tvb_get_ntohs(tvb, offset);
2978
0
  proto_tree_add_uint_format_value(sim_tree, hf_apdu_sw, tvb, offset, 2, sw,
2979
0
           "%04x %s", sw, get_sw_string(pinfo->pool, sw));
2980
  /* XXX - Add a PI_RESPONSE_CODE expert info for a non normal sw */
2981
2982
0
  offset += 2;
2983
2984
0
  if (ti) {
2985
    /* Always show status in info column when response only */
2986
0
    if (response_only && ins) {
2987
0
      col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "Response, %s, %s",
2988
0
             val_to_str(pinfo->pool, ins, apdu_ins_vals, "%02x"), get_sw_string(pinfo->pool, sw));
2989
0
    } else if (response_only) {
2990
0
      col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "Response, %s ", get_sw_string(pinfo->pool, sw));
2991
0
    }
2992
0
  } else {
2993
0
    switch (sw >> 8) {
2994
0
    case 0x90:
2995
0
    case 0x91:
2996
0
    case 0x92:
2997
0
    case 0x9e:
2998
0
    case 0x9f:
2999
0
      break;
3000
0
    default:
3001
0
      col_append_fstr(pinfo->cinfo, COL_INFO, ": %s ", get_sw_string(pinfo->pool, sw));
3002
0
      break;
3003
0
    }
3004
0
  }
3005
3006
0
  if (gsm_sim_trans && gsm_sim_trans->rsp_frame == pinfo->num) {
3007
0
    nstime_t ns;
3008
3009
0
    if (gsm_sim_trans != gsm_sim_trans->related_trans) {
3010
0
      ti = proto_tree_add_uint(sim_tree, hf_related_to, NULL, 0, 0,
3011
0
             gsm_sim_trans->related_trans->cmd_frame);
3012
0
      proto_item_set_generated(ti);
3013
0
    }
3014
3015
0
    if (gsm_sim_trans->cmd_frame != gsm_sim_trans->rsp_frame) {
3016
0
      ti = proto_tree_add_uint(sim_tree, hf_response_to, NULL, 0, 0, gsm_sim_trans->cmd_frame);
3017
0
      proto_item_set_generated(ti);
3018
3019
0
      nstime_delta(&ns, &pinfo->fd->abs_ts, &gsm_sim_trans->cmd_time);
3020
0
      ti = proto_tree_add_time(sim_tree, hf_response_time, NULL, 0, 0, &ns);
3021
0
      proto_item_set_generated(ti);
3022
0
    }
3023
0
  }
3024
3025
0
  return offset;
3026
0
}
3027
3028
static int
3029
dissect_cmd_apdu_tvb(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, bool isSIMtrace)
3030
3
{
3031
3
  uint8_t cla, ins, p1, p2;
3032
3
  uint16_t p3;
3033
3
  bool p3_present;
3034
3
  bool extended_len = false;
3035
3
  proto_item *ti;
3036
3
  proto_tree *sim_tree;
3037
3
  int rc = -1;
3038
3
  gsm_sim_transaction_t *gsm_sim_trans;
3039
3
  wmem_tree_key_t key[4];
3040
3
  uint32_t interface_id = 0;
3041
3
  uint32_t layer_num = pinfo->curr_layer_num;
3042
3
  uint32_t frame_num = pinfo->num;
3043
3044
  /* Structure of command APDU: CLA INS P1 P2 [Lc] [Data] [Le]
3045
   *
3046
   * Case 1: CLA INS P1 P2
3047
   * Case 2: CLA INS P1 P2 Le
3048
   * Case 3: CLA INS P1 P2 Lc Data
3049
   * Case 4: CLA INS P1 P2 Lc Data Le
3050
   */
3051
3052
3
  cla = tvb_get_uint8(tvb, offset);
3053
3
  ins = tvb_get_uint8(tvb, offset+1);
3054
3
  p1 = tvb_get_uint8(tvb, offset+2);
3055
3
  p2 = tvb_get_uint8(tvb, offset+3);
3056
3057
  /* If isSIMtrace is true, then the tvb contains the command followed by
3058
   * the response. The response consists of response data followed by the
3059
   * 2 octet status word. Slice off the status word first.
3060
   */
3061
3
  tvbuff_t *next_tvb = tvb;
3062
3
  if (isSIMtrace) {
3063
    /* We already retrieved ins, p1, p2, so tvb_len > 2 */
3064
3
    next_tvb = tvb_new_subset_length(tvb, 0, tvb_reported_length(tvb) - 2);
3065
3
  }
3066
3067
3
  if (tvb_reported_length_remaining(next_tvb, offset+4) >= 1) {
3068
3
    p3 = tvb_get_uint8(next_tvb, offset+4);
3069
3
    p3_present = true;
3070
3071
3
    if (p3 == 0 && !isSIMtrace && tvb_reported_length_remaining(next_tvb, offset+5) >= 2) {
3072
      /* Extended length */
3073
0
      p3 = tvb_get_uint16(next_tvb, offset+5, ENC_BIG_ENDIAN);
3074
0
      extended_len = true;
3075
0
    }
3076
3
  } else {
3077
    /* Parameter 3 not present. */
3078
0
    p3 = 0;
3079
0
    p3_present = false;
3080
0
  }
3081
3082
3
  if (pinfo->rec->presence_flags & WTAP_HAS_INTERFACE_ID) {
3083
0
    interface_id = pinfo->rec->rec_header.packet_header.interface_id;
3084
0
  }
3085
3086
3
  key[0].length = 1;
3087
3
  key[0].key = &interface_id;
3088
3
  key[1].length = 1;
3089
3
  key[1].key = &layer_num;
3090
3
  key[2].length = 1;
3091
3
  key[2].key = &frame_num;
3092
3
  key[3].length = 0;
3093
3
  key[3].key = NULL;
3094
3095
3
  if (PINFO_FD_VISITED(pinfo)) {
3096
0
    gsm_sim_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array(transactions, key);
3097
3
  } else {
3098
    /* This is the first time we see this packet, so create a new transaction */
3099
3
    gsm_sim_trans = wmem_new(wmem_file_scope(), gsm_sim_transaction_t);
3100
3
    gsm_sim_trans->cmd_frame = pinfo->num;
3101
3
    gsm_sim_trans->rsp_frame = 0;
3102
3
    gsm_sim_trans->cmd_time = pinfo->fd->abs_ts;
3103
3
    gsm_sim_trans->cmd_ins = ins;
3104
3
    gsm_sim_trans->cmd_p1 = p1;
3105
3
    gsm_sim_trans->cmd_p2 = p2;
3106
3
    gsm_sim_trans->related_trans = gsm_sim_trans; /* Default to self */
3107
3108
3
    wmem_tree_insert32_array(transactions, key, gsm_sim_trans);
3109
3110
3
    if (gsm_sim_trans->cmd_ins == 0xE2 && p2 != 0) { /* STORE DATA */
3111
      /* Make a reference to the first APDU this STORE DATA is related to */
3112
0
      gsm_sim_transaction_t *prev_trans;
3113
0
      frame_num = gsm_sim_trans->cmd_frame - 1;
3114
0
      prev_trans = (gsm_sim_transaction_t *)wmem_tree_lookup32_array_le(transactions, key);
3115
0
      if (prev_trans) {
3116
0
        gsm_sim_trans->related_trans = prev_trans->related_trans;
3117
0
      }
3118
0
    }
3119
3
  }
3120
3121
3
  ti = proto_tree_add_item(tree, proto_gsm_sim, tvb, 0, -1, ENC_NA);
3122
3
  sim_tree = proto_item_add_subtree(ti, ett_sim);
3123
3124
3
  if ((cla & 0x50) == 0x40) {
3125
0
    proto_tree_add_item(sim_tree, hf_apdu_cla_coding_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3126
0
    proto_tree_add_item(sim_tree, hf_apdu_cla_secure_messaging_ind_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3127
0
    proto_tree_add_item(sim_tree, hf_apdu_cla_log_chan_ext, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3128
3
  } else {
3129
3
    proto_tree_add_item(sim_tree, hf_apdu_cla_coding, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3130
3
    proto_tree_add_item(sim_tree, hf_apdu_cla_secure_messaging_ind, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3131
3
    proto_tree_add_item(sim_tree, hf_apdu_cla_log_chan, next_tvb, offset, 1, ENC_BIG_ENDIAN);
3132
3
  }
3133
3
  proto_tree_add_item(sim_tree, hf_apdu_ins, next_tvb, offset+1, 1, ENC_BIG_ENDIAN);
3134
3
  offset += 2;
3135
3136
3
  if ((cla & 0x50) == 0x40) {
3137
0
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s ",
3138
0
        val_to_str(pinfo->pool, cla>>6, apdu_cla_coding_ext_vals, "%01x"));
3139
3
  } else {
3140
3
    col_append_sep_fstr(pinfo->cinfo, COL_INFO, " | ", "%s ",
3141
3
        val_to_str(pinfo->pool, cla>>4, apdu_cla_coding_vals, "%01x"));
3142
3
  }
3143
3144
3
  rc = dissect_gsm_apdu(ins, p1, p2, p3, extended_len, next_tvb, offset, pinfo, tree, sim_tree, gsm_sim_trans);
3145
3146
3
  if (rc == -1) {
3147
    /* default dissector */
3148
0
    offset += 2; /* P1 and P2 already handled */
3149
0
    if (p3_present) {
3150
0
      if (isSIMtrace) {
3151
        /* For SIMtrace it's not possible to know if the APDU contains
3152
         * command "Lc Data" or command "Le" with response "Data".
3153
         */
3154
0
        proto_tree_add_item(sim_tree, hf_apdu_p3, tvb, offset,
3155
0
                extended_len ? 3 : 1, ENC_BIG_ENDIAN);
3156
0
        offset += (extended_len ? 3 : 1);
3157
0
      } else if (tvb_reported_length_remaining(tvb, offset) <= (extended_len ? 3U : 1U)) {
3158
        /* Case 2 / 2E */
3159
0
        dissect_apdu_le(sim_tree, tvb, offset, extended_len, true);
3160
0
        offset += (extended_len ? 3 : 1);
3161
0
      } else {
3162
        /* Case 3 / 3E */
3163
0
        dissect_apdu_lc(sim_tree, tvb, offset, extended_len);
3164
0
        offset += (extended_len ? 3 : 1);
3165
0
        proto_tree_add_item(sim_tree, hf_apdu_data, tvb, offset, p3, ENC_NA);
3166
0
        offset += p3;
3167
0
        if (tvb_reported_length_remaining(tvb, offset)) {
3168
          /* Case 4 / 4E */
3169
0
          dissect_apdu_le(sim_tree, tvb, offset, extended_len, false);
3170
0
          offset += (extended_len ? 2 : 1);
3171
0
        }
3172
0
      }
3173
0
    }
3174
3
  } else {
3175
3
    offset = rc;
3176
3
  }
3177
3178
3
  if (isSIMtrace) {
3179
2
    return dissect_rsp_apdu_tvb(tvb, offset, pinfo, tree, sim_tree);
3180
2
  }
3181
3182
1
  if (tvb_reported_length_remaining(tvb, offset)) {
3183
0
    ti = proto_tree_add_item(sim_tree, hf_apdu_unknown, tvb, offset,
3184
0
           tvb_reported_length_remaining(tvb, offset), ENC_NA);
3185
0
    expert_add_info(pinfo, ti, &ei_unknown_bytes);
3186
0
  }
3187
3188
1
  if (gsm_sim_trans && gsm_sim_trans->cmd_frame == pinfo->num && gsm_sim_trans->rsp_frame != 0) {
3189
3190
0
    if (gsm_sim_trans != gsm_sim_trans->related_trans) {
3191
0
      ti = proto_tree_add_uint(sim_tree, hf_related_to, NULL, 0, 0,
3192
0
             gsm_sim_trans->related_trans->cmd_frame);
3193
0
      proto_item_set_generated(ti);
3194
0
    }
3195
3196
0
    ti = proto_tree_add_uint(sim_tree, hf_response_in, NULL, 0, 0, gsm_sim_trans->rsp_frame);
3197
0
    proto_item_set_generated(ti);
3198
0
  }
3199
3200
1
  return offset;
3201
3
}
3202
3203
static int
3204
dissect_gsm_sim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3205
3
{
3206
3
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3207
3
  dissect_cmd_apdu_tvb(tvb, 0, pinfo, tree, true);
3208
3
  return tvb_captured_length(tvb);
3209
3
}
3210
3211
static int
3212
dissect_gsm_sim_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3213
0
{
3214
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3215
0
  dissect_cmd_apdu_tvb(tvb, 0, pinfo, tree, false);
3216
0
  return tvb_captured_length(tvb);
3217
0
}
3218
3219
static int
3220
dissect_gsm_sim_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
3221
0
{
3222
0
  col_set_str(pinfo->cinfo, COL_PROTOCOL, "GSM SIM");
3223
0
  dissect_rsp_apdu_tvb(tvb, 0, pinfo, tree, NULL);
3224
0
  return tvb_captured_length(tvb);
3225
0
}
3226
3227
static int
3228
dissect_gsm_sim_part(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
3229
0
{
3230
0
  if (pinfo->p2p_dir == P2P_DIR_SENT)
3231
0
    return dissect_gsm_sim_command(tvb, pinfo, tree, data);
3232
0
  else if (pinfo->p2p_dir == P2P_DIR_RECV)
3233
0
    return dissect_gsm_sim_response(tvb, pinfo, tree, data);
3234
3235
0
  return 0;
3236
0
}
3237
3238
void
3239
proto_register_gsm_sim(void)
3240
16
{
3241
16
  static hf_register_info hf[] = {
3242
16
    { &hf_apdu_cla_coding,
3243
16
      { "Class Coding", "gsm_sim.apdu.cla.coding",
3244
16
        FT_UINT8, BASE_HEX, VALS(apdu_cla_coding_vals), 0xf0,
3245
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3246
16
    },
3247
16
    { &hf_apdu_cla_coding_ext,
3248
16
      { "Class Coding", "gsm_sim.apdu.cla.coding",
3249
16
        FT_UINT8, BASE_HEX, VALS(apdu_cla_coding_ext_vals), 0xc0,
3250
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3251
16
    },
3252
16
    { &hf_apdu_cla_secure_messaging_ind,
3253
16
      { "Secure Messaging Indication", "gsm_sim.apdu.cla.secure_messaging_ind",
3254
16
        FT_UINT8, BASE_HEX, VALS(apdu_cla_secure_messaging_ind_vals), 0x0c,
3255
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3256
16
    },
3257
16
    { &hf_apdu_cla_secure_messaging_ind_ext,
3258
16
      { "Secure Messaging Indication", "gsm_sim.apdu.cla.secure_messaging_ind.ext",
3259
16
        FT_BOOLEAN, 8, TFS(&apdu_cla_secure_messaging_ind_ext_val), 0x20,
3260
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3261
16
    },
3262
16
    { &hf_apdu_cla_log_chan,
3263
16
      { "Logical Channel number", "gsm_sim.apdu.cla.log_chan",
3264
16
        FT_UINT8, BASE_DEC, NULL, 0x03,
3265
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3266
16
    },
3267
16
    { &hf_apdu_cla_log_chan_ext,
3268
16
      { "Logical Channel number", "gsm_sim.apdu.cla.log_chan",
3269
16
        FT_UINT8, BASE_DEC, NULL, 0x0f,
3270
16
        "ISO 7816-4 APDU CLA (Class) Byte", HFILL }
3271
16
    },
3272
16
    { &hf_apdu_ins,
3273
16
      { "Instruction", "gsm_sim.apdu.ins",
3274
16
        FT_UINT8, BASE_HEX, VALS(apdu_ins_vals), 0,
3275
16
        "ISO 7816-4 APDU INS (Instruction) Byte", HFILL }
3276
16
    },
3277
16
    { &hf_apdu_p1,
3278
16
      { "Parameter 1", "gsm_sim.apdu.p1",
3279
16
        FT_UINT8, BASE_HEX, NULL, 0,
3280
16
        "ISO 7816-4 APDU P1 (Parameter 1) Byte", HFILL }
3281
16
    },
3282
16
    { &hf_apdu_p2,
3283
16
      { "Parameter 2", "gsm_sim.apdu.p2",
3284
16
        FT_UINT8, BASE_HEX, NULL, 0,
3285
16
        "ISO 7816-4 APDU P2 (Parameter 2) Byte", HFILL }
3286
16
    },
3287
16
    { &hf_apdu_p3,
3288
16
      { "Length (Parameter 3)", "gsm_sim.apdu.p3",
3289
16
       FT_UINT24, BASE_DEC, NULL, 0,
3290
16
       "ISO 7816-4 APDU P3 (Parameter 3) Byte", HFILL }
3291
16
    },
3292
16
    { &hf_apdu_data,
3293
16
      { "APDU Payload", "gsm_sim.apdu.data",
3294
16
        FT_BYTES, BASE_NONE, NULL, 0,
3295
16
        "ISO 7816-4 APDU Data Payload", HFILL }
3296
16
    },
3297
16
    { &hf_apdu_sw,
3298
16
      { "Status Word", "gsm_sim.apdu.sw",
3299
16
        FT_UINT16, BASE_HEX, VALS(sw_vals), 0,
3300
16
        "ISO 7816-4 APDU Status Word", HFILL }
3301
16
    },
3302
16
    { &hf_apdu_unknown,
3303
16
      { "Unknown APDU Bytes", "gsm_sim.apdu.unknown",
3304
16
        FT_UINT8, BASE_HEX, NULL, 0,
3305
16
        NULL, HFILL },
3306
16
    },
3307
16
    { &hf_file_id,
3308
16
      { "File ID", "gsm_sim.file_id",
3309
16
        FT_UINT16, BASE_HEX, VALS(mf_dfs), 0,
3310
16
        "ISO 7816-4 File ID", HFILL }
3311
16
    },
3312
16
    { &hf_aid,
3313
16
      { "Application ID", "gsm_sim.aid",
3314
16
        FT_BYTES, BASE_NONE, NULL, 0,
3315
16
        "ISO 7816-4 Application ID", HFILL }
3316
16
    },
3317
16
    { &hf_bin_offset,
3318
16
      { "Offset", "gsm_sim.bin_offset",
3319
16
        FT_UINT16, BASE_DEC, NULL, 0,
3320
16
        "Offset into binary file", HFILL }
3321
16
    },
3322
16
    { &hf_referencing,
3323
16
      { "Referencing", "gsm_sim.referencing",
3324
16
        FT_UINT8, BASE_HEX, VALS(sfi_referencing_vals), 0xe0,
3325
16
        NULL, HFILL }
3326
16
    },
3327
16
    { &hf_sfi,
3328
16
      { "SFI", "gsm_sim.sfi",
3329
16
        FT_UINT8, BASE_HEX, VALS(sfi_vals), 0x1f,
3330
16
        NULL, HFILL }
3331
16
    },
3332
16
    { &hf_record_nr,
3333
16
      { "Record Number", "gsm_sim.record_nr",
3334
16
        FT_UINT8, BASE_DEC, NULL, 0,
3335
16
        NULL, HFILL }
3336
16
    },
3337
16
    { &hf_record_id,
3338
16
      { "Record Identifier", "gsm_sim.record_id",
3339
16
      FT_UINT8, BASE_DEC, NULL, 0x0,
3340
16
      NULL, HFILL },
3341
16
    },
3342
16
    { &hf_record_file,
3343
16
      { "File", "gsm_sim.record_file",
3344
16
      FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(record_file_vals), 0xF8,
3345
16
      NULL, HFILL }
3346
16
    },
3347
16
    { &hf_record_mode,
3348
16
      { "Mode", "gsm_sim.record_mode",
3349
16
      FT_UINT8, BASE_HEX, VALS(record_mode_vals), 0x07,
3350
16
      NULL, HFILL }
3351
16
    },
3352
16
    { &hf_store_data_block,
3353
16
      { "Block chaining", "gsm_sim.store_data.block_chaining",
3354
16
        FT_BOOLEAN, 8, TFS(&store_data_block_tfs), 0x80,
3355
16
        "More/Last block", HFILL }
3356
16
    },
3357
16
    { &hf_store_data_encryption,
3358
16
      { "Encryption", "gsm_sim.store_data.encryption",
3359
16
        FT_UINT8, BASE_HEX, VALS(store_data_encryption_vals), 0x60,
3360
16
        "General encryption information", HFILL }
3361
16
    },
3362
16
    { &hf_store_data_structure,
3363
16
      { "Data structure", "gsm_sim.store_data.data_structure",
3364
16
        FT_UINT8, BASE_HEX, VALS(store_data_structure_vals), 0x18,
3365
16
        "General data structure information", HFILL }
3366
16
    },
3367
16
    { &hf_store_data_rfu,
3368
16
      { "RFU", "gsm_sim.store_data.rfu",
3369
16
        FT_UINT8, BASE_HEX, NULL, 0x06,
3370
16
        "Reserved for Future Use", HFILL }
3371
16
    },
3372
16
    { &hf_store_data_iso_case,
3373
16
      { "ISO case", "gsm_sim.store_data.iso_case",
3374
16
        FT_BOOLEAN, 8, TFS(&store_data_iso_case_tfs), 0x01,
3375
16
        "ISO case 3/4 command indicator", HFILL }
3376
16
    },
3377
16
    { &hf_store_data_block_nr,
3378
16
      { "Block number", "gsm_sim.store_data.block_nr",
3379
16
        FT_UINT8, BASE_DEC, NULL, 0,
3380
16
        NULL, HFILL }
3381
16
    },
3382
16
    { &hf_auth_reference,
3383
16
      { "Reference", "gsm_sim.auth_reference",
3384
16
        FT_BOOLEAN, 8, TFS(&apdu_auth_reference_val), 0x80,
3385
16
        "Authentication Reference", HFILL }
3386
16
    },
3387
16
    { &hf_auth_rfu,
3388
16
      { "RFU", "gsm_sim.auth_rfu",
3389
16
        FT_UINT8, BASE_DEC, NULL, 0x78,
3390
16
        "Reserved for Future Use", HFILL }
3391
16
    },
3392
16
    { &hf_auth_context,
3393
16
      { "Context", "gsm_sim.auth_context",
3394
16
        FT_UINT8, BASE_DEC, VALS(apdu_auth_context_vals), 0x07,
3395
16
        "Authentication Context", HFILL }
3396
16
    },
3397
16
    { &hf_auth_challenge,
3398
16
      { "Challenge", "gsm_sim.auth_challenge",
3399
16
        FT_BYTES, BASE_NONE, NULL, 0,
3400
16
        "Authentication Challenge", HFILL }
3401
16
    },
3402
16
    { &hf_auth_response,
3403
16
      { "Response", "gsm_sim.auth_response",
3404
16
        FT_BYTES, BASE_NONE, NULL, 0,
3405
16
        "Authentication Response", HFILL }
3406
16
    },
3407
16
    { &hf_auth_rand_len,
3408
16
      { "Length of RAND", "gsm_sim.auth_rand_len",
3409
16
        FT_UINT8, BASE_DEC, NULL, 0,
3410
16
        "Length of Random Challenge", HFILL }
3411
16
    },
3412
16
    { &hf_auth_rand,
3413
16
      { "RAND", "gsm_sim.auth_rand",
3414
16
        FT_BYTES, BASE_NONE, NULL, 0,
3415
16
        "Random Challenge", HFILL }
3416
16
    },
3417
16
    { &hf_auth_autn_len,
3418
16
      { "Length of AUTN", "gsm_sim.auth_autn_len",
3419
16
        FT_UINT8, BASE_DEC, NULL, 0,
3420
16
        "Authentication Token Length", HFILL }
3421
16
    },
3422
16
    { &hf_auth_autn,
3423
16
      { "AUTN", "gsm_sim.auth_autn",
3424
16
        FT_BYTES, BASE_NONE, NULL, 0,
3425
16
        "Authentication Token", HFILL }
3426
16
    },
3427
16
    { &hf_auth_status,
3428
16
      { "Status", "gsm_sim.auth_status",
3429
16
        FT_UINT8, BASE_HEX, VALS(apdu_auth_status_vals), 0,
3430
16
        "Authentication Status", HFILL }
3431
16
    },
3432
16
    { &hf_auth_res_len,
3433
16
      { "Length of RES", "gsm_sim.auth_res_len",
3434
16
        FT_UINT8, BASE_DEC, NULL, 0,
3435
16
        "Length of Response", HFILL }
3436
16
    },
3437
16
    { &hf_auth_res,
3438
16
      { "RES", "gsm_sim.auth_res",
3439
16
        FT_BYTES, BASE_NONE, NULL, 0,
3440
16
        "Response", HFILL }
3441
16
    },
3442
16
    { &hf_auth_ck_len,
3443
16
      { "Length of CK", "gsm_sim.auth_ck_len",
3444
16
        FT_UINT8, BASE_DEC, NULL, 0,
3445
16
        NULL, HFILL }
3446
16
    },
3447
16
    { &hf_auth_ck,
3448
16
      { "CK", "gsm_sim.auth_ck",
3449
16
        FT_BYTES, BASE_NONE, NULL, 0,
3450
16
        NULL, HFILL }
3451
16
    },
3452
16
    { &hf_auth_ik_len,
3453
16
      { "Length of IK", "gsm_sim.auth_ik_len",
3454
16
        FT_UINT8, BASE_DEC, NULL, 0,
3455
16
        NULL, HFILL }
3456
16
    },
3457
16
    { &hf_auth_ik,
3458
16
      { "IK", "gsm_sim.auth_ik",
3459
16
        FT_BYTES, BASE_NONE, NULL, 0,
3460
16
        NULL, HFILL }
3461
16
    },
3462
16
    { &hf_auth_kc_len,
3463
16
      { "Length of Kc", "gsm_sim.auth_kc_len",
3464
16
        FT_UINT8, BASE_DEC, NULL, 0,
3465
16
        NULL, HFILL }
3466
16
    },
3467
16
    { &hf_auth_kc,
3468
16
      { "Kc", "gsm_sim.auth_kc",
3469
16
        FT_BYTES, BASE_NONE, NULL, 0,
3470
16
        NULL, HFILL }
3471
16
    },
3472
16
    { &hf_auth_auts_len,
3473
16
      { "Length of AUTS", "gsm_sim.auth_auts_len",
3474
16
        FT_UINT8, BASE_DEC, NULL, 0,
3475
16
        NULL, HFILL }
3476
16
    },
3477
16
    { &hf_auth_auts,
3478
16
      { "AUTS", "gsm_sim.auth_auts",
3479
16
        FT_BYTES, BASE_NONE, NULL, 0,
3480
16
        NULL, HFILL }
3481
16
    },
3482
16
    { &hf_auth_gsm_rand,
3483
16
      { "Random Challenge", "gsm_sim.auth_rand",
3484
16
        FT_BYTES, BASE_NONE, NULL, 0,
3485
16
        "GSM Authentication Random Challenge", HFILL }
3486
16
    },
3487
16
    { &hf_auth_gsm_sres_len,
3488
16
      { "Length of SRES", "gsm_sim.auth_sres_len",
3489
16
        FT_UINT8, BASE_DEC, NULL, 0,
3490
16
        NULL, HFILL }
3491
16
    },
3492
16
    { &hf_auth_gsm_sres,
3493
16
      { "SRES", "gsm_sim.auth_sres",
3494
16
        FT_BYTES, BASE_NONE, NULL, 0,
3495
16
        "GSM Authentication SRES Response", HFILL }
3496
16
    },
3497
16
    { &hf_auth_gsm_kc_len,
3498
16
      { "Length of Kc", "gsm_sim.auth_kc_len",
3499
16
        FT_UINT8, BASE_DEC, NULL, 0,
3500
16
        NULL, HFILL }
3501
16
    },
3502
16
    { &hf_auth_gsm_kc,
3503
16
      { "Kc", "gsm_sim.auth_kc",
3504
16
        FT_BYTES, BASE_NONE, NULL, 0,
3505
16
        "GSM Authentication Kc result", HFILL }
3506
16
    },
3507
16
    { &hf_chan_nr,
3508
16
      { "Channel Number", "gsm_sim.chan_nr",
3509
16
        FT_UINT8, BASE_DEC, NULL, 0,
3510
16
        "ISO 7816-4 Logical Channel Number", HFILL }
3511
16
    },
3512
16
    { &hf_apdu_le,
3513
16
      { "Maximum Length of Expected Response", "gsm_sim.apdu.le",
3514
16
        FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(apdu_le_vals), 0,
3515
16
        "ISO 7816-4 APDU Le Byte", HFILL }
3516
16
    },
3517
16
    { &hf_apdu_le_ext,
3518
16
      { "Maximum Length of Expected Response", "gsm_sim.apdu.le",
3519
16
        FT_UINT24, BASE_DEC|BASE_SPECIAL_VALS, VALS(apdu_le_vals_ext), 0,
3520
16
        "ISO 7816-4 APDU Le Bytes - Extended", HFILL }
3521
16
    },
3522
16
    { &hf_apdu_lc,
3523
16
      { "Length of Command", "gsm_sim.apdu.lc",
3524
16
        FT_UINT8, BASE_DEC, NULL, 0,
3525
16
        "ISO 7816-4 APDU Lc Byte", HFILL }
3526
16
    },
3527
16
    { &hf_apdu_lc_ext,
3528
16
      { "Length of Command", "gsm_sim.apdu.lc",
3529
16
        FT_UINT24, BASE_DEC, NULL, 0,
3530
16
        "ISO 7816-4 APDU Lc Bytes - Extended", HFILL }
3531
16
    },
3532
16
    { &hf_chan_op,
3533
16
      { "Channel Operation", "gsm_sim.chan_op",
3534
16
        FT_UINT8, BASE_HEX, VALS(chan_op_vals), 0,
3535
16
        "ISO 7816-4 Logical Channel Operation", HFILL }
3536
16
    },
3537
16
    { &hf_select_type,
3538
16
      { "Type", "gsm_sim.select.type",
3539
16
        FT_UINT8, BASE_HEX, VALS(select_type_vals), 0x00,
3540
16
        NULL, HFILL }
3541
16
    },
3542
16
    { &hf_select_rfu,
3543
16
      { "RFU", "gsm_sim.select.rfu",
3544
16
        FT_UINT8, BASE_HEX, NULL, 0x80,
3545
16
        NULL, HFILL }
3546
16
    },
3547
16
    { &hf_select_session_control,
3548
16
      { "Session Control", "gsm_sim.select.session_control",
3549
16
        FT_UINT8, BASE_HEX, VALS(select_session_control_vals), 0x60,
3550
16
        NULL, HFILL }
3551
16
    },
3552
16
    { &hf_select_unused_p2,
3553
16
      { "Unused", "gsm_sim.select.unused",
3554
16
        FT_UINT8, BASE_HEX, NULL, 0x60,
3555
16
        NULL, HFILL }
3556
16
    },
3557
16
    { &hf_select_return_data,
3558
16
      { "Return Data", "gsm_sim.select.return_data",
3559
16
        FT_UINT8, BASE_HEX, VALS(select_return_data_vals), 0x1C,
3560
16
        NULL, HFILL }
3561
16
    },
3562
16
    { &hf_select_selection,
3563
16
      { "Selection", "gsm_sim.select.selection",
3564
16
        FT_UINT8, BASE_HEX, VALS(select_selection_vals), 0x03,
3565
16
        NULL, HFILL }
3566
16
    },
3567
16
    { &hf_status_application_status,
3568
16
      { "Application Status", "gsm_sim.status.application_status",
3569
16
        FT_UINT8, BASE_HEX, VALS(status_application_status_vals), 0,
3570
16
        NULL, HFILL }
3571
16
    },
3572
16
    { &hf_status_return_data,
3573
16
      { "Return Data", "gsm_sim.status.return_data",
3574
16
        FT_UINT8, BASE_HEX, VALS(status_return_data_vals), 0,
3575
16
        NULL, HFILL }
3576
16
    },
3577
16
    { &hf_template_tag,
3578
16
      { "Template tag", "gsm_sim.template_tag",
3579
16
        FT_UINT8, BASE_HEX, VALS(template_tag_vals), 0,
3580
16
        NULL, HFILL }
3581
16
    },
3582
16
    { &hf_template_len,
3583
16
      { "Template length", "gsm_sim.template_len",
3584
16
        FT_UINT32, BASE_DEC, NULL, 0,
3585
16
        NULL, HFILL }
3586
16
    },
3587
16
    { &hf_fcp,
3588
16
      { "FCP Value", "gsm_sim.fcp",
3589
16
        FT_BYTES, BASE_NONE, NULL, 0,
3590
16
        NULL, HFILL }
3591
16
    },
3592
16
    { &hf_fcp_tag,
3593
16
      { "Tag", "gsm_sim.fcp.tag",
3594
16
        FT_UINT8, BASE_HEX, VALS(fcp_tag_vals), 0,
3595
16
        NULL, HFILL }
3596
16
    },
3597
16
    { &hf_fcp_len,
3598
16
      { "Length", "gsm_sim.fcp.len",
3599
16
        FT_UINT32, BASE_DEC, NULL, 0,
3600
16
        NULL, HFILL }
3601
16
    },
3602
16
    { &hf_fcp_value,
3603
16
      { "Value", "gsm_sim.fcp.value",
3604
16
        FT_BYTES, BASE_NONE, NULL, 0,
3605
16
        NULL, HFILL }
3606
16
    },
3607
16
    { &hf_fcp_file_size,
3608
16
      { "File size", "gsm_sim.fcp.file_size",
3609
16
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3610
16
        "File size (excluding structural information)", HFILL }
3611
16
    },
3612
16
    { &hf_fcp_total_file_size,
3613
16
      { "Total file size", "gsm_sim.fcp.total_file_size",
3614
16
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3615
16
        "Total file size (including structural information)", HFILL }
3616
16
    },
3617
16
    { &hf_fcp_file_id,
3618
16
      { "File Identifier", "gsm_sim.fcp.file_id",
3619
16
        FT_UINT16, BASE_HEX, VALS(mf_dfs), 0,
3620
16
        NULL, HFILL }
3621
16
    },
3622
16
    { &hf_fcp_df_name,
3623
16
      { "DF name (AID)", "gsm_sim.fcp.aid",
3624
16
        FT_BYTES, BASE_NONE, NULL, 0,
3625
16
        "Application Identifier", HFILL }
3626
16
    },
3627
16
    { &hf_fcp_file_rfu_byte,
3628
16
      { "RFU", "gsm_sim.fcp.file_rfu_byte",
3629
16
        FT_UINT8, BASE_HEX, NULL, 0,
3630
16
        NULL, HFILL }
3631
16
    },
3632
16
    { &hf_fcp_file_rfu,
3633
16
      { "RFU", "gsm_sim.fcp.file_rfu",
3634
16
        FT_BOOLEAN, 8, NULL, 0x80,
3635
16
        NULL, HFILL }
3636
16
    },
3637
16
    { &hf_fcp_file_accessibility,
3638
16
      { "File accessibility", "gsm_sim.fcp.file_accessibility",
3639
16
        FT_BOOLEAN, 8, TFS(&fcp_file_accessibility_tfs), 0x40,
3640
16
        NULL, HFILL }
3641
16
    },
3642
16
    { &hf_fcp_file_type,
3643
16
      { "File type", "gsm_sim.fcp.file_type",
3644
16
        FT_UINT8, BASE_HEX, VALS(fcp_file_type_vals), 0x38,
3645
16
        NULL, HFILL }
3646
16
    },
3647
16
    { &hf_fcp_file_type_ext,
3648
16
      { "File type", "gsm_sim.fcp.file_type",
3649
16
        FT_UINT8, BASE_HEX, VALS(fcp_file_type_ext_vals), 0x3F,
3650
16
        NULL, HFILL }
3651
16
    },
3652
16
    { &hf_fcp_ef_structure,
3653
16
      { "EF structure", "gsm_sim.fcp.ef_structure",
3654
16
        FT_UINT8, BASE_HEX, VALS(fcp_ef_structure_vals), 0x07,
3655
16
        NULL, HFILL }
3656
16
    },
3657
16
    { &hf_fcp_ef_structure_ext,
3658
16
      { "EF structure", "gsm_sim.fcp.ef_structure",
3659
16
        FT_UINT8, BASE_HEX, VALS(fcp_ef_structure_ext_vals), 0x3F,
3660
16
        NULL, HFILL }
3661
16
    },
3662
16
    { &hf_fcp_data_coding_byte,
3663
16
      { "Data coding byte", "gsm_sim.fcp.data_coding_byte",
3664
16
        FT_UINT8, BASE_HEX, NULL, 0,
3665
16
        NULL, HFILL }
3666
16
    },
3667
16
    { &hf_fcp_record_len,
3668
16
      { "Record length", "gsm_sim.fcp.record_len",
3669
16
        FT_UINT16, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3670
16
        NULL, HFILL }
3671
16
    },
3672
16
    { &hf_fcp_num_records,
3673
16
      { "Number of records", "gsm_sim.fcp.num_records",
3674
16
        FT_UINT8, BASE_DEC, NULL, 0,
3675
16
        NULL, HFILL }
3676
16
    },
3677
16
    { &hf_fcp_lifecycle_status,
3678
16
      { "Life Cycle Status Integer", "gsm_sim.fcp.lifecycle_status",
3679
16
        FT_UINT8, BASE_HEX|BASE_RANGE_STRING, RVALS(fcp_lifecycle_status_vals), 0,
3680
16
        NULL, HFILL }
3681
16
    },
3682
16
    { &hf_fcp_security_attr_compact,
3683
16
      { "Security attributes (Compact)", "gsm_sim.fcp.security_attr_compact",
3684
16
        FT_BYTES, BASE_NONE, NULL, 0,
3685
16
        NULL, HFILL }
3686
16
    },
3687
16
    { &hf_fcp_security_attr_expanded,
3688
16
      { "Security attributes (Expanded)", "gsm_sim.fcp.security_attr_expanded",
3689
16
        FT_BYTES, BASE_NONE, NULL, 0,
3690
16
        NULL, HFILL }
3691
16
    },
3692
16
    { &hf_fcp_security_attr_referenced,
3693
16
      { "Security attributes (Referenced)", "gsm_sim.fcp.security_attr_referenced",
3694
16
        FT_BYTES, BASE_NONE, NULL, 0,
3695
16
        NULL, HFILL }
3696
16
    },
3697
16
    { &hf_fcp_pin_status_do,
3698
16
      { "PIN Status DO", "gsm_sim.fcp.pin_status_do",
3699
16
        FT_BYTES, BASE_NONE, NULL, 0,
3700
16
        NULL, HFILL }
3701
16
    },
3702
16
    { &hf_fcp_sfi,
3703
16
      { "Short File Identifier", "gsm_sim.fcp.sfi",
3704
16
        FT_UINT8, BASE_DEC, NULL, 0,
3705
16
        NULL, HFILL }
3706
16
    },
3707
16
    { &hf_fcp_prop,
3708
16
      { "Proprietary", "gsm_sim.fcp.prop",
3709
16
        FT_BYTES, BASE_NONE, NULL, 0,
3710
16
        NULL, HFILL }
3711
16
    },
3712
16
    { &hf_fcp_prop_tag,
3713
16
      { "Proprietary Tag", "gsm_sim.fcp.prop.tag",
3714
16
        FT_UINT8, BASE_HEX, VALS(fcp_prop_tag_vals), 0,
3715
16
        NULL, HFILL }
3716
16
    },
3717
16
    { &hf_fcp_prop_len,
3718
16
      { "Proprietary Length", "gsm_sim.fcp.prop.len",
3719
16
        FT_UINT32, BASE_DEC, NULL, 0,
3720
16
        NULL, HFILL }
3721
16
    },
3722
16
    { &hf_fcp_prop_value,
3723
16
      { "Proprietary Value", "gsm_sim.fcp.prop.value",
3724
16
        FT_BYTES, BASE_NONE, NULL, 0,
3725
16
        NULL, HFILL }
3726
16
    },
3727
16
    { &hf_fcp_prop_uicc_clock_stop_allowed,
3728
16
      { "Clock stop allowed", "gsm_sim.fcp.prop.uicc_clock_stop_allowed",
3729
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x01,
3730
16
        NULL, HFILL }
3731
16
    },
3732
16
    { &hf_fcp_prop_uicc_clock_stop_rfu,
3733
16
      { "RFU", "gsm_sim.fcp.prop.uicc_clock_stop_rfu",
3734
16
        FT_UINT8, BASE_DEC, NULL, 0x02,
3735
16
        NULL, HFILL }
3736
16
    },
3737
16
    { &hf_fcp_prop_uicc_clock_stop_0,
3738
16
      { "Clock stop", "gsm_sim.fcp.prop.uicc_clock_stop_0",
3739
16
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_clock_stop_0_vals), 0x0C,
3740
16
        NULL, HFILL }
3741
16
    },
3742
16
    { &hf_fcp_prop_uicc_clock_stop_1,
3743
16
      { "Clock stop", "gsm_sim.fcp.prop.uicc_clock_stop_1",
3744
16
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_clock_stop_1_vals), 0x0C,
3745
16
        NULL, HFILL }
3746
16
    },
3747
16
    { &hf_fcp_prop_uicc_supply_voltage_a,
3748
16
      { "Supply voltage class A", "gsm_sim.fcp.prop.uicc_supply_voltage_a",
3749
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3750
16
        NULL, HFILL }
3751
16
    },
3752
16
    { &hf_fcp_prop_uicc_supply_voltage_b,
3753
16
      { "Supply voltage class B", "gsm_sim.fcp.prop.uicc_supply_voltage_b",
3754
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x20,
3755
16
        NULL, HFILL }
3756
16
    },
3757
16
    { &hf_fcp_prop_uicc_supply_voltage_c,
3758
16
      { "Supply voltage class C", "gsm_sim.fcp.prop.uicc_supply_voltage_c",
3759
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
3760
16
        NULL, HFILL }
3761
16
    },
3762
16
    { &hf_fcp_prop_uicc_supply_voltage_d,
3763
16
      { "Supply voltage class D", "gsm_sim.fcp.prop.uicc_supply_voltage_d",
3764
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
3765
16
        NULL, HFILL }
3766
16
    },
3767
16
    { &hf_fcp_prop_app_supply_voltage_class,
3768
16
      { "Supply voltage class", "gsm_sim.fcp.prop.app_supply_voltage_class",
3769
16
        FT_UINT8, BASE_HEX, VALS(supply_voltage_class_vals), 0,
3770
16
        NULL, HFILL }
3771
16
    },
3772
16
    { &hf_fcp_prop_app_power_consumption,
3773
16
      { "Application power consumption", "gsm_sim.fcp.prop.app_power_consumption",
3774
16
        FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliamps), 0,
3775
16
        NULL, HFILL }
3776
16
    },
3777
16
    { &hf_fcp_prop_app_frequency,
3778
16
      { "Power consumption frequency", "gsm_sim.fcp.prop.app_frequency",
3779
16
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
3780
16
        NULL, HFILL }
3781
16
    },
3782
16
    { &hf_fcp_prop_min_app_clock_freq,
3783
16
      { "Minimum application clock frequency", "gsm_sim.fcp.prop.min_app_clock_freq",
3784
16
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
3785
16
        NULL, HFILL }
3786
16
    },
3787
16
    { &hf_fcp_prop_avail_memory,
3788
16
      { "Available memory", "gsm_sim.fcp.prop.avail_memory",
3789
16
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3790
16
        NULL, HFILL }
3791
16
    },
3792
16
    { &hf_fcp_prop_file_details_der_encoding,
3793
16
      { "DER encoding only", "gsm_sim.fcp.prop.file_details.der_encoding",
3794
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3795
16
        NULL, HFILL }
3796
16
    },
3797
16
    { &hf_fcp_prop_file_details_rfu,
3798
16
      { "RFU", "gsm_sim.fcp.prop.file_details.rfu",
3799
16
        FT_UINT8, BASE_HEX, NULL, 0xFE,
3800
16
        NULL, HFILL }
3801
16
    },
3802
16
    { &hf_fcp_prop_reserved_file_size,
3803
16
      { "Reserved file size", "gsm_sim.fcp.prop.reserved_file_size",
3804
16
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3805
16
        NULL, HFILL }
3806
16
    },
3807
16
    { &hf_fcp_prop_max_file_size,
3808
16
      { "Maximum file size", "gsm_sim.fcp.prop.max_file_size",
3809
16
        FT_UINT32, BASE_DEC|BASE_UNIT_STRING, UNS(&units_byte_bytes), 0,
3810
16
        NULL, HFILL }
3811
16
    },
3812
16
    { &hf_fcp_prop_supported_sys_cmds_terminal_capability,
3813
16
      { "TERMINAL CAPABILITY", "gsm_sim.fcp.prop.supported_sys_cmds.terminal_capability",
3814
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3815
16
        NULL, HFILL }
3816
16
    },
3817
16
    { &hf_fcp_prop_supported_sys_cmds_rfu,
3818
16
      { "RFU", "gsm_sim.fcp.prop.supported_sys_cmds.rfu",
3819
16
        FT_UINT8, BASE_HEX, NULL, 0xFE,
3820
16
        NULL, HFILL }
3821
16
    },
3822
16
    { &hf_fcp_prop_uicc_env_conditions_temp_class,
3823
16
      { "Temperature class", "gsm_sim.fcp.prop.uicc_env_conditions.temperature_class",
3824
16
        FT_UINT8, BASE_HEX, VALS(fcp_uicc_env_conditions_temp_class_vals), 0x07,
3825
16
        NULL, HFILL }
3826
16
    },
3827
16
    { &hf_fcp_prop_uicc_env_conditions_high_humidity,
3828
16
      { "High humidity", "gsm_sim.fcp.prop.uicc_env_conditions.high_humidity",
3829
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3830
16
        NULL, HFILL }
3831
16
    },
3832
16
    { &hf_fcp_prop_uicc_env_conditions_rfu,
3833
16
      { "RFU", "gsm_sim.fcp.prop.uicc_env_conditions.rfu",
3834
16
        FT_UINT8, BASE_HEX, NULL, 0xF0,
3835
16
        NULL, HFILL }
3836
16
    },
3837
16
    { &hf_fcp_prop_platform_to_platform_cat_secured_apdu,
3838
16
      { "Platform to Platform CAT Secured APDU", "gsm_sim.fcp.prop.platform_to_platform_cat_secured_apdu",
3839
16
        FT_BYTES, BASE_NONE, NULL, 0,
3840
16
        NULL, HFILL }
3841
16
    },
3842
16
    { &hf_fcp_prop_test_config_state,
3843
16
      { "Test configuration state", "gsm_sim.fcp.prop.test_config_state",
3844
16
        FT_BYTES, BASE_NONE, NULL, 0,
3845
16
        NULL, HFILL }
3846
16
    },
3847
16
    { &hf_fcp_prop_test_config_criterion_type,
3848
16
      { "Test configuration criterion type", "gsm_sim.fcp.prop.test_config_criterion_type",
3849
16
        FT_BYTES, BASE_NONE, NULL, 0,
3850
16
        NULL, HFILL }
3851
16
    },
3852
16
    { &hf_suspend_uicc_op,
3853
16
      { "Suspend Operation", "gsm_sim.suspend_uicc.op",
3854
16
        FT_UINT8, BASE_HEX, VALS(suspend_uicc_vals), 0,
3855
16
        "ISO 7816-4 Suspend UICC Operation", HFILL }
3856
16
    },
3857
16
    { &hf_suspend_uicc_min_time_unit,
3858
16
      { "Minimum Time Unit", "gsm_sim.suspend_uicc.min_time_unit",
3859
16
        FT_UINT8, BASE_HEX, VALS(suspend_time_unit_vals), 0,
3860
16
        NULL, HFILL }
3861
16
    },
3862
16
    { &hf_suspend_uicc_min_time_length,
3863
16
      { "Minimum Length of Time", "gsm_sim.suspend_uicc.min_time_length",
3864
16
        FT_UINT8, BASE_DEC, NULL, 0,
3865
16
        "Length of time, expressed in units", HFILL }
3866
16
    },
3867
16
    { &hf_suspend_uicc_max_time_unit,
3868
16
      { "Maximum Time Unit", "gsm_sim.suspend_uicc.max_time_unit",
3869
16
        FT_UINT8, BASE_HEX, VALS(suspend_time_unit_vals), 0,
3870
16
        NULL, HFILL }
3871
16
    },
3872
16
    { &hf_suspend_uicc_max_time_length,
3873
16
      { "Maximum Length of Time", "gsm_sim.suspend_uicc.max_time_length",
3874
16
        FT_UINT8, BASE_DEC, NULL, 0,
3875
16
        "Length of time, expressed in units", HFILL }
3876
16
    },
3877
16
    { &hf_suspend_uicc_resume_token,
3878
16
      { "Resume Token", "gsm_sim.suspend_uicc.resume_token",
3879
16
        FT_BYTES, BASE_NONE, NULL, 0,
3880
16
        NULL, HFILL }
3881
16
    },
3882
3883
    /* Terminal Profile Byte 1 */
3884
16
    { &hf_tprof_b1,
3885
16
      { "Terminal Profile Byte 1 (Download)", "gsm_sim.tp.b1",
3886
16
        FT_UINT8, BASE_HEX, NULL, 0,
3887
16
        NULL, HFILL },
3888
16
    },
3889
16
    { &hf_tp_prof_dld,
3890
16
      { "Profile Download", "gsm_sim.tp.prof_dld",
3891
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3892
16
        "TP Profile Download", HFILL }
3893
16
    },
3894
16
    { &hf_tp_sms_data_dld,
3895
16
      { "SMS-PP Data Download", "gsm_sim.tp.sms_data_dld",
3896
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3897
16
        "TP SMS-PP Data Download", HFILL }
3898
16
    },
3899
16
    { &hf_tp_cb_data_dld,
3900
16
      { "CB Data Download", "gsm_sim.tp.cb_data_dld",
3901
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
3902
16
        "TP Cell Broadcast Data Download", HFILL }
3903
16
    },
3904
16
    { &hf_tp_menu_sel,
3905
16
      { "Menu Selection", "gsm_sim.tp.menu_sel",
3906
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3907
16
        "TP Menu Selection", HFILL }
3908
16
    },
3909
16
    { &hf_tp_sms_data_dld_support,
3910
16
      { "SMS-PP data download is supported", "gsm_sim.tp.sms_data_dld_support",
3911
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3912
16
        "TP SMS-PP data download is supported", HFILL }
3913
16
    },
3914
16
    { &hf_tp_timer_exp,
3915
16
      { "Timer expiration", "gsm_sim.tp.timer_exp",
3916
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3917
16
        "TP Timer expiration", HFILL }
3918
16
    },
3919
16
    { &hf_tp_cc_sim_support,
3920
16
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3921
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x40,
3922
16
        "TP Call Control by USIM is supported", HFILL }
3923
16
    },
3924
16
    { &hf_tp_cc_sim_support2,
3925
16
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3926
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
3927
16
        "TP Call Control by USIM is supported", HFILL }
3928
16
    },
3929
3930
    /* Terminal Profile Byte 2 */
3931
16
    { &hf_tprof_b2,
3932
16
      { "Terminal Profile Byte 2 (Other)", "gsm_sim.tp.b2",
3933
16
        FT_UINT8, BASE_HEX, NULL, 0,
3934
16
        NULL, HFILL },
3935
16
    },
3936
16
    { &hf_tp_cmd_res,
3937
16
      { "Command result", "gsm_sim.tp.cmd_res",
3938
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3939
16
        "TP Command result", HFILL }
3940
16
    },
3941
16
    { &hf_tp_cc_sim,
3942
16
      { "Call Control by USIM", "gsm_sim.tp.cc_sim",
3943
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3944
16
        "TP Call Control by SIM", HFILL }
3945
16
    },
3946
16
    { &hf_tp_cc_sim_support3,
3947
16
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3948
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x04,
3949
16
        "TP Call Control by USIM is supported", HFILL }
3950
16
    },
3951
16
    { &hf_tp_mo_sms_sim,
3952
16
      { "MO SMS control by SIM", "gsm_sim.tp.mo_sms_sim",
3953
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
3954
16
        "TP MO short message control by SIM", HFILL }
3955
16
    },
3956
16
    { &hf_tp_cc_sim_support4,
3957
16
      { "Call Control by USIM is supported", "gsm_sim.tp.cc_sim_support",
3958
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x10,
3959
16
        "TP Call Control by USIM is supported", HFILL }
3960
16
    },
3961
16
    { &hf_tp_ucs2_entry,
3962
16
      { "UCS2 Entry", "gsm_sim.tp.ucs2_entry",
3963
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
3964
16
        "TP UCS2 Entry", HFILL }
3965
16
    },
3966
16
    { &hf_tp_ucs2_display,
3967
16
      { "UCS2 Display", "gsm_sim.tp.ucs2_display",
3968
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
3969
16
        "TP UCS2 Display", HFILL }
3970
16
    },
3971
16
    { &hf_tp_display_ext,
3972
16
      { "Display of Extension Text", "gsm_sim.tp.display_ext",
3973
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
3974
16
        "TP Display of the Extension Text", HFILL }
3975
16
    },
3976
3977
    /* Terminal Profile Byte 3 */
3978
16
    { &hf_tprof_b3,
3979
16
      { "Terminal Profile Byte 3 (Proactive SIM)", "gsm_sim.tp.b3",
3980
16
        FT_UINT8, BASE_HEX, NULL, 0,
3981
16
        NULL, HFILL },
3982
16
    },
3983
16
    { &hf_tp_pa_display_text,
3984
16
      { "Proactive SIM: DISPLAY TEXT", "gsm_sim.tp.pa.display_text",
3985
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
3986
16
        NULL, HFILL }
3987
16
    },
3988
16
    { &hf_tp_pa_get_inkey,
3989
16
      { "Proactive SIM: GET INKEY", "gsm_sim.tp.pa.get_inkey",
3990
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
3991
16
        NULL, HFILL }
3992
16
    },
3993
16
    { &hf_tp_pa_get_input,
3994
16
      { "Proactive SIM: GET INPUT", "gsm_sim.tp.pa.get_input",
3995
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
3996
16
        NULL, HFILL }
3997
16
    },
3998
16
    { &hf_tp_pa_more_time,
3999
16
      { "Proactive SIM: MORE TIME", "gsm_sim.tp.pa.more_time",
4000
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4001
16
        NULL, HFILL }
4002
16
    },
4003
16
    { &hf_tp_pa_play_tone,
4004
16
      { "Proactive SIM: PLAY TONE", "gsm_sim.tp.pa.play_tone",
4005
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4006
16
        NULL, HFILL }
4007
16
    },
4008
16
    { &hf_tp_pa_poll_intv,
4009
16
      { "Proactive SIM: POLL INTERVAL", "gsm_sim.tp.pa.poll_intv",
4010
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4011
16
        NULL, HFILL }
4012
16
    },
4013
16
    { &hf_tp_pa_polling_off,
4014
16
      { "Proactive SIM: POLLING OFF", "gsm_sim.tp.pa.polling_off",
4015
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4016
16
        NULL, HFILL }
4017
16
    },
4018
16
    { &hf_tp_pa_refresh,
4019
16
      { "Proactive SIM: REFRESH", "gsm_sim.tp.pa.refresh",
4020
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4021
16
        NULL, HFILL }
4022
16
    },
4023
4024
    /* Terminal Profile Byte 4 */
4025
16
    { &hf_tprof_b4,
4026
16
      { "Terminal Profile Byte 4 (Proactive SIM)", "gsm_sim.tp.b4",
4027
16
        FT_UINT8, BASE_HEX, NULL, 0,
4028
16
        NULL, HFILL },
4029
16
    },
4030
16
    { &hf_tp_pa_select_item,
4031
16
      { "Proactive SIM: SELECT ITEM", "gsm_sim.tp.pa.select_item",
4032
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4033
16
        NULL, HFILL }
4034
16
    },
4035
16
    { &hf_tp_pa_send_sms,
4036
16
      { "Proactive SIM: SEND SHORT MESSAGE", "gsm_sim.tp.pa.send_sms",
4037
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4038
16
        NULL, HFILL }
4039
16
    },
4040
16
    { &hf_tp_pa_send_ss,
4041
16
      { "Proactive SIM: SEND SS", "gsm_sim.tp.pa.send_ss",
4042
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4043
16
        NULL, HFILL }
4044
16
    },
4045
16
    { &hf_tp_pa_send_ussd,
4046
16
      { "Proactive SIM: SEND USSD", "gsm_sim.tp.pa.send_ussd",
4047
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4048
16
        NULL, HFILL }
4049
16
    },
4050
16
    { &hf_tp_pa_set_up_call,
4051
16
      { "Proactive SIM: SET UP CALL", "gsm_sim.tp.pa.set_up_call",
4052
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4053
16
        NULL, HFILL }
4054
16
    },
4055
16
    { &hf_tp_pa_set_up_menu,
4056
16
      { "Proactive SIM: SET UP MENU", "gsm_sim.tp.pa.set_up_menu",
4057
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4058
16
        NULL, HFILL }
4059
16
    },
4060
16
    { &hf_tp_pa_prov_loci,
4061
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION", "gsm_sim.tp.pa.prov_loci",
4062
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4063
16
        NULL, HFILL }
4064
16
    },
4065
16
    { &hf_tp_pa_prov_loci_nmr,
4066
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR)", "gsm_sim.tp.pa.prov_loci_nmr",
4067
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4068
16
        NULL, HFILL }
4069
16
    },
4070
4071
    /* Terminal Profile Byte 5 */
4072
16
    { &hf_tprof_b5,
4073
16
      { "Terminal Profile Byte 5 (Event driven information)", "gsm_sim.tp.b5",
4074
16
        FT_UINT8, BASE_HEX, NULL, 0,
4075
16
        NULL, HFILL },
4076
16
    },
4077
16
    { &hf_tp_pa_evt_list,
4078
16
      { "Proactive SIM: SET UP EVENT LIST", "gsm_sim.tp.pa.set_up_evt_list",
4079
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4080
16
        NULL, HFILL }
4081
16
    },
4082
16
    { &hf_tp_ev_mt_call,
4083
16
      { "Event: MT call", "gsm_sim.tp.evt.mt_call",
4084
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4085
16
        NULL, HFILL }
4086
16
    },
4087
16
    { &hf_tp_ev_call_connected,
4088
16
      { "Event: Call connected", "gsm_sim.tp.evt.call_conn",
4089
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4090
16
        NULL, HFILL }
4091
16
    },
4092
16
    { &hf_tp_ev_call_disconnected,
4093
16
      { "Event: Call disconnected", "gsm_sim.tp.evt.call_disc",
4094
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4095
16
        NULL, HFILL }
4096
16
    },
4097
16
    { &hf_tp_ev_location_status,
4098
16
      { "Event: Location status", "gsm_sim.tp.evt.loc_status",
4099
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4100
16
        NULL, HFILL }
4101
16
    },
4102
16
    { &hf_tp_ev_user_activity,
4103
16
      { "Event: User activity", "gsm_sim.tp.evt.user_activity",
4104
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4105
16
        NULL, HFILL }
4106
16
    },
4107
16
    { &hf_tp_ev_idle_screen,
4108
16
      { "Event: Idle screen available", "gsm_sim.tp.evt.idle_screen",
4109
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4110
16
        NULL, HFILL }
4111
16
    },
4112
16
    { &hf_tp_ev_cardreader_status,
4113
16
      { "Event: Card reader status", "gsm_sim.tp.evt.card_status",
4114
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4115
16
        NULL, HFILL }
4116
16
    },
4117
4118
    /* Terminal Profile Byte 6 */
4119
16
    { &hf_tprof_b6,
4120
16
      { "Terminal Profile Byte 6 (Event driven information extension)", "gsm_sim.tp.b6",
4121
16
        FT_UINT8, BASE_HEX, NULL, 0,
4122
16
        NULL, HFILL },
4123
16
    },
4124
16
    { &hf_tp_ev_lang_sel,
4125
16
      { "Event: Language Selection", "gsm_sim.tp.evt.lang_sel",
4126
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4127
16
        NULL, HFILL }
4128
16
    },
4129
16
    { &hf_tp_ev_brows_term,
4130
16
      { "Event: Browser Termination", "gsm_sim.tp.evt.brows_term",
4131
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4132
16
        NULL, HFILL }
4133
16
    },
4134
16
    { &hf_tp_ev_data_avail,
4135
16
      { "Event: Data Available", "gsm_sim.tp.evt.data_avail",
4136
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4137
16
        NULL, HFILL }
4138
16
    },
4139
16
    { &hf_tp_ev_chan_status,
4140
16
      { "Event: Channel Status", "gsm_sim.tp.evt.chan_status",
4141
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4142
16
        NULL, HFILL }
4143
16
    },
4144
16
    { &hf_tp_ev_access_techno_change,
4145
16
      { "Event: Access Technology Change", "gsm_sim.tp.evt.access_techno_change",
4146
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4147
16
        NULL, HFILL }
4148
16
    },
4149
16
    { &hf_tp_ev_disp_params_changed,
4150
16
      { "Event: Display parameters changed", "gsm_sim.tp.evt.disp_params_changed",
4151
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4152
16
        NULL, HFILL }
4153
16
    },
4154
16
    { &hf_tp_ev_local_conn,
4155
16
      { "Event: Local Connection", "gsm_sim.tp.evt.local_conn",
4156
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4157
16
        NULL, HFILL }
4158
16
    },
4159
16
    { &hf_tp_ev_nwk_search_mode_change,
4160
16
      { "Event: Network Search Mode Change", "gsm_sim.tp.evt.nwk_search_mode_change",
4161
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4162
16
        NULL, HFILL }
4163
16
    },
4164
4165
    /* Terminal Profile Byte 7 */
4166
16
    { &hf_tprof_b7,
4167
16
      { "Terminal Profile Byte 7 (Multiple card proactive commands)", "gsm_sim.tp.b7",
4168
16
        FT_UINT8, BASE_HEX, NULL, 0,
4169
16
        NULL, HFILL },
4170
16
    },
4171
16
    { &hf_tp_pa_power_on,
4172
16
      { "Proactive SIM: POWER ON CARD", "gsm_sim.tp.pa.power_on_card",
4173
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4174
16
        NULL, HFILL }
4175
16
    },
4176
16
    { &hf_tp_pa_power_off,
4177
16
      { "Proactive SIM: POWER OFF CARD", "gsm_sim.tp.pa.power_off_card",
4178
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4179
16
        NULL, HFILL }
4180
16
    },
4181
16
    { &hf_tp_pa_perform_card_apdu,
4182
16
      { "Proactive SIM: PERFORM CARD APDU", "gsm_sim.tp.pa.perf_card_apdu",
4183
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4184
16
        NULL, HFILL }
4185
16
    },
4186
16
    { &hf_tp_pa_get_reader_status,
4187
16
      { "Proactive SIM: GET READER STATUS (status)", "gsm_sim.tp.pa.get_rdr_status",
4188
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4189
16
        NULL, HFILL }
4190
16
    },
4191
16
    { &hf_tp_pa_get_reader_status_id,
4192
16
      { "Proactive SIM: GET READER STATUS (identifier)", "gsm_sim.tp.pa.get_rdr_status_id",
4193
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4194
16
        NULL, HFILL }
4195
16
    },
4196
16
    { &hf_tp_rfu,
4197
16
      { "RFU", "gsm_sim.tp.rfu",
4198
16
        FT_UINT8, BASE_HEX, NULL, 0xe0,
4199
16
        NULL, HFILL },
4200
16
    },
4201
4202
    /* Terminal Profile Byte 8 */
4203
16
    { &hf_tprof_b8,
4204
16
      { "Terminal Profile Byte 8 (Proactive SIM)", "gsm_sim.tp.b8",
4205
16
        FT_UINT8, BASE_HEX, NULL, 0,
4206
16
        NULL, HFILL },
4207
16
    },
4208
16
    { &hf_tp_pa_timer_start_stop,
4209
16
      { "Proactive SIM: TIMER MANAGEMENT (start, stop)", "gsm_sim.tp.pa.timer_start_stop",
4210
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4211
16
        NULL, HFILL }
4212
16
    },
4213
16
    { &hf_tp_pa_timer_get_current,
4214
16
      { "Proactive SIM: TIMER MANAGEMENT (get current value)", "gsm_sim.tp.pa.timer_get_current",
4215
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4216
16
        NULL, HFILL }
4217
16
    },
4218
16
    { &hf_tp_pa_prov_loci_date_tz,
4219
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (date, time, tz)", "gsm_sim.tp.pa.prov_loci_date",
4220
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4221
16
        NULL, HFILL }
4222
16
    },
4223
16
    { &hf_tp_pa_get_inkey_binary,
4224
16
      { "Proactive SIM: GET INKEY", "gsm_sim.tp.pa.get_inkey_bin",
4225
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4226
16
        NULL, HFILL }
4227
16
    },
4228
16
    { &hf_tp_pa_set_up_idle_mode_text,
4229
16
      { "Proactive SIM: SET UP IDLE MODE TEXT", "gsm_sim.tp.pa.set_up_idle_text",
4230
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4231
16
        NULL, HFILL }
4232
16
    },
4233
16
    { &hf_tp_pa_run_at_command,
4234
16
      { "Proactive SIM: RUN AT COMMAND", "gsm_sim.tp.pa.run_at_command",
4235
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4236
16
        NULL, HFILL }
4237
16
    },
4238
16
    { &hf_tp_pa_2nd_alpha_setup_call,
4239
16
      { "Proactive SIM: SETUP CALL", "gsm_sim.tp.pa.2nd_alpha_id",
4240
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4241
16
        NULL, HFILL }
4242
16
    },
4243
16
    { &hf_tp_pa_2nd_cc_sim_support,
4244
16
      { "Proactive SIM: Call Control by USIM is supported", "gsm_sim.tp.pa.cc_sim_support",
4245
16
        FT_BOOLEAN, 8, TFS(&tfs_yes_no), 0x80,
4246
16
        NULL, HFILL }
4247
16
    },
4248
4249
    /* Terminal Profile Byte 9 */
4250
16
    { &hf_tprof_b9,
4251
16
      { "Terminal Profile Byte 9", "gsm_sim.tp.b9",
4252
16
        FT_UINT8, BASE_HEX, NULL, 0,
4253
16
        NULL, HFILL },
4254
16
    },
4255
16
    { &hf_tp_display_text,
4256
16
      { "DISPLAY TEXT", "gsm_sim.tp.display_text",
4257
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4258
16
        NULL, HFILL }
4259
16
    },
4260
16
    { &hf_tp_send_dtmf_cmd,
4261
16
      { "SEND DTMF command", "gsm_sim.tp.send_dtmf_cmd",
4262
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4263
16
        NULL, HFILL }
4264
16
    },
4265
16
    { &hf_tp_pa_prov_loci_nmr2,
4266
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR)", "gsm_sim.tp.pa.prov_loci_nmr",
4267
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4268
16
        NULL, HFILL }
4269
16
    },
4270
16
    { &hf_tp_pa_prov_loci_lang,
4271
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (language)", "gsm_sim.tp.pa.prov_loci_lang",
4272
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4273
16
        NULL, HFILL }
4274
16
    },
4275
16
    { &hf_tp_pa_prov_loci_ta,
4276
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Timing Advance)", "gsm_sim.tp.pa.prov_loci_ta",
4277
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4278
16
        NULL, HFILL }
4279
16
    },
4280
16
    { &hf_tp_pa_lang_notif,
4281
16
      { "Proactive SIM: LANGUAGE NOTIFICATION", "gsm_sim.tp.pa.lang_notif",
4282
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4283
16
        NULL, HFILL }
4284
16
    },
4285
16
    { &hf_tp_pa_launch_browser,
4286
16
      { "Proactive SIM: LAUNCH BROWSER", "gsm_sim.tp.pa.launch_browser",
4287
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4288
16
        NULL, HFILL }
4289
16
    },
4290
16
    { &hf_tp_pa_prov_loci_access_techno,
4291
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Access Technology)", "gsm_sim.tp.pa.prov_loci_access_techno",
4292
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4293
16
        NULL, HFILL }
4294
16
    },
4295
4296
    /* Terminal Profile Byte 10 */
4297
16
    { &hf_tprof_b10,
4298
16
      { "Terminal Profile Byte 10 (Soft keys support)", "gsm_sim.tp.b10",
4299
16
        FT_UINT8, BASE_HEX, NULL, 0,
4300
16
        NULL, HFILL },
4301
16
    },
4302
16
    { &hf_tp_soft_key_support_select_item,
4303
16
      { "Soft keys support for SELECT ITEM", "gsm_sim.tp.soft_key_support.select_item",
4304
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4305
16
        NULL, HFILL }
4306
16
    },
4307
16
    { &hf_tp_soft_key_support_set_up_menu,
4308
16
      { "Soft Keys support for SET UP MENU", "gsm_sim.tp.soft_key_support.set_up_menu",
4309
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4310
16
        NULL, HFILL }
4311
16
    },
4312
16
    { &hf_tp_rfu2,
4313
16
      { "RFU", "gsm_sim.tp.rfu",
4314
16
        FT_UINT8, BASE_HEX, NULL, 0xfc,
4315
16
        NULL, HFILL },
4316
16
    },
4317
4318
    /* Terminal Profile Byte 11 */
4319
16
    { &hf_tprof_b11,
4320
16
      { "Terminal Profile Byte 11 (Soft keys information)", "gsm_sim.tp.b11",
4321
16
        FT_UINT8, BASE_HEX, NULL, 0,
4322
16
        NULL, HFILL },
4323
16
    },
4324
16
    { &hf_tp_soft_key_info_max_nb,
4325
      /* Note: The bitmask 0xff is needed */
4326
16
      { "Maximum number of soft keys available", "gsm_sim.tp.soft_key_info.max_nb",
4327
16
        FT_UINT8, BASE_DEC, NULL, 0xff,
4328
16
        NULL, HFILL }
4329
16
    },
4330
4331
    /* Terminal Profile Byte 12 */
4332
16
    { &hf_tprof_b12,
4333
16
      { "Terminal Profile Byte 12 (Bearer Independent protocol proactive commands, class \"e\")", "gsm_sim.tp.b12",
4334
16
        FT_UINT8, BASE_HEX, NULL, 0,
4335
16
        NULL, HFILL },
4336
16
    },
4337
16
    { &hf_tp_pa_open_chan,
4338
16
      { "Proactive SIM: OPEN CHANNEL", "gsm_sim.tp.pa.open_chan",
4339
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4340
16
        NULL, HFILL }
4341
16
    },
4342
16
    { &hf_tp_pa_close_chan,
4343
16
      { "Proactive SIM: CLOSE CHANNEL", "gsm_sim.tp.pa.close_chan",
4344
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4345
16
        NULL, HFILL }
4346
16
    },
4347
16
    { &hf_tp_pa_recv_data,
4348
16
      { "Proactive SIM: RECEIVE DATA", "gsm_sim.tp.pa.recv_data",
4349
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4350
16
        NULL, HFILL }
4351
16
    },
4352
16
    { &hf_tp_pa_send_data,
4353
16
      { "Proactive SIM: SEND DATA", "gsm_sim.tp.pa.send_data",
4354
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4355
16
        NULL, HFILL }
4356
16
    },
4357
16
    { &hf_tp_pa_get_chan_status,
4358
16
      { "Proactive SIM: GET CHANNEL STATUS", "gsm_sim.tp.pa.get_chan_status",
4359
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4360
16
        NULL, HFILL }
4361
16
    },
4362
16
    { &hf_tp_pa_serv_search,
4363
16
      { "Proactive SIM: SERVICE SEARCH", "gsm_sim.tp.pa.serv_search",
4364
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4365
16
        NULL, HFILL }
4366
16
    },
4367
16
    { &hf_tp_pa_get_serv_info,
4368
16
      { "Proactive SIM: GET SERVICE INFORMATION", "gsm_sim.tp.pa.get_serv_info",
4369
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4370
16
        NULL, HFILL }
4371
16
    },
4372
16
    { &hf_tp_pa_decl_serv,
4373
16
      { "Proactive SIM: DECLARE SERVICE", "gsm_sim.tp.pa.decl_serv",
4374
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4375
16
        NULL, HFILL }
4376
16
    },
4377
4378
    /* Terminal Profile Byte 13 */
4379
16
    { &hf_tprof_b13,
4380
16
      { "Terminal Profile Byte 13 (Bearer Independent protocol supported bearers, class \"e\")", "gsm_sim.tp.b13",
4381
16
        FT_UINT8, BASE_HEX, NULL, 0,
4382
16
        NULL, HFILL },
4383
16
    },
4384
16
    { &hf_tp_bip_csd,
4385
16
      { "CSD bearer", "gsm_sim.tp.bip.csd",
4386
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4387
16
        NULL, HFILL }
4388
16
    },
4389
16
    { &hf_tp_bip_gprs,
4390
16
      { "GPRS bearer", "gsm_sim.tp.bip.gprs",
4391
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4392
16
        NULL, HFILL }
4393
16
    },
4394
16
    { &hf_tp_bip_bluetooth,
4395
16
      { "Bluetooth bearer", "gsm_sim.tp.bip.bluetooth",
4396
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4397
16
        NULL, HFILL }
4398
16
    },
4399
16
    { &hf_tp_bip_irda,
4400
16
      { "IrDA bearer", "gsm_sim.tp.bip.irda",
4401
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4402
16
        NULL, HFILL }
4403
16
    },
4404
16
    { &hf_tp_bip_rs232,
4405
16
      { "RS232 bearer", "gsm_sim.tp.bip.rs232",
4406
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4407
16
        NULL, HFILL }
4408
16
    },
4409
16
    { &hf_tp_num_chans,
4410
16
      { "Number of Channels", "gsm_sim.tp.num_chans",
4411
16
        FT_UINT8, BASE_DEC, NULL, 0xe0,
4412
16
        NULL, HFILL }
4413
16
    },
4414
4415
4416
    /* Terminal Profile Byte 14 */
4417
16
    { &hf_tprof_b14,
4418
16
      { "Terminal Profile Byte 14 (Screen height)", "gsm_sim.tp.b14",
4419
16
        FT_UINT8, BASE_HEX, NULL, 0,
4420
16
        NULL, HFILL },
4421
16
    },
4422
16
    { &hf_tp_char_height,
4423
16
      { "Display height (chars)", "gsm_sim.tp.display.height",
4424
16
        FT_UINT8, BASE_DEC, NULL, 0x1f,
4425
16
        NULL, HFILL },
4426
16
    },
4427
16
    { &hf_tp_nd,
4428
16
      { "No display capability", "gsm_sim.tp.nd",
4429
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4430
16
        NULL, HFILL },
4431
16
    },
4432
16
    { &hf_tp_nk,
4433
16
      { "No keypad available", "gsm_sim.tp.nk",
4434
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4435
16
        NULL, HFILL },
4436
16
    },
4437
16
    { &hf_tp_sizing_supp,
4438
16
      { "Screen sizing parameters", "gsm_sim.tp.disp_sizing",
4439
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4440
16
        NULL, HFILL },
4441
16
    },
4442
4443
    /* Terminal Profile Byte 15 */
4444
16
    { &hf_tprof_b15,
4445
16
      { "Terminal Profile Byte 15 (Screen width)", "gsm_sim.tp.b15",
4446
16
        FT_UINT8, BASE_HEX, NULL, 0,
4447
16
        NULL, HFILL },
4448
16
    },
4449
16
    { &hf_tp_char_width,
4450
16
      { "Display width (chars)", "gsm_sim.tp.display.width",
4451
16
        FT_UINT8, BASE_DEC, NULL, 0x7f,
4452
16
        NULL, HFILL },
4453
16
    },
4454
16
    { &hf_tp_var_fonts,
4455
16
      { "Variable size fonts", "gsm_sim.tp.var_fonts",
4456
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4457
16
        NULL, HFILL },
4458
16
    },
4459
4460
    /* Terminal Profile Byte 16 */
4461
16
    { &hf_tprof_b16,
4462
16
      { "Terminal Profile Byte 16 (Screen effects)", "gsm_sim.tp.b16",
4463
16
        FT_UINT8, BASE_HEX, NULL, 0,
4464
16
        NULL, HFILL },
4465
16
    },
4466
16
    { &hf_tp_display_resize,
4467
16
      { "Display resize", "gsm_sim.tp.display.resize",
4468
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4469
16
        NULL, HFILL },
4470
16
    },
4471
16
    { &hf_tp_text_wrapping,
4472
16
      { "Text Wrapping", "gsm_sim.tp.display.wrapping",
4473
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4474
16
        NULL, HFILL },
4475
16
    },
4476
16
    { &hf_tp_text_scrolling,
4477
16
      { "Text Scrolling", "gsm_sim.tp.display.scrolling",
4478
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4479
16
        NULL, HFILL },
4480
16
    },
4481
16
    { &hf_tp_text_attributes,
4482
16
      { "Text Attributes", "gsm_sim.tp.display.attributes",
4483
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4484
16
        NULL, HFILL },
4485
16
    },
4486
16
    { &hf_tp_rfu3,
4487
16
      { "RFU", "gsm_sim.tp.rfu",
4488
16
        FT_UINT8, BASE_HEX, NULL, 0x10,
4489
16
        NULL, HFILL },
4490
16
    },
4491
16
    { &hf_tp_width_red_menu,
4492
16
      { "Width reduction when in menu", "gsm_sim.tp.display.width_red_menu",
4493
16
        FT_UINT8, BASE_DEC, NULL, 0xe0,
4494
16
        NULL, HFILL },
4495
16
    },
4496
4497
    /* Terminal Profile Byte 17 */
4498
16
    { &hf_tprof_b17,
4499
16
      { "Terminal Profile Byte 17 (Bearer independent protocol supported transport interface/bearers, class \"e\")", "gsm_sim.tp.b17",
4500
16
        FT_UINT8, BASE_HEX, NULL, 0,
4501
16
        NULL, HFILL },
4502
16
    },
4503
16
    { &hf_tp_bip_tcp_remote,
4504
16
      { "TCP client mode remote connection", "gsm_sim.tp.bip.tcp_remote",
4505
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4506
16
        NULL, HFILL }
4507
16
    },
4508
16
    { &hf_tp_bip_udp_remote,
4509
16
      { "UDP client mode remote connection", "gsm_sim.tp.bip.udp_remote",
4510
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4511
16
        NULL, HFILL }
4512
16
    },
4513
16
    { &hf_tp_bip_tcp_server,
4514
16
      { "TCP server mode", "gsm_sim.tp.bip.tcp_server",
4515
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4516
16
        NULL, HFILL }
4517
16
    },
4518
16
    { &hf_tp_bip_tcp_local,
4519
16
      { "TCP client mode local connection", "gsm_sim.tp.bip.tcp_local",
4520
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4521
16
        NULL, HFILL }
4522
16
    },
4523
16
    { &hf_tp_bip_udp_local,
4524
16
      { "UDP client mode local connection", "gsm_sim.tp.bip.udp_local",
4525
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4526
16
        NULL, HFILL }
4527
16
    },
4528
16
    { &hf_tp_bip_direct_com,
4529
16
      { "Direct communication channel", "gsm_sim.tp.bip.direct_com",
4530
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4531
16
        NULL, HFILL }
4532
16
    },
4533
16
    { &hf_tp_bip_eutran,
4534
16
      { "E-UTRAN bearer", "gsm_sim.tp.bip.eutran",
4535
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4536
16
        NULL, HFILL }
4537
16
    },
4538
16
    { &hf_tp_bip_hsdpa,
4539
16
      { "HSDPA bearer", "gsm_sim.tp.bip.hsdpa",
4540
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4541
16
        NULL, HFILL }
4542
16
    },
4543
4544
    /* Terminal Profile Byte 18 */
4545
16
    { &hf_tprof_b18,
4546
16
      { "Terminal Profile Byte 18 (Bearer independent protocol)", "gsm_sim.tp.b18",
4547
16
        FT_UINT8, BASE_HEX, NULL, 0,
4548
16
        NULL, HFILL },
4549
16
    },
4550
16
    { &hf_tp_pa_display_text_var_time_out,
4551
16
      { "Proactive SIM: DISPLAY TEXT (Variable Time out)", "gsm_sim.tp.pa.display_text_var_time_out",
4552
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4553
16
        NULL, HFILL }
4554
16
    },
4555
16
    { &hf_tp_pa_get_inkey_help,
4556
16
      { "Proactive SIM: GET INKEY (help is supported)", "gsm_sim.tp.pa.get_inkey_help",
4557
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4558
16
        NULL, HFILL }
4559
16
    },
4560
16
    { &hf_tp_bip_usb,
4561
16
      { "USB bearer", "gsm_sim.tp.bip.usb",
4562
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4563
16
        NULL, HFILL }
4564
16
    },
4565
16
    { &hf_tp_pa_get_inkey_var_time_out,
4566
16
      { "Proactive SIM: GET INKEY (Variable Timeout)", "gsm_sim.tp.pa.get_inkey_var_time_out",
4567
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4568
16
        NULL, HFILL }
4569
16
    },
4570
16
    { &hf_tp_pa_prov_loci_esn,
4571
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (ESN)", "gsm_sim.tp.pa.prov_loci_esn",
4572
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4573
16
        NULL, HFILL }
4574
16
    },
4575
16
    { &hf_tp_cc_gprs,
4576
16
      { "CALL CONTROL on GPRS", "gsm_sim.tp.cc_gprs",
4577
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4578
16
        NULL, HFILL }
4579
16
    },
4580
16
    { &hf_tp_pa_prov_loci_imeisv,
4581
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (IMEISV)", "gsm_sim.tp.pa.prov_loci_imeisv",
4582
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4583
16
        NULL, HFILL }
4584
16
    },
4585
16
    { &hf_tp_pa_prov_loci_search_mode_change,
4586
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Search Mode change)", "gsm_sim.tp.pa.prov_loci_search_mode_change",
4587
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4588
16
        NULL, HFILL }
4589
16
    },
4590
4591
    /* Terminal Profile Byte 19 */
4592
16
    { &hf_tprof_b19,
4593
16
      { "Terminal Profile Byte 19 (TIA/EIA-136-C facilities)", "gsm_sim.tp.b19",
4594
16
        FT_UINT8, BASE_HEX, NULL, 0,
4595
16
        NULL, HFILL },
4596
16
    },
4597
16
    { &hf_tp_tia_eia_version,
4598
16
      { "TIA/EIA Version", "gsm_sim.tp.tia_eia_version",
4599
16
        FT_UINT8, BASE_DEC, NULL, 0x0f,
4600
16
        NULL, HFILL }
4601
16
    },
4602
16
    { &hf_tp_rfu4,
4603
16
      { "RFU", "gsm_sim.tp.rfu",
4604
16
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4605
16
        NULL, HFILL },
4606
16
    },
4607
4608
    /* Terminal Profile Byte 20 */
4609
16
    { &hf_tprof_b20,
4610
16
      { "Terminal Profile Byte 20 (TIA/EIA/IS-820-A facilities)", "gsm_sim.tp.b20",
4611
16
        FT_UINT8, BASE_HEX, NULL, 0,
4612
16
        NULL, HFILL },
4613
16
    },
4614
16
    { &hf_tp_tia_iea_is820a_reserved,
4615
16
      { "Reserved", "gsm_sim.tp.tia_iea_is820a_reserved",
4616
16
        FT_UINT8, BASE_HEX, NULL, 0xff,
4617
16
        NULL, HFILL }
4618
16
    },
4619
4620
    /* Terminal Profile Byte 21 */
4621
16
    { &hf_tprof_b21,
4622
16
      { "Terminal Profile Byte 21 (Extended Launch Browser Capability)", "gsm_sim.tp.b21",
4623
16
        FT_UINT8, BASE_HEX, NULL, 0,
4624
16
        NULL, HFILL },
4625
16
    },
4626
16
    { &hf_tp_ext_launch_browser_wml,
4627
16
      { "WML", "gsm_sim.tp.ext_launch_browser.wml",
4628
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4629
16
        NULL, HFILL }
4630
16
    },
4631
16
    { &hf_tp_ext_launch_browser_xhtml,
4632
16
      { "XHTML", "gsm_sim.tp.ext_launch_browser.xhtml",
4633
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4634
16
        NULL, HFILL }
4635
16
    },
4636
16
    { &hf_tp_ext_launch_browser_html,
4637
16
      { "HTML", "gsm_sim.tp.ext_launch_browser.html",
4638
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4639
16
        NULL, HFILL }
4640
16
    },
4641
16
    { &hf_tp_ext_launch_browser_chtml,
4642
16
      { "CHTML", "gsm_sim.tp.ext_launch_browser.chtml",
4643
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4644
16
        NULL, HFILL }
4645
16
    },
4646
16
    { &hf_tp_rfu5,
4647
16
      { "RFU", "gsm_sim.tp.rfu",
4648
16
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4649
16
        NULL, HFILL },
4650
16
    },
4651
4652
    /* Terminal Profile Byte 22 */
4653
16
    { &hf_tprof_b22,
4654
16
      { "Terminal Profile Byte 22", "gsm_sim.tp.b22",
4655
16
        FT_UINT8, BASE_HEX, NULL, 0,
4656
16
        NULL, HFILL },
4657
16
    },
4658
16
    { &hf_tp_utran_ps_ext_params,
4659
16
      { "UTRAN PS with extended parameters", "gsm_sim.tp.utran_ps_ext_params",
4660
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4661
16
        NULL, HFILL }
4662
16
    },
4663
16
    { &hf_tp_pa_prov_loci_batt_state,
4664
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (battery state)", "gsm_sim.tp.pa.prov_loci_batt_state",
4665
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4666
16
        NULL, HFILL }
4667
16
    },
4668
16
    { &hf_tp_pa_play_tone_melody,
4669
16
      { "Proactive SIM: PLAY TONE (Melody tones and Themed tones supported)", "gsm_sim.tp.pa.play_tone_melody",
4670
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4671
16
        NULL, HFILL }
4672
16
    },
4673
16
    { &hf_tp_mm_call_set_up_call,
4674
16
      { "Multi-media Calls in SET UP CALL", "gsm_sim.tp.mm_call_set_up_call",
4675
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4676
16
        NULL, HFILL }
4677
16
    },
4678
16
    { &hf_tp_toolkit_initiated_gba,
4679
16
      { "Toolkit-initiated GBA", "gsm_sim.tp.toolkit_initiated_gba",
4680
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4681
16
        NULL, HFILL }
4682
16
    },
4683
16
    { &hf_tp_pa_retrieve_mm_msg,
4684
16
      { "Proactive SIM: RETRIEVE MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.retrieve_mm_msg",
4685
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4686
16
        NULL, HFILL }
4687
16
    },
4688
16
    { &hf_tp_pa_submit_mm_msg,
4689
16
      { "Proactive SIM: SUBMIT MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.submit_mm_msg",
4690
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4691
16
        NULL, HFILL }
4692
16
    },
4693
16
    { &hf_tp_pa_display_mm_msg,
4694
16
      { "Proactive SIM: DISPLAY MULTIMEDIA MESSAGE", "gsm_sim.tp.pa.display_mm_msg",
4695
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4696
16
        NULL, HFILL }
4697
16
    },
4698
4699
    /* Terminal Profile Byte 23 */
4700
16
    { &hf_tprof_b23,
4701
16
      { "Terminal Profile Byte 23", "gsm_sim.tp.b23",
4702
16
        FT_UINT8, BASE_HEX, NULL, 0,
4703
16
        NULL, HFILL },
4704
16
    },
4705
16
    { &hf_tp_pa_set_frames,
4706
16
      { "Proactive SIM: SET FRAMES", "gsm_sim.tp.pa.set_frames",
4707
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4708
16
        NULL, HFILL }
4709
16
    },
4710
16
    { &hf_tp_pa_get_frames_status,
4711
16
      { "Proactive SIM: GET FRAMES STATUS", "gsm_sim.tp.pa.get_frames_status",
4712
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4713
16
        NULL, HFILL }
4714
16
    },
4715
16
    { &hf_tp_mms_notif_download,
4716
16
      { "MMS notification download", "gsm_sim.tp.mms_notif_download",
4717
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4718
16
        NULL, HFILL }
4719
16
    },
4720
16
    { &hf_tp_alpha_id_refresh_cmd,
4721
16
      { "Alpha Identifier in REFRESH command", "gsm_sim.tp.alpha_id_refresh_cmd",
4722
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4723
16
        NULL, HFILL }
4724
16
    },
4725
16
    { &hf_tp_geo_loc_report,
4726
16
      { "Geographical Location Reporting", "gsm_sim.tp.geo_loc_report",
4727
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4728
16
        NULL, HFILL }
4729
16
    },
4730
16
    { &hf_tp_pa_prov_loci_meid,
4731
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (MEID)", "gsm_sim.tp.pa.prov_loci_meid",
4732
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4733
16
        NULL, HFILL }
4734
16
    },
4735
16
    { &hf_tp_pa_prov_loci_nmr_utran_eutran,
4736
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (NMR(UTRAN/E-UTRAN))", "gsm_sim.tp.pa.prov_loci_nmr_utran_eutran",
4737
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4738
16
        NULL, HFILL }
4739
16
    },
4740
16
    { &hf_tp_ussd_data_download,
4741
16
      { "USSD Data download and application mode", "gsm_sim.tp.ussd_data_download",
4742
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4743
16
        NULL, HFILL }
4744
16
    },
4745
4746
    /* Terminal Profile Byte 24 */
4747
16
    { &hf_tprof_b24,
4748
16
      { "Terminal Profile Byte 24 (Class \"i\")", "gsm_sim.tp.b24",
4749
16
        FT_UINT8, BASE_HEX, NULL, 0,
4750
16
        NULL, HFILL },
4751
16
    },
4752
16
    { &hf_tp_class_i_max_nb_frames,
4753
16
      { "Maximum number of frames supported", "gsm_sim.tp.class_i_max_nb_frames",
4754
16
        FT_UINT8, BASE_DEC, NULL, 0x0f,
4755
16
        NULL, HFILL }
4756
16
    },
4757
16
    { &hf_tp_rfu6,
4758
16
      { "RFU", "gsm_sim.tp.rfu",
4759
16
        FT_UINT8, BASE_HEX, NULL, 0xf0,
4760
16
        NULL, HFILL },
4761
16
    },
4762
4763
    /* Terminal Profile Byte 25 */
4764
16
    { &hf_tprof_b25,
4765
16
      { "Terminal Profile Byte 25 (Event driven information extensions)", "gsm_sim.tp.b25",
4766
16
        FT_UINT8, BASE_HEX, NULL, 0,
4767
16
        NULL, HFILL },
4768
16
    },
4769
16
    { &hf_tp_evt_browsing_status,
4770
16
      { "Event: Browsing status", "gsm_sim.tp.evt.browsing_status",
4771
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4772
16
        NULL, HFILL }
4773
16
    },
4774
16
    { &hf_tp_evt_mms_transfer_status,
4775
16
      { "Event: MMS Transfer status", "gsm_sim.tp.evt.mms_transfer_status",
4776
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4777
16
        NULL, HFILL }
4778
16
    },
4779
16
    { &hf_tp_evt_frame_info_changed,
4780
16
      { "Event: Frame Information changed", "gsm_sim.tp.evt.frame_info_changed",
4781
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4782
16
        NULL, HFILL }
4783
16
    },
4784
16
    { &hf_tp_evt_iwlan_access_status,
4785
16
      { "Event: I-WLAN Access status", "gsm_sim.tp.evt.iwlan_access_status",
4786
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4787
16
        NULL, HFILL }
4788
16
    },
4789
16
    { &hf_tp_evt_nw_reject_geran_utran,
4790
16
      { "Event: Network Rejection for GERAN/UTRAN", "gsm_sim.tp.evt.nw_reject_geran_utran",
4791
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4792
16
        NULL, HFILL }
4793
16
    },
4794
16
    { &hf_tp_evt_hci_connectivity,
4795
16
      { "Event: HCI connectivity", "gsm_sim.tp.evt.hci_connectivity",
4796
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4797
16
        NULL, HFILL }
4798
16
    },
4799
16
    { &hf_tp_evt_nw_reject_eutran,
4800
16
      { "Event: Network Rejection for E-UTRAN", "gsm_sim.tp.evt.reject_eutran",
4801
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4802
16
        NULL, HFILL }
4803
16
    },
4804
16
    { &hf_tp_evt_mult_access_techno_change,
4805
16
      { "Multiple access technologies supported in Event Access Technology Change and PROVIDE LOCAL INFORMATION",
4806
16
        "gsm_sim.tp.evt.mult_access_techno_change",
4807
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4808
16
        NULL, HFILL }
4809
16
    },
4810
4811
    /* Terminal Profile Byte 26 */
4812
16
    { &hf_tprof_b26,
4813
16
      { "Terminal Profile Byte 26 (Event driven information extensions)", "gsm_sim.tp.b26",
4814
16
        FT_UINT8, BASE_HEX, NULL, 0,
4815
16
        NULL, HFILL },
4816
16
    },
4817
16
    { &hf_tp_evt_csg_cell_select,
4818
16
      { "Event: CSG Cell Selection", "gsm_sim.tp.evt.csg_cell_select",
4819
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4820
16
        NULL, HFILL }
4821
16
    },
4822
16
    { &hf_tp_evt_contactless_state_req,
4823
16
      { "Event: Contactless state request", "gsm_sim.tp.evt.contactless_state_req",
4824
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4825
16
        NULL, HFILL }
4826
16
    },
4827
16
    { &hf_tp_rfu7,
4828
16
      { "RFU", "gsm_sim.tp.rfu",
4829
16
        FT_UINT8, BASE_HEX, NULL, 0xfc,
4830
16
        NULL, HFILL },
4831
16
    },
4832
4833
    /* Terminal Profile Byte 27 */
4834
16
    { &hf_tprof_b27,
4835
16
      { "Terminal Profile Byte 27 (Event driven information extensions)", "gsm_sim.tp.b27",
4836
16
        FT_UINT8, BASE_HEX, NULL, 0,
4837
16
        NULL, HFILL },
4838
16
    },
4839
16
    { &hf_tp_rfu8,
4840
16
      { "RFU", "gsm_sim.tp.rfu",
4841
16
        FT_UINT8, BASE_HEX, NULL, 0xff,
4842
16
        NULL, HFILL },
4843
16
    },
4844
4845
    /* Terminal Profile Byte 28 */
4846
16
    { &hf_tprof_b28,
4847
16
      { "Terminal Profile Byte 28 (Text attributes)", "gsm_sim.tp.b28",
4848
16
        FT_UINT8, BASE_HEX, NULL, 0,
4849
16
        NULL, HFILL },
4850
16
    },
4851
16
    { &hf_tp_text_align_left,
4852
16
      { "Alignment left", "gsm_sim.tp.text.align_left",
4853
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4854
16
        NULL, HFILL }
4855
16
    },
4856
16
    { &hf_tp_text_align_centre,
4857
16
      { "Alignment centre", "gsm_sim.tp.text.align_centre",
4858
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4859
16
        NULL, HFILL }
4860
16
    },
4861
16
    { &hf_tp_text_align_right,
4862
16
      { "Alignment right", "gsm_sim.tp.text.align_right",
4863
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4864
16
        NULL, HFILL }
4865
16
    },
4866
16
    { &hf_tp_text_font_size_normal,
4867
16
      { "Font size normal", "gsm_sim.tp.text.font_size_normal",
4868
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4869
16
        NULL, HFILL }
4870
16
    },
4871
16
    { &hf_tp_text_font_size_large,
4872
16
      { "Font size large", "gsm_sim.tp.text.font_size_large",
4873
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4874
16
        NULL, HFILL }
4875
16
    },
4876
16
    { &hf_tp_text_font_size_small,
4877
16
      { "Font size small", "gsm_sim.tp.text.font_size_small",
4878
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4879
16
        NULL, HFILL }
4880
16
    },
4881
16
    { &hf_tp_rfu9,
4882
16
      { "RFU", "gsm_sim.tp.rfu",
4883
16
        FT_UINT8, BASE_HEX, NULL, 0xc0,
4884
16
        NULL, HFILL },
4885
16
    },
4886
4887
    /* Terminal Profile Byte 29 */
4888
16
    { &hf_tprof_b29,
4889
16
      { "Terminal Profile Byte 29 (Text attributes)", "gsm_sim.tp.b29",
4890
16
        FT_UINT8, BASE_HEX, NULL, 0,
4891
16
        NULL, HFILL },
4892
16
    },
4893
16
    { &hf_tp_text_style_normal,
4894
16
      { "Style normal", "gsm_sim.tp.text.style_normal",
4895
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4896
16
        NULL, HFILL }
4897
16
    },
4898
16
    { &hf_tp_text_style_bold,
4899
16
      { "Style bold", "gsm_sim.tp.text.style_bold",
4900
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4901
16
        NULL, HFILL }
4902
16
    },
4903
16
    { &hf_tp_text_style_italic,
4904
16
      { "Style italic", "gsm_sim.tp.text.style_italic",
4905
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4906
16
        NULL, HFILL }
4907
16
    },
4908
16
    { &hf_tp_text_style_underlined,
4909
16
      { "Style underlined", "gsm_sim.tp.text.style_underlined",
4910
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4911
16
        NULL, HFILL }
4912
16
    },
4913
16
    { &hf_tp_text_style_strikethrough,
4914
16
      { "Style strikethrough", "gsm_sim.tp.text.style_strikethrough",
4915
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4916
16
        NULL, HFILL }
4917
16
    },
4918
16
    { &hf_tp_text_style_text_fg_colour,
4919
16
      { "Style text foreground colour", "gsm_sim.tp.text.style_text_fg_colour",
4920
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4921
16
        NULL, HFILL }
4922
16
    },
4923
16
    { &hf_tp_text_style_text_bg_colour,
4924
16
      { "Style text background colour", "gsm_sim.tp.text.style_text_bg_colour",
4925
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4926
16
        NULL, HFILL }
4927
16
    },
4928
16
    { &hf_tp_rfu10,
4929
16
      { "RFU", "gsm_sim.tp.rfu",
4930
16
        FT_UINT8, BASE_HEX, NULL, 0x80,
4931
16
        NULL, HFILL },
4932
16
    },
4933
4934
    /* Terminal Profile Byte 30 */
4935
16
    { &hf_tprof_b30,
4936
16
      { "Terminal Profile Byte 30", "gsm_sim.tp.b30",
4937
16
        FT_UINT8, BASE_HEX, NULL, 0,
4938
16
        NULL, HFILL },
4939
16
    },
4940
16
    { &hf_tp_bip_iwlan,
4941
16
      { "I-WLAN bearer", "gsm_sim.tp.bip.iwlan",
4942
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4943
16
        NULL, HFILL }
4944
16
    },
4945
16
    { &hf_tp_pa_prov_loci_wsid,
4946
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (WSID of the current I-WLAN connection)", "gsm_sim.tp.pa.prov_loci_wsid",
4947
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4948
16
        NULL, HFILL }
4949
16
    },
4950
16
    { &hf_tp_term_app,
4951
16
      { "TERMINAL APPLICATIONS", "gsm_sim.tp.term_app",
4952
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
4953
16
        NULL, HFILL }
4954
16
    },
4955
16
    { &hf_tp_steering_roaming_refresh,
4956
16
      { "\"Steering of Roaming\" REFRESH", "gsm_sim.tp.steering_roaming_refresh",
4957
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
4958
16
        NULL, HFILL }
4959
16
    },
4960
16
    { &hf_tp_pa_activate,
4961
16
      { "Proactive SIM: ACTIVATE", "gsm_sim.tp.pa.activate",
4962
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
4963
16
        NULL, HFILL }
4964
16
    },
4965
16
    { &hf_tp_pa_geo_loc_req,
4966
16
      { "Proactive SIM: Geographical Location Request", "gsm_sim.tp.pa.geo_loc_req",
4967
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
4968
16
        NULL, HFILL }
4969
16
    },
4970
16
    { &hf_tp_pa_prov_loci_broadcast_nw_info,
4971
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (Broadcast Network Information)", "gsm_sim.tp.pa.prov_loci_broadcast_nw_info",
4972
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
4973
16
        NULL, HFILL }
4974
16
    },
4975
16
    { &hf_tp_steering_roaming_iwlan_refresh,
4976
16
      { "\"Steering of Roaming for I-WLAN\" REFRESH", "gsm_sim.tp.steering_roaming_iwlan_refresh",
4977
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
4978
16
        NULL, HFILL }
4979
16
    },
4980
4981
    /* Terminal Profile Byte 31 */
4982
16
    { &hf_tprof_b31,
4983
16
      { "Terminal Profile Byte 31", "gsm_sim.tp.b31",
4984
16
        FT_UINT8, BASE_HEX, NULL, 0,
4985
16
        NULL, HFILL },
4986
16
    },
4987
16
    { &hf_tp_pa_contactless_state_changed,
4988
16
      { "Proactive SIM: Contactless State Changed", "gsm_sim.tp.pa.contactless_state_changed",
4989
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
4990
16
        NULL, HFILL }
4991
16
    },
4992
16
    { &hf_tp_csg_cell_discovery,
4993
16
      { "CSG cell discovery", "gsm_sim.tp.csg_cell_discovery",
4994
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
4995
16
        NULL, HFILL }
4996
16
    },
4997
16
    { &hf_tp_cnf_params_support_open_chan_server_mode,
4998
16
      { "Confirmation parameters supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.cnf_params_support_open_chan_server_mode",
4999
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5000
16
        NULL, HFILL }
5001
16
    },
5002
16
    { &hf_tp_com_ctrl_ims,
5003
16
      { "Communication Control for IMS", "gsm_sim.tp.com_ctrl_ims",
5004
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5005
16
        NULL, HFILL }
5006
16
    },
5007
16
    { &hf_tp_cat_over_modem_itf,
5008
16
      { "CAT over the modem interface", "gsm_sim.tp.cat_over_modem_itf",
5009
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5010
16
        NULL, HFILL }
5011
16
    },
5012
16
    { &hf_tp_evt_incoming_data_ims,
5013
16
      { "Event: Incoming IMS Data", "gsm_sim.tp.evt.incoming_data_ims",
5014
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5015
16
        NULL, HFILL }
5016
16
    },
5017
16
    { &hf_tp_evt_ims_registration,
5018
16
      { "Event: IMS Registration", "gsm_sim.tp.evt.ims_registration",
5019
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5020
16
        NULL, HFILL }
5021
16
    },
5022
16
    { &hf_tp_pa_prof_env_cont,
5023
16
      { "Proactive SIM: Profile Container, Envelope Container, COMMAND CONTAINER and ENCAPSULATED SESSION CONTROL", "gsm_sim.tp.pa.prof_env_cont",
5024
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5025
16
        NULL, HFILL }
5026
16
    },
5027
5028
    /* Terminal Profile Byte 32 */
5029
16
    { &hf_tprof_b32,
5030
16
      { "Terminal Profile Byte 32", "gsm_sim.tp.b32",
5031
16
        FT_UINT8, BASE_HEX, NULL, 0,
5032
16
        NULL, HFILL },
5033
16
    },
5034
16
    { &hf_tp_bip_ims,
5035
16
      { "IMS bearer", "gsm_sim.tp.bip.ims",
5036
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5037
16
        NULL, HFILL }
5038
16
    },
5039
16
    { &hf_tp_pa_prov_loci_henb_ip_addr,
5040
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (H(e)NB IP address)", "gsm_sim.tp.pa.prov_loci_henb_ip_addr",
5041
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5042
16
        NULL, HFILL }
5043
16
    },
5044
16
    { &hf_tp_pa_prov_loci_henb_surround_macro,
5045
16
      { "Proactive SIM: PROVIDE LOCAL INFORMATION (H(e)NB surrounding macrocells)", "gsm_sim.tp.pa.prov_loci_henb_surround_macro",
5046
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5047
16
        NULL, HFILL }
5048
16
    },
5049
16
    { &hf_tp_launch_params_support_open_chan_server_mode,
5050
16
      { "Launch parameters supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.launch_params_support_open_chan_server_mode",
5051
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5052
16
        NULL, HFILL }
5053
16
    },
5054
16
    { &hf_tp_direct_com_support_open_chan_server_mode,
5055
16
      { "Direct communication channel supported for OPEN CHANNEL in Terminal Server Mode", "gsm_sim.tp.direct_com_support_open_chan_server_mode",
5056
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5057
16
        NULL, HFILL }
5058
16
    },
5059
16
    { &hf_tp_pa_sec_prof_env_cont,
5060
16
      { "Proactive SIM: Security for Profile Container, Envelope Container, COMMAND CONTAINER and ENCAPSULATED SESSION CONTROL", "gsm_sim.tp.sec_prof_env_cont",
5061
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5062
16
        NULL, HFILL }
5063
16
    },
5064
16
    { &hf_tp_cat_serv_list_ecat_client,
5065
16
      { "CAT service list for eCAT client", "gsm_sim.tp.serv_list_ecat_client",
5066
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5067
16
        NULL, HFILL }
5068
16
    },
5069
16
    { &hf_tp_support_refresh_enforcement_policy,
5070
16
      { "Support of refresh enforcement policy", "gsm_sim.tp.refresh_enforcement_policy",
5071
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5072
16
        NULL, HFILL }
5073
16
    },
5074
5075
    /* Terminal Profile Byte 33 */
5076
16
    { &hf_tprof_b33,
5077
16
      { "Terminal Profile Byte 33", "gsm_sim.tp.b33",
5078
16
        FT_UINT8, BASE_HEX, NULL, 0,
5079
16
        NULL, HFILL },
5080
16
    },
5081
16
    { &hf_tp_support_dns_addr_req,
5082
16
      { "Support of DNS server address request for OPEN CHANNEL related to packet data service bearer", "gsm_sim.tp.support_dns_addr_req",
5083
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5084
16
        NULL, HFILL }
5085
16
    },
5086
16
    { &hf_tp_support_nw_access_name_reuse,
5087
16
      { "Support of Network Access Name reuse indication for CLOSE CHANNEL related to packet data service bearer", "gsm_sim.tp.nw_access_name_reuse",
5088
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5089
16
        NULL, HFILL }
5090
16
    },
5091
16
    { &hf_tp_ev_poll_intv_nego,
5092
16
      { "Event: Poll Interval Negotiation", "gsm_sim.tp.evt.poll_intv_nego",
5093
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5094
16
        NULL, HFILL }
5095
16
    },
5096
16
    { &hf_tp_prose_usage_info_reporting,
5097
16
      { "ProSe usage information reporting", "gsm_sim.tp.evt.prose_usage_info_reporting",
5098
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5099
16
        NULL, HFILL }
5100
16
    },
5101
16
    { &hf_tp_pa_prov_loci_rat,
5102
16
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (Supported Radio Access Technologies)", "gsm_sim.tp.pa.prov_loci_rat",
5103
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5104
16
        NULL, HFILL }
5105
16
    },
5106
16
    { &hf_tp_evt_wlan_access_status,
5107
16
      { "Event: WLAN Access status", "gsm_sim.tp.evt.wlan_access_status",
5108
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5109
16
        NULL, HFILL }
5110
16
    },
5111
16
    { &hf_tp_wlan_bearer,
5112
16
      { "WLAN bearer support", "gsm_sim.tp.wlan_bearer",
5113
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5114
16
        NULL, HFILL }
5115
16
    },
5116
16
    { &hf_tp_pa_prov_loci_wlan_id,
5117
16
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (WLAN identifier of the current WLAN connection)", "gsm_sim.tp.pa.prov_loci_wlan_id",
5118
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5119
16
        NULL, HFILL }
5120
16
    },
5121
5122
    /* Terminal Profile Byte 34 */
5123
16
    { &hf_tprof_b34,
5124
16
      { "Terminal Profile Byte 34", "gsm_sim.tp.b34",
5125
16
        FT_UINT8, BASE_HEX, NULL, 0,
5126
16
        NULL, HFILL },
5127
16
    },
5128
16
    { &hf_tp_uri_send_short_msg,
5129
16
      { "URI support for SEND SHORT MESSAGE", "gsm_sim.tp.uri_send_short_msg",
5130
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5131
16
        NULL, HFILL }
5132
16
    },
5133
16
    { &hf_tp_ims_uri_setup_call,
5134
16
      { "IMS URI supported for SET UP CALL", "gsm_sim.tp.ims_uri_setup_call",
5135
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5136
16
        NULL, HFILL }
5137
16
    },
5138
16
    { &hf_tp_media_type_voice_setup_call,
5139
16
      { "Media Type \"Voice\" supported for SET UP CALL and Call Control by USIM", "gsm_sim.tp.media_type_voice_setup_call",
5140
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5141
16
        NULL, HFILL }
5142
16
    },
5143
16
    { &hf_tp_media_type_video_setup_call,
5144
16
      { "Media Type \"Video\" supported for SET UP CALL and Call Control by USIM", "gsm_sim.tp.media_type_video_setup_call",
5145
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5146
16
        NULL, HFILL }
5147
16
    },
5148
16
    { &hf_tp_pa_prov_loci_eutran_timing_advance_info,
5149
16
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (E-UTRAN Timing Advance Information)", "gsm_sim.tp.pa.prov_loci_eutran_timing_advance_info",
5150
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5151
16
        NULL, HFILL }
5152
16
    },
5153
16
    { &hf_tp_refresh_euicc_profile_state_change,
5154
16
      { "REFRESH with \"eUICC Profile State Change\" mode", "gsm_sim.tp.refresh_euicc_profile_state_change",
5155
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5156
16
        NULL, HFILL }
5157
16
    },
5158
16
    { &hf_tp_ext_rej_cause_code_nw_reject_eutran,
5159
16
      { "Extended Rejection Cause Code in Event: Network Rejection for E-UTRAN", "gsm_sim.tp.ext_rej_cause_code_nw_reject_eutran",
5160
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5161
16
        NULL, HFILL }
5162
16
    },
5163
16
    { &hf_tp_deprecated_b34,
5164
16
      { "Deprecated", "gsm_sim.tp.deprecated",
5165
16
        FT_UINT8, BASE_HEX, NULL, 0x80,
5166
16
        NULL, HFILL }
5167
16
    },
5168
5169
    /* Terminal Profile Byte 35 */
5170
16
    { &hf_tprof_b35,
5171
16
      { "Terminal Profile Byte 35", "gsm_sim.tp.b35",
5172
16
        FT_UINT8, BASE_HEX, NULL, 0,
5173
16
        NULL, HFILL },
5174
16
    },
5175
16
    { &hf_tp_pa_get_input_var_timeout,
5176
16
      { "Proactive UICC: GET INPUT (Variable Time out)", "gsm_sim.tp.pa.get_input_var_timeout",
5177
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5178
16
        NULL, HFILL }
5179
16
    },
5180
16
    { &hf_tp_data_conn_status_change_pdp,
5181
16
      { "Data Connection Status Change Event support - PDP Connection", "gsm_sim.tp.data_conn_status_change_pdp",
5182
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5183
16
        NULL, HFILL }
5184
16
    },
5185
16
    { &hf_tp_data_conn_status_change_pdn,
5186
16
      { "Data Connection Status Change Event support - PDN Connection", "gsm_sim.tp.data_conn_status_change_pdn",
5187
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5188
16
        NULL, HFILL }
5189
16
    },
5190
16
    { &hf_tp_refresh_app_update,
5191
16
      { "REFRESH with \"Application Update\" mode", "gsm_sim.tp.refresh_app_update",
5192
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5193
16
        NULL, HFILL }
5194
16
    },
5195
16
    { &hf_tp_pa_lsi_proactive_session_request,
5196
16
      { "Proactive UICC: LSI COMMAND with \"Proactive Session Request\"", "gsm_sim.tp.pa.lsi_proactive_session_request",
5197
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5198
16
        NULL, HFILL }
5199
16
    },
5200
16
    { &hf_tp_pa_lsi_uicc_platform_reset,
5201
16
      { "Proactive UICC: LSI COMMAND with \"UICC Platform Reset\"", "gsm_sim.tp.pa.lsi_uicc_platform_reset",
5202
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5203
16
        NULL, HFILL }
5204
16
    },
5205
16
    { &hf_tp_rfu11,
5206
16
      { "RFU", "gsm_sim.tp.rfu",
5207
16
        FT_UINT8, BASE_HEX, NULL, 0xc0,
5208
16
        NULL, HFILL },
5209
16
    },
5210
5211
    /* Terminal Profile Byte 36 */
5212
16
    { &hf_tprof_b36,
5213
16
      { "Terminal Profile Byte 36", "gsm_sim.tp.b36",
5214
16
        FT_UINT8, BASE_HEX, NULL, 0,
5215
16
        NULL, HFILL },
5216
16
    },
5217
16
    { &hf_tp_data_conn_status_change_pdu,
5218
16
      { "Data Connection Status Change Event support - PDU Connection", "gsm_sim.tp.data_conn_status_change_pdu",
5219
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5220
16
        NULL, HFILL }
5221
16
    },
5222
16
    { &hf_tp_evt_nw_reject_ng_ran,
5223
16
      { "Event: Network Rejection for NG-RAN", "gsm_sim.tp.evt.nw_reject_ng_ran",
5224
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5225
16
        NULL, HFILL }
5226
16
    },
5227
16
    { &hf_tp_non_ip_data_delivery,
5228
16
      { "Non-IP Data Delivery support", "gsm_sim.tp.non_ip_data_delivery",
5229
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5230
16
        NULL, HFILL }
5231
16
    },
5232
16
    { &hf_tp_prov_loci_slice_info,
5233
16
      { "Support of PROVIDE LOCAL INFORMATION, Slice(s) information", "gsm_sim.tp.prov_loci_slice_info",
5234
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5235
16
        NULL, HFILL }
5236
16
    },
5237
16
    { &hf_tp_refresh_sor_cmci_param,
5238
16
      { "REFRESH \"Steering of Roaming\" SOR-CMCI parameter support", "gsm_sim.tp.refresh_sor_cmci_param",
5239
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x10,
5240
16
        NULL, HFILL }
5241
16
    },
5242
16
    { &hf_tp_evt_nw_reject_satellite_ng_ran,
5243
16
      { "Event: Network Rejection for Satellite NG-RAN", "gsm_sim.tp.evt.nw_reject_satellite_ng_ran",
5244
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x20,
5245
16
        NULL, HFILL }
5246
16
    },
5247
16
    { &hf_tp_cag_feature,
5248
16
      { "Support of CAG feature", "gsm_sim.tp.cag_feature",
5249
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x40,
5250
16
        NULL, HFILL }
5251
16
    },
5252
16
    { &hf_tp_evt_slices_status_change,
5253
16
      { "Event: Slices Status Change", "gsm_sim.tp.evt.slices_status_change",
5254
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x80,
5255
16
        NULL, HFILL }
5256
16
    },
5257
5258
    /* Terminal Profile Byte 37 */
5259
16
    { &hf_tprof_b37,
5260
16
      { "Terminal Profile Byte 37", "gsm_sim.tp.b37",
5261
16
        FT_UINT8, BASE_HEX, NULL, 0,
5262
16
        NULL, HFILL },
5263
16
    },
5264
16
    { &hf_tp_prov_loci_rejected_slice_info,
5265
16
      { "Support of PROVIDE LOCAL INFORMATION, Rejected Slice(s) Information", "gsm_sim.tp.prov_loci_rejected_slice_info",
5266
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5267
16
        NULL, HFILL }
5268
16
    },
5269
16
    { &hf_tp_ext_info_pli,
5270
16
      { "Support of Extended information for PLI (Location Information), Event: Location Status, Event: Network Rejection", "gsm_sim.tp.ext_info_pli",
5271
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5272
16
        NULL, HFILL }
5273
16
    },
5274
16
    { &hf_tp_chaining_pli_env_cmds,
5275
16
      { "Support of chaining of PLI/Envelope commands", "gsm_sim.tp.chaining_pli_env_cmds",
5276
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5277
16
        NULL, HFILL }
5278
16
    },
5279
16
    { &hf_tp_5g_prose_usage_info_reporting,
5280
16
      { "5G ProSe usage information reporting", "gsm_sim.tp.5g_prose_usage_info_reporting",
5281
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5282
16
        NULL, HFILL }
5283
16
    },
5284
16
    { &hf_tp_rfu12,
5285
16
      { "RFU", "gsm_sim.tp.rfu",
5286
16
        FT_UINT8, BASE_HEX, NULL, 0xf0,
5287
16
        NULL, HFILL },
5288
16
    },
5289
5290
    /* Terminal Profile Byte 38 */
5291
16
    { &hf_tprof_b38,
5292
16
      { "Terminal Profile Byte 38", "gsm_sim.tp.b38",
5293
16
        FT_UINT8, BASE_HEX, NULL, 0,
5294
16
        NULL, HFILL },
5295
16
    },
5296
16
    { &hf_tp_rfu13,
5297
16
      { "RFU", "gsm_sim.tp.rfu",
5298
16
        FT_UINT8, BASE_HEX, NULL, 0xff,
5299
16
        NULL, HFILL },
5300
16
    },
5301
5302
    /* Terminal Profile Byte 39 */
5303
16
    { &hf_tprof_b39,
5304
16
      { "Terminal Profile Byte 39", "gsm_sim.tp.b39",
5305
16
        FT_UINT8, BASE_HEX, NULL, 0,
5306
16
        NULL, HFILL },
5307
16
    },
5308
16
    { &hf_tp_pa_prov_loci_ng_ran_satellite_timing_advance_info,
5309
16
      { "Proactive UICC: PROVIDE LOCAL INFORMATION (NG-RAN/Satellite NG-RAN Timing Advance Information)", "gsm_sim.tp.pa.prov_loci_ng_ran_satellite_timing_advance_info",
5310
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5311
16
        NULL, HFILL }
5312
16
    },
5313
16
    { &hf_tp_rfu14,
5314
16
      { "RFU", "gsm_sim.tp.rfu",
5315
16
        FT_UINT8, BASE_HEX, NULL, 0xfe,
5316
16
        NULL, HFILL },
5317
16
    },
5318
5319
    /* Terminal Capability */
5320
16
    { &hf_tc,
5321
16
      { "Terminal Capability", "gsm_sim.tc",
5322
16
        FT_BYTES, BASE_NONE, NULL, 0,
5323
16
        NULL, HFILL }
5324
16
    },
5325
16
    { &hf_tc_tag,
5326
16
      { "Tag", "gsm_sim.tc.tag",
5327
16
        FT_UINT8, BASE_HEX, VALS(terminal_capability_tag_vals), 0,
5328
16
        NULL, HFILL }
5329
16
    },
5330
16
    { &hf_tc_len,
5331
16
      { "Length", "gsm_sim.tc.len",
5332
16
        FT_UINT32, BASE_DEC, NULL, 0,
5333
16
        NULL, HFILL }
5334
16
    },
5335
16
    { &hf_tc_value,
5336
16
      { "Value", "gsm_sim.tc.value",
5337
16
        FT_BYTES, BASE_NONE, NULL, 0,
5338
16
        NULL, HFILL }
5339
16
    },
5340
16
    { &hf_tc_actual_used_supply_voltage_class,
5341
16
      { "Actual used supply voltage class", "gsm_sim.tc.actual_used_supply_voltage_class",
5342
16
        FT_UINT8, BASE_HEX, VALS(supply_voltage_class_vals), 0,
5343
16
        NULL, HFILL }
5344
16
    },
5345
16
    { &hf_tc_max_available_power_supply,
5346
16
      { "Maximum available power supply", "gsm_sim.tc.max_available_power_supply",
5347
16
        FT_UINT8, BASE_DEC|BASE_UNIT_STRING, UNS(&units_milliamps), 0,
5348
16
        NULL, HFILL }
5349
16
    },
5350
16
    { &hf_tc_actual_used_clock_frequency,
5351
16
      { "Actual used clock frequency", "gsm_sim.tc.actual_used_clock_frequency",
5352
16
        FT_UINT8, BASE_CUSTOM, CF_FUNC(power_consumption_frequency_cf), 0,
5353
16
        NULL, HFILL }
5354
16
    },
5355
16
    { &hf_tc_additional_interfaces_uicc_clf,
5356
16
      { "UICC-CLF", "gsm_sim.tc.additional_interfaces.uicc_clf",
5357
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5358
16
        NULL, HFILL }
5359
16
    },
5360
16
    { &hf_tc_additional_interfaces_rfu,
5361
16
      { "RFU", "gsm_sim.tc.additional_interfaces.rfu",
5362
16
        FT_UINT8, BASE_HEX, NULL, 0xFE,
5363
16
        NULL, HFILL }
5364
16
    },
5365
16
    { &hf_tc_sgp22_luid,
5366
16
      { "LUId", "gsm_sim.tc.sgp22.luid",
5367
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5368
16
        NULL, HFILL }
5369
16
    },
5370
16
    { &hf_tc_sgp22_lpdd,
5371
16
      { "LPDd", "gsm_sim.tc.sgp22.lpdd",
5372
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x02,
5373
16
        NULL, HFILL }
5374
16
    },
5375
16
    { &hf_tc_sgp22_ldsd,
5376
16
      { "LDSd", "gsm_sim.tc.sgp22.ldsd",
5377
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x04,
5378
16
        NULL, HFILL }
5379
16
    },
5380
16
    { &hf_tc_sgp22_luie,
5381
16
      { "LUIe", "gsm_sim.tc.sgp22.luie",
5382
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x08,
5383
16
        NULL, HFILL }
5384
16
    },
5385
16
    { &hf_tc_sgp22_rfu,
5386
16
      { "RFU", "gsm_sim.tc.sgp22.rfu",
5387
16
        FT_UINT8, BASE_HEX, NULL, 0xF0,
5388
16
        NULL, HFILL }
5389
16
    },
5390
16
    { &hf_tc_sgp32_ipad,
5391
16
      { "IPAd", "gsm_sim.tc.sgp32.ipad",
5392
16
        FT_BOOLEAN, 8, TFS(&tfs_supported_not_supported), 0x01,
5393
16
        NULL, HFILL }
5394
16
    },
5395
16
    { &hf_tc_sgp32_rfu,
5396
16
      { "RFU", "gsm_sim.tc.sgp32.rfu",
5397
16
        FT_UINT8, BASE_HEX, NULL, 0xFE,
5398
16
        NULL, HFILL }
5399
16
    },
5400
5401
16
    { &hf_tprof_unknown_byte,
5402
16
      { "Unknown Terminal Profile Byte", "gsm_sim.tp.unknown_byte",
5403
16
        FT_UINT8, BASE_HEX, NULL, 0,
5404
16
        NULL, HFILL },
5405
16
    },
5406
5407
16
    { &hf_cat_ber_tag,
5408
16
      { "BER-TLV Tag", "gsm_sim.cat.ber_tlv_tag",
5409
16
        FT_UINT8, BASE_HEX, VALS(ber_tlv_cat_tag_vals), 0,
5410
16
        "Card Application Toolkit BER-TLV tag", HFILL },
5411
16
    },
5412
5413
16
    { &hf_search_ef_identifier,
5414
16
      { "EF Identifier", "gsm_sim.search_ef_identifier",
5415
16
      FT_UINT8, BASE_DEC|BASE_SPECIAL_VALS, VALS(search_ef_identifier_vals), 0xF8,
5416
16
      NULL, HFILL },
5417
16
    },
5418
16
    { &hf_search_mode,
5419
16
      { "Search Mode", "gsm_sim.search_mode",
5420
16
        FT_UINT8, BASE_HEX, VALS(search_mode_vals), 0x07,
5421
16
        NULL, HFILL },
5422
16
    },
5423
16
    { &hf_search_enhanced_type,
5424
16
      { "Enhanced Search Type", "gsm_sim.search_enhanced_type",
5425
16
      FT_UINT8, BASE_HEX, VALS(search_enhanced_type), 0xF8,
5426
16
      NULL, HFILL },
5427
16
    },
5428
16
    { &hf_search_enhanced_mode,
5429
16
      { "Enhanced Search Mode", "gsm_sim.search_enhanced_mode",
5430
16
      FT_UINT8, BASE_HEX, VALS(search_enhanced_mode_vals), 0x07,
5431
16
      NULL, HFILL },
5432
16
    },
5433
16
    { &hf_search_enhanced_offset,
5434
16
      { "Enhanced Search Offset", "gsm_sim.search_enhanced_offset",
5435
16
      FT_UINT8, BASE_DEC, NULL, 0x0,
5436
16
      NULL, HFILL },
5437
16
    },
5438
16
    { &hf_search_enhanced_value,
5439
16
      { "Enhanced Search Value", "gsm_sim.search_enhanced_value",
5440
16
      FT_UINT8, BASE_DEC, NULL, 0x0,
5441
16
      NULL, HFILL },
5442
16
    },
5443
5444
16
    { &hf_related_to,
5445
16
      { "Related To", "gsm_sim.related_to",
5446
16
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
5447
16
        "This APDU is related to the command in this frame", HFILL }
5448
16
    },
5449
16
    { &hf_response_in,
5450
16
      { "Response In", "gsm_sim.response_in",
5451
16
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_RESPONSE), 0x0,
5452
16
        "The response to this command is in this frame", HFILL }
5453
16
    },
5454
16
    { &hf_response_to,
5455
16
      { "Response To", "gsm_sim.response_to",
5456
16
        FT_FRAMENUM, BASE_NONE, FRAMENUM_TYPE(FT_FRAMENUM_REQUEST), 0x0,
5457
16
        "This is the response to the command in this frame", HFILL }
5458
16
    },
5459
16
    { &hf_response_time,
5460
16
      { "Response Time", "gsm_sim.response_time",
5461
16
        FT_RELATIVE_TIME, BASE_NONE, NULL, 0x0,
5462
16
        "The time between the command and the response", HFILL }
5463
16
    },
5464
5465
    /* Fragment entries */
5466
16
    { &hf_gsm_sim_fragments,
5467
16
      { "APDU fragments", "gsm_sim.fragments", FT_NONE, BASE_NONE,
5468
16
        NULL, 0x00, NULL, HFILL }
5469
16
    },
5470
16
    { &hf_gsm_sim_fragment,
5471
16
      { "APDU fragment", "gsm_sim.fragment", FT_FRAMENUM, BASE_NONE,
5472
16
        NULL, 0x00, NULL, HFILL }
5473
16
    },
5474
16
    { &hf_gsm_sim_fragment_overlap,
5475
16
      { "APDU fragment overlap", "gsm_sim.fragment.overlap", FT_BOOLEAN,
5476
16
        BASE_NONE, NULL, 0x0, NULL, HFILL }
5477
16
    },
5478
16
    { &hf_gsm_sim_fragment_overlap_conflicts,
5479
16
      { "APDU fragment overlapping with conflicting data",
5480
16
        "gsm_sim.fragment.overlap.conflicts", FT_BOOLEAN, BASE_NONE,
5481
16
        NULL, 0x0, NULL, HFILL }
5482
16
    },
5483
16
    { &hf_gsm_sim_fragment_multiple_tails,
5484
16
      { "APDU has multiple tail fragments",
5485
16
        "gsm_sim.fragment.multiple_tails", FT_BOOLEAN, BASE_NONE,
5486
16
        NULL, 0x0, NULL, HFILL }
5487
16
    },
5488
16
    { &hf_gsm_sim_fragment_too_long_fragment,
5489
16
      { "APDU fragment too long", "gsm_sim.fragment.too_long_fragment",
5490
16
        FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL }
5491
16
    },
5492
16
    { &hf_gsm_sim_fragment_error,
5493
16
      { "APDU defragmentation error", "gsm_sim.fragment.error", FT_FRAMENUM,
5494
16
        BASE_NONE, NULL, 0x00, NULL, HFILL }
5495
16
    },
5496
16
    { &hf_gsm_sim_fragment_count,
5497
16
      { "APDU fragment count", "gsm_sim.fragment.count", FT_UINT32, BASE_DEC,
5498
16
        NULL, 0x00, NULL, HFILL }
5499
16
    },
5500
16
    { &hf_gsm_sim_reassembled_in,
5501
16
      { "Reassembled APDU in frame", "gsm_sim.reassembled.in", FT_FRAMENUM, BASE_NONE,
5502
16
        NULL, 0x00, "This APDU packet is reassembled in this frame", HFILL }
5503
16
    },
5504
16
    { &hf_gsm_sim_reassembled_length,
5505
16
      { "Reassembled APDU length", "gsm_sim.reassembled.length", FT_UINT32, BASE_DEC,
5506
16
        NULL, 0x00, "The total length of the reassembled payload", HFILL }
5507
16
    },
5508
16
  };
5509
16
  static int *ett[] = {
5510
16
    &ett_sim,
5511
16
    &ett_tprof_b1,
5512
16
    &ett_tprof_b2,
5513
16
    &ett_tprof_b3,
5514
16
    &ett_tprof_b4,
5515
16
    &ett_tprof_b5,
5516
16
    &ett_tprof_b6,
5517
16
    &ett_tprof_b7,
5518
16
    &ett_tprof_b8,
5519
16
    &ett_tprof_b9,
5520
16
    &ett_tprof_b10,
5521
16
    &ett_tprof_b11,
5522
16
    &ett_tprof_b12,
5523
16
    &ett_tprof_b13,
5524
16
    &ett_tprof_b14,
5525
16
    &ett_tprof_b15,
5526
16
    &ett_tprof_b16,
5527
16
    &ett_tprof_b17,
5528
16
    &ett_tprof_b18,
5529
16
    &ett_tprof_b19,
5530
16
    &ett_tprof_b20,
5531
16
    &ett_tprof_b21,
5532
16
    &ett_tprof_b22,
5533
16
    &ett_tprof_b23,
5534
16
    &ett_tprof_b24,
5535
16
    &ett_tprof_b25,
5536
16
    &ett_tprof_b26,
5537
16
    &ett_tprof_b27,
5538
16
    &ett_tprof_b28,
5539
16
    &ett_tprof_b29,
5540
16
    &ett_tprof_b30,
5541
16
    &ett_tprof_b31,
5542
16
    &ett_tprof_b32,
5543
16
    &ett_tprof_b33,
5544
16
    &ett_tprof_b34,
5545
16
    &ett_tprof_b35,
5546
16
    &ett_tprof_b36,
5547
16
    &ett_tprof_b37,
5548
16
    &ett_tprof_b38,
5549
16
    &ett_tprof_b39,
5550
16
    &ett_terminal_capability,
5551
16
    &ett_auth_challenge,
5552
16
    &ett_auth_response,
5553
16
    &ett_fcp,
5554
16
    &ett_fcp_proprietary,
5555
16
    &ett_gsm_sim_fragment,
5556
16
    &ett_gsm_sim_fragments,
5557
16
  };
5558
5559
16
  static ei_register_info ei[] = {
5560
16
    { &ei_unknown_bytes, { "gsm_sim.unknown_bytes", PI_PROTOCOL, PI_WARN, "Unknown bytes", EXPFILL }},
5561
16
  };
5562
16
  expert_module_t *expert_gsm_sim;
5563
16
  module_t *gsm_sim_module;
5564
5565
16
  proto_gsm_sim = proto_register_protocol("GSM SIM 11.11", "GSM SIM",
5566
16
             "gsm_sim");
5567
5568
16
  proto_register_field_array(proto_gsm_sim, hf, array_length(hf));
5569
16
  proto_register_subtree_array(ett, array_length(ett));
5570
16
  expert_gsm_sim = expert_register_protocol(proto_gsm_sim);
5571
16
  expert_register_field_array(expert_gsm_sim, ei, array_length(ei));
5572
5573
16
  gsm_sim_module = prefs_register_protocol(proto_gsm_sim, NULL);
5574
16
  prefs_register_enum_preference(gsm_sim_module, "rsp_type", "eUICC type",
5575
16
               "Remote SIM Provisioning specification used for ES10 messages redefined in SGP.32. "
5576
16
               "Automatic uses the ISD-R SELECT response, or the ES10 messages seen.",
5577
16
               &pref_rsp_type, rsp_type_vals, false);
5578
5579
16
  transactions = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
5580
16
  rsp_types = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
5581
16
  reassembly_table_register (&gsm_sim_reassembly_table, &addresses_reassembly_table_functions);
5582
5583
  /* This dissector is for SIMtrace, which always combines the command
5584
   * & response APDUs into one packet before sending it to GSMTAP. Cf.
5585
   * https://github.com/yarrick/scsniff/issues/1#issuecomment-2295835330
5586
   */
5587
16
  sim_handle = register_dissector("gsm_sim", dissect_gsm_sim, proto_gsm_sim);
5588
16
  register_dissector("gsm_sim.command", dissect_gsm_sim_command, proto_gsm_sim);
5589
16
  register_dissector("gsm_sim.response", dissect_gsm_sim_response, proto_gsm_sim);
5590
16
  register_dissector("gsm_sim.bertlv", dissect_bertlv, proto_gsm_sim);
5591
16
  sim_part_handle = register_dissector("gsm_sim.part", dissect_gsm_sim_part, proto_gsm_sim);
5592
16
}
5593
5594
void
5595
proto_reg_handoff_gsm_sim(void)
5596
16
{
5597
16
  dissector_add_for_decode_as("usbccid.subdissector", sim_part_handle);
5598
5599
16
  sub_handle_cap = find_dissector_add_dependency("etsi_cat", proto_gsm_sim);
5600
16
}
5601
5602
/*
5603
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
5604
 *
5605
 * Local variables:
5606
 * c-basic-offset: 8
5607
 * tab-width: 8
5608
 * indent-tabs-mode: t
5609
 * End:
5610
 *
5611
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
5612
 * :indentSize=8:tabSize=8:noTabs=false:
5613
 */