epan/dissectors/pidl/ C99 drsuapi
[wireshark-sm.git] / epan / dissectors / packet-wai.c
blob625042b67ee6b8c757faae13830f94a84d0f359b
1 /* packet-wai.c
2 * Routines for WAI packet dissection
3 * Based on: WAPI ISO submission - ISO/IEC JTC 1 N 9880 [ref: 1]
4 * chapter "8.1.4 WAI protocol"
6 * Written by Lukasz Kotasa <lukasz.kotasa@tieto.com>
7 * Lukasz Suchy <lukasz.suchy@tieto.com>
8 * Copyright 2010, Tieto.
10 * Wireshark - Network traffic analyzer
11 * By Gerald Combs <gerald@wireshark.org>
12 * Copyright 1998 Gerald Combs
14 * SPDX-License-Identifier: GPL-2.0-or-later
16 /* Protocol reference:
17 * http://isotc.iso.org/livelink/livelink?func=ll&objId=8500308&objAction=Open&ei=nt-RTKe1IJKTjAeepLS8BQ&usg=AFQjCNEn8hlU_SfoAGkM-X48JL_BL8bptA&sig2=JOHNPrqgCMO4q0cWhAfkow
18 * (chapter: 8.1.4. WAI protocol)
22 #include "config.h"
24 #include <epan/packet.h>
25 #include <epan/etypes.h>
26 #include <epan/reassemble.h>
27 #include <epan/tfs.h>
28 #include <wsutil/array.h>
30 #define WAI_SUB_PRE_AUTHENTICATION 0x01 /* pre-authentication start */
31 #define WAI_SUB_STAKEY_REQ 0x02 /* STAKey request */
32 #define WAI_SUB_AUTH_ACTIVATION 0x03 /* authentication activation */
33 #define WAI_SUB_ACCESS_AUTH_REQ 0x04 /* access authentication request */
34 #define WAI_SUB_ACCESS_AUTH_RESP 0x05 /* access authentication response */
35 #define WAI_SUB_CERT_AUTH_REQ 0x06 /* certificate authentication request */
36 #define WAI_SUB_CERT_AUTH_RESP 0x07 /* certificate authentication response */
37 #define WAI_SUB_UNICAST_KEY_REQ 0x08 /* unicast key negotiation request */
38 #define WAI_SUB_UNICAST_KEY_RESP 0x09 /* unicast key negotiation response */
39 #define WAI_SUB_UNICAST_KEY_CONFIRM 0x0A /* unicast key negotiation confirmation */
40 #define WAI_SUB_MULTICAST_ANNOUNCE 0x0B /* multicast key/STAKey announcement */
41 #define WAI_SUB_MULTICAST_ANNOUNCE_RESP 0x0C /* multicast key/STAKey announcement response */
43 #define FLAG_BIT0 0x01
44 #define FLAG_BIT1 0x02
45 #define FLAG_BIT2 0x04
46 #define FLAG_BIT3 0x08
47 #define FLAG_BIT4 0x10
48 #define FLAG_BIT5 0x20
49 #define FLAG_BIT6 0x40
50 #define FLAG_BIT7 0x80
52 void proto_register_wai(void);
53 void proto_reg_handoff_wai(void);
55 static reassembly_table wai_reassembly_table;
57 static dissector_handle_t wai_handle;
59 static int proto_wai;
61 static int hf_wai_version;
62 static int hf_wai_type;
63 static int hf_wai_subtype;
64 static int hf_wai_reserved;
65 static int hf_wai_length;
66 static int hf_wai_seq;
67 static int hf_wai_fragm_seq;
68 static int hf_wai_flag;
69 static int hf_wai_data;
70 static int hf_wai_bk_rekeying_flag;
71 static int hf_wai_preauthentication_flag;
72 static int hf_wai_certificate_flag;
73 static int hf_wai_optional_flag;
74 static int hf_wai_usk_rekeying_flag;
75 static int hf_wai_negotiation_flag;
76 static int hf_wai_revoking_flag;
77 static int hf_wai_reserved_flag;
78 static int hf_wai_attr_type;
79 static int hf_wai_cert;
80 static int hf_wai_cert_id;
81 static int hf_wai_cert_data;
82 static int hf_wai_cert_len;
83 static int hf_wai_addid;
84 static int hf_wai_ae_mac;
85 static int hf_wai_asue_mac;
86 static int hf_wai_bkid;
87 static int hf_wai_uskid;
88 static int hf_wai_wie;
89 static int hf_wai_message_auth_code;
90 static int hf_wai_mskid;
91 static int hf_wai_data_pack_num;
92 static int hf_wai_key_data;
93 static int hf_wai_key_data_len;
94 static int hf_wai_key_data_content;
95 static int hf_wai_key_ann_id;
96 static int hf_wai_auth_id;
97 static int hf_wai_identity;
98 static int hf_wai_identity_id;
99 static int hf_wai_identity_len;
100 static int hf_wai_identity_data;
101 static int hf_wai_ecdh;
102 static int hf_wai_ecdh_id;
103 static int hf_wai_ecdh_len;
104 static int hf_wai_ecdh_content;
105 static int hf_wai_counter;
106 static int hf_wai_sta_key_id;
107 static int hf_wai_challenge;
108 static int hf_wai_cert_ver;
109 static int hf_wai_nonce;
110 static int hf_wai_ver_res;
111 static int hf_wai_sign_alg;
112 static int hf_wai_hash_alg_id;
113 static int hf_wai_sign_alg_id;
114 static int hf_wai_param;
115 static int hf_wai_param_id;
116 static int hf_wai_param_content;
117 static int hf_wai_sign_val;
118 static int hf_wai_sign_content;
119 static int hf_wai_sign;
120 static int hf_wai_identity_list;
121 static int hf_wai_reserved_byte;
122 static int hf_wai_no_of_ids;
123 static int hf_wai_access_res;
124 static int hf_wai_fragments;
125 static int hf_wai_fragment;
126 static int hf_wai_fragment_overlap;
127 static int hf_wai_fragment_overlap_conflicts;
128 static int hf_wai_fragment_multiple_tails;
129 static int hf_wai_fragment_too_long_fragment;
130 static int hf_wai_fragment_error;
131 static int hf_wai_fragment_count;
132 static int hf_wai_reassembled_in;
133 static int hf_wai_reassembled_length;
135 static int ett_wai;
136 static int ett_wai_data;
137 static int ett_wai_flags;
138 static int ett_wai_certificate;
139 static int ett_wai_mac;
140 static int ett_wai_identity;
141 static int ett_wai_key_data;
142 static int ett_wai_ecdh_param;
143 static int ett_wai_certificate_verification;
144 static int ett_wai_identity_list;
145 static int ett_wai_sign;
146 static int ett_wai_sign_alg;
147 static int ett_wai_sign_val;
148 static int ett_wai_parameter;
149 static int ett_wai_fragment;
150 static int ett_wai_fragments;
152 static const value_string wai_type_names [] = {
153 { 1, "WAI protocol package"},
154 { 0, NULL }
157 static const value_string wai_attr_type_names [] = {
158 { 1, "Signature"},
159 { 2, "Certificate Authentication Result"},
160 { 3, "Identity List"},
161 { 0, NULL }
164 static const value_string wai_ver_res_names [] = {
165 { 0, "Certificate is valid" },
166 { 1, "Certificate issuer is unknown"},
167 { 2, "Root certificate is untrusted"},
168 { 3, "Certificate time is invalid"},
169 { 4, "Certificate signature is invalid"},
170 { 5, "Certificate is revoked"},
171 { 6, "Certificate is not valid in its proposed usage"},
172 { 7, "Certificate revocation state is unknown"},
173 { 8, "Certificate has an unknown error"},
174 { 0, NULL }
177 static const value_string wai_access_res_names [] = {
178 { 0, "Success" },
179 { 1, "Unidentified certificate"},
180 { 2, "Certificate Error"},
181 { 3, "Prohibited by AE"},
182 { 0, NULL }
185 static const fragment_items wai_frag_items = {
186 /* Fragment subtrees */
187 &ett_wai_fragment,
188 &ett_wai_fragments,
189 /* Fragment fields */
190 &hf_wai_fragments,
191 &hf_wai_fragment,
192 &hf_wai_fragment_overlap,
193 &hf_wai_fragment_overlap_conflicts,
194 &hf_wai_fragment_multiple_tails,
195 &hf_wai_fragment_too_long_fragment,
196 &hf_wai_fragment_error,
197 &hf_wai_fragment_count,
198 /* Reassembled in field */
199 &hf_wai_reassembled_in,
200 /* Reassembled length field */
201 &hf_wai_reassembled_length,
202 /* Reassembled data field */
203 NULL,
204 /* Tag */
205 "Message fragments"
208 static const value_string wai_subtype_names[] = {
209 { WAI_SUB_PRE_AUTHENTICATION, "Pre-Authentication start" },
210 { WAI_SUB_STAKEY_REQ, "STAKey request" },
211 { WAI_SUB_AUTH_ACTIVATION, "Authentication activation" },
212 { WAI_SUB_ACCESS_AUTH_REQ, "Access authentication request" },
213 { WAI_SUB_ACCESS_AUTH_RESP, "Access authentication response" },
214 { WAI_SUB_CERT_AUTH_REQ, "Certificate authentication request" },
215 { WAI_SUB_CERT_AUTH_RESP, "Certificate authentication response" },
216 { WAI_SUB_UNICAST_KEY_REQ, "Unicast key negotiation request" },
217 { WAI_SUB_UNICAST_KEY_RESP, "Unicast key negotiation response" },
218 { WAI_SUB_UNICAST_KEY_CONFIRM, "Unicast key negotiation confirmation" },
219 { WAI_SUB_MULTICAST_ANNOUNCE, "Multicast key/STAKey announcement" },
220 { WAI_SUB_MULTICAST_ANNOUNCE_RESP, "Multicast key/STAKey announcement response" },
221 { 0, NULL }
223 static value_string_ext wai_subtype_names_ext = VALUE_STRING_EXT_INIT(wai_subtype_names);
225 static const true_false_string wai_bk_rekeying_flag = {
226 "Packet is a BK rekeying packet",
227 "Packet is not a BK rekeying packet"
230 static const true_false_string wai_preauthentication_flag = {
231 "Packet is a pre-authentication packet",
232 "Packet is not a pre-authentication packet"
235 static const true_false_string wai_certificate_flag = {
236 "STA requires to verify the peers certificate",
237 "STA doesn't require to verify the peers certificate"
240 static const true_false_string wai_optional_flag = {
241 "There are some optional fields in packet",
242 "No optional fields in packet"
245 static const true_false_string wai_usk_rekeying_flag = {
246 "Packet is a USK rekeying packet",
247 "Packet is not a USK rekeying packet"
250 static const true_false_string wai_negotiation_flag = {
251 "Packet is a STAKey negotiation packet",
252 "Packet is not a STAKey negotiation packet"
255 static const true_false_string wai_revoking_flag = {
256 "STA delete a STAKey",
257 "STA doesn't delete a STAKey"
260 static const true_false_string wai_reserved_flag = {
261 "reserved 1",
262 "reserved 0"
265 static void
266 dissect_flag(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
268 proto_item *flag_item;
269 proto_tree *flag_tree;
271 flag_item = proto_tree_add_item(tree, hf_wai_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
272 flag_tree = proto_item_add_subtree (flag_item, ett_wai_flags);
274 proto_tree_add_item (flag_tree, hf_wai_bk_rekeying_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
275 proto_tree_add_item (flag_tree, hf_wai_preauthentication_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
276 proto_tree_add_item (flag_tree, hf_wai_certificate_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
277 proto_tree_add_item (flag_tree, hf_wai_optional_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
278 proto_tree_add_item (flag_tree, hf_wai_usk_rekeying_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
279 proto_tree_add_item (flag_tree, hf_wai_negotiation_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
280 proto_tree_add_item (flag_tree, hf_wai_revoking_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
281 proto_tree_add_item (flag_tree, hf_wai_reserved_flag, tvb, offset, 1, ENC_BIG_ENDIAN);
284 inline static void
285 dissect_bkid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
287 proto_tree_add_item(tree, hf_wai_bkid, tvb, offset, 16, ENC_NA);
290 inline static void
291 dissect_uskid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
293 proto_tree_add_item(tree, hf_wai_uskid, tvb, offset, 1, ENC_NA);
296 inline static void dissect_wie(tvbuff_t *tvb, unsigned offset, unsigned length, proto_tree *tree)
298 proto_tree_add_item(tree, hf_wai_wie, tvb, offset, length, ENC_NA);
301 inline static void
302 dissect_message_auth_code(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
304 proto_tree_add_item(tree, hf_wai_message_auth_code, tvb, offset, 20, ENC_NA);
307 inline static void
308 dissect_mskid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
310 proto_tree_add_item(tree, hf_wai_mskid, tvb, offset, 1, ENC_NA);
313 inline static void
314 dissect_key_announcement_identifier(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
316 proto_tree_add_item(tree, hf_wai_key_ann_id, tvb, offset, 16, ENC_NA);
319 inline static void
320 dissect_counter(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
322 proto_tree_add_item(tree, hf_wai_counter, tvb, offset, 16, ENC_NA);
325 inline static void
326 dissect_authentication_id(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
328 proto_tree_add_item(tree, hf_wai_auth_id, tvb, offset, 32, ENC_NA);
331 static void
332 dissect_addid(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
334 proto_item *mac_item;
335 proto_tree *mac_tree;
337 mac_item = proto_tree_add_string(tree, hf_wai_addid, tvb, offset, 12, "AE MAC and ASUE MAC addresses");
339 mac_tree = proto_item_add_subtree(mac_item, ett_wai_mac);
340 proto_tree_add_item(mac_tree, hf_wai_ae_mac, tvb, offset, 6, ENC_NA);
341 proto_tree_add_item(mac_tree, hf_wai_asue_mac, tvb, offset+6, 6, ENC_NA);
344 static uint16_t
345 dissect_identity(tvbuff_t * tvb, const uint16_t offset, proto_tree * tree,
346 const char * const label)
348 proto_tree *id_tree;
349 proto_item *id_item;
350 uint16_t length;
352 length = tvb_get_ntohs(tvb, offset+2);
354 id_item = proto_tree_add_item(tree, hf_wai_identity, tvb, offset, length+4, ENC_NA);
355 id_tree = proto_item_add_subtree(id_item, ett_wai_identity);
356 proto_item_set_text(id_item, "%sIdentity", ((label==NULL)?"":label));
357 proto_tree_add_item(id_tree, hf_wai_identity_id, tvb, offset, 2, ENC_BIG_ENDIAN);
358 proto_tree_add_item(id_tree, hf_wai_identity_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
359 proto_tree_add_item(id_tree, hf_wai_identity_data, tvb, offset+4, length, ENC_NA);
361 return length + 4;
364 static int16_t
365 dissect_certificate(tvbuff_t * tvb, const int offset, proto_tree * tree,
366 const char * const label)
368 proto_item *certificate_item;
369 proto_tree *certificate_tree;
370 proto_item *id_item;
371 uint16_t length;
372 uint16_t id;
373 const char *id_name = "unknown";
375 id = tvb_get_ntohs(tvb, offset);
377 if (id == 1) {
378 id_name = "X.509 v3";
379 } else if (id == 2){
380 id_name = "GBW";
383 length = tvb_get_ntohs(tvb, offset+2);
385 certificate_item = proto_tree_add_item(tree, hf_wai_cert, tvb, offset, length+4, ENC_NA);
386 proto_item_set_text(certificate_item, "%sCertificate", ((label==NULL)?"":label));
387 certificate_tree = proto_item_add_subtree(certificate_item, ett_wai_certificate);
389 id_item = proto_tree_add_item(certificate_tree, hf_wai_cert_id, tvb, offset, 2, ENC_BIG_ENDIAN);
390 proto_item_set_text(id_item, "Certificate Identifier: %s (%#x)", id_name, id);
391 proto_tree_add_item(certificate_tree, hf_wai_cert_len, tvb, offset+2, 2, ENC_BIG_ENDIAN);
392 proto_tree_add_item(certificate_tree, hf_wai_cert_data, tvb, offset+4, length, ENC_NA);
394 return length + 4;
397 static uint16_t
398 dissect_ecdh_parameter(tvbuff_t * tvb, const int offset, proto_tree * tree)
400 proto_item *ecdh_item;
401 proto_tree *ecdh_tree;
402 proto_item *ecdh_id_item;
403 uint8_t ecdh_id;
404 uint16_t ecdh_len;
405 const char *id_name = "unknown";
407 ecdh_id = tvb_get_uint8(tvb, offset);
409 if (ecdh_id == 1) {
410 id_name = "OID";
411 } else if (ecdh_id == 2) {
412 id_name = "Detailed parameter";
415 ecdh_len = tvb_get_ntohs(tvb, offset+1);
417 ecdh_item = proto_tree_add_item(tree, hf_wai_ecdh, tvb, offset, ecdh_len+3, ENC_NA);
418 ecdh_tree = proto_item_add_subtree(ecdh_item, ett_wai_ecdh_param);
419 ecdh_id_item = proto_tree_add_item(ecdh_tree, hf_wai_ecdh_id, tvb, offset, 1, ENC_BIG_ENDIAN);
420 proto_item_set_text(ecdh_id_item, "ID: %s (%#x)", id_name, ecdh_id);
421 proto_tree_add_item(ecdh_tree, hf_wai_ecdh_len, tvb, offset+1, 2, ENC_BIG_ENDIAN);
422 proto_tree_add_item(ecdh_tree, hf_wai_ecdh_content, tvb, offset+3, ecdh_len, ENC_NA);
424 return ecdh_len + 3;
427 static uint16_t
428 dissect_challenge(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char * const label)
430 proto_item *challenge_item;
431 const uint16_t challenge_length = 32;
433 challenge_item = proto_tree_add_item(tree, hf_wai_challenge, tvb, offset, 32, ENC_NA);
434 proto_item_append_text(challenge_item, "(%schallenge)", ((label==NULL)?"":label));
436 return challenge_length;
439 static uint16_t
440 dissect_key_data(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *const label)
442 proto_item *key_data_item;
443 proto_tree *key_data_tree;
444 uint8_t length;
446 length = tvb_get_uint8(tvb, offset);
448 key_data_item = proto_tree_add_item(tree, hf_wai_key_data, tvb, offset, length+1, ENC_NA);
449 proto_item_set_text(key_data_item, "%sKey Data", ((label==NULL)?"":label));
450 key_data_tree = proto_item_add_subtree(key_data_item, ett_wai_key_data);
451 proto_tree_add_item(key_data_tree, hf_wai_key_data_len, tvb, offset, 1, ENC_BIG_ENDIAN);
453 if (length > 0) {
454 proto_tree_add_item(key_data_tree, hf_wai_key_data_content, tvb, offset+1, length, ENC_NA);
457 return length + 1;
460 static unsigned
461 dissect_multiple_certificate(tvbuff_t * tvb, unsigned offset, proto_tree *tree)
463 proto_item *multicert_item;
464 proto_tree *multicert_tree;
465 proto_item *nonce_1_item;
466 proto_item *nonce_2_item;
467 unsigned length;
469 length = tvb_get_ntohs(tvb, offset+1);
470 multicert_item = proto_tree_add_item(tree, hf_wai_cert_ver, tvb, offset, length+3, ENC_NA);
471 multicert_tree = proto_item_add_subtree(multicert_item, ett_wai_certificate_verification);
472 proto_tree_add_item(multicert_tree, hf_wai_attr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
473 offset += 1;
474 proto_tree_add_item(multicert_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
475 offset += 2;
476 nonce_1_item = proto_tree_add_item(multicert_tree, hf_wai_nonce, tvb, offset, 32, ENC_NA);
477 offset += 32;
478 proto_item_append_text(nonce_1_item, " 1");
479 nonce_2_item = proto_tree_add_item(multicert_tree, hf_wai_nonce, tvb, offset, 32, ENC_NA);
480 offset += 32;
481 proto_item_append_text(nonce_2_item, " 2");
482 proto_tree_add_item(multicert_tree, hf_wai_ver_res, tvb, offset, 1, ENC_BIG_ENDIAN);
483 offset += 1;
484 offset += dissect_certificate(tvb, offset, multicert_tree, "1 ");
485 proto_tree_add_item(multicert_tree, hf_wai_ver_res, tvb, offset, 1, ENC_BIG_ENDIAN);
486 offset += 1;
487 dissect_certificate(tvb, offset, multicert_tree, "2 ");
489 return length + 3;
492 static unsigned
493 dissect_identity_list(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
495 proto_item *id_list_item;
496 proto_tree *id_list_tree;
497 uint16_t length;
498 uint16_t no_of_ids;
499 uint16_t i;
501 length = tvb_get_ntohs(tvb, offset+1);
502 id_list_item = proto_tree_add_item(tree, hf_wai_identity_list, tvb, offset, length+3, ENC_NA);
503 id_list_tree = proto_item_add_subtree(id_list_item, ett_wai_identity_list);
504 proto_tree_add_item(id_list_tree, hf_wai_attr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
505 offset += 1;
506 proto_tree_add_item(id_list_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
507 offset += 2;
508 proto_tree_add_item(id_list_tree, hf_wai_reserved_byte, tvb, offset, 1, ENC_BIG_ENDIAN);
509 offset += 1;
510 proto_tree_add_item(id_list_tree, hf_wai_no_of_ids, tvb, offset, 2, ENC_BIG_ENDIAN);
511 no_of_ids = tvb_get_ntohs(tvb, offset);
512 offset += 2;
514 for(i=0; i < no_of_ids; i++) {
515 char number[6] = {0};
517 snprintf(number, 6, "%d", i);
518 offset += dissect_identity(tvb, offset, id_list_tree, number);
521 return length + 3;
524 static uint16_t
525 dissect_signature_algorithm(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
527 proto_item *sa_item;
528 proto_tree *sa_tree;
529 proto_item *param_item;
530 proto_tree *param_tree;
531 proto_item *alg_name_item;
532 proto_item *sig_name_item;
533 uint16_t length;
534 uint8_t alg_id;
535 uint8_t sig_id;
536 uint16_t param_len;
538 length = tvb_get_ntohs(tvb, offset);
540 sa_item = proto_tree_add_item(tree, hf_wai_sign_alg, tvb, offset, length+2, ENC_NA);
541 sa_tree = proto_item_add_subtree(sa_item, ett_wai_sign_alg);
543 proto_tree_add_item(sa_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
544 offset += 2;
546 alg_name_item = proto_tree_add_item(sa_tree, hf_wai_hash_alg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
547 alg_id = tvb_get_uint8(tvb, offset);
549 if (1 == alg_id) {
550 proto_item_set_text(alg_name_item, "Algorithm Identifier: SHA-256 (0x01)");
553 offset += 1;
554 sig_name_item = proto_tree_add_item(sa_tree, hf_wai_sign_alg_id, tvb, offset, 1, ENC_BIG_ENDIAN);
555 sig_id = tvb_get_uint8(tvb, offset);
557 if (1 == sig_id) {
558 proto_item_set_text(sig_name_item, "Signature Algorithm Identifier: ECDSA-192 (0x01)");
561 offset += 1;
562 param_len = tvb_get_ntohs(tvb, offset+1);
563 param_item = proto_tree_add_item(sa_tree, hf_wai_param, tvb, offset, param_len+3, ENC_NA);
564 param_tree = proto_item_add_subtree(param_item, ett_wai_parameter);
565 proto_tree_add_item(param_tree, hf_wai_param_id, tvb, offset, 1, ENC_NA);
566 offset += 1;
567 proto_tree_add_item(param_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
568 offset += 2;
569 proto_tree_add_item(param_tree, hf_wai_param_content, tvb, offset, param_len, ENC_NA);
571 return length + 2;
574 static uint16_t
575 dissect_signature_value(tvbuff_t *tvb, unsigned offset, proto_tree *tree)
577 proto_item *sv_item;
578 proto_tree *sv_tree;
579 uint16_t length = 0;
581 length = tvb_get_ntohs(tvb, offset);
583 sv_item = proto_tree_add_item(tree, hf_wai_sign_val, tvb, offset, length+2, ENC_NA);
584 sv_tree = proto_item_add_subtree(sv_item, ett_wai_sign_val);
586 proto_tree_add_item(sv_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
587 offset += 2;
589 proto_tree_add_item(sv_tree, hf_wai_sign_content, tvb, offset, length, ENC_NA);
591 return length + 2;
594 static uint16_t
595 dissect_signature(tvbuff_t *tvb, unsigned offset, proto_tree *tree, const char *const label)
597 proto_item *ss_item;
598 proto_tree *ss_tree;
599 unsigned length = 0;
601 length = tvb_get_ntohs(tvb, offset+1);
603 ss_item = proto_tree_add_item(tree, hf_wai_sign, tvb, offset, length+3, ENC_NA);
604 proto_item_set_text(ss_item, "%s", (label==NULL)?"Signature":label);
605 ss_tree = proto_item_add_subtree(ss_item, ett_wai_sign);
607 proto_tree_add_item(ss_tree, hf_wai_attr_type, tvb, offset, 1, ENC_BIG_ENDIAN);
608 offset += 1;
610 proto_tree_add_item(ss_tree, hf_wai_length, tvb, offset, 2, ENC_BIG_ENDIAN);
611 offset += 2;
613 offset += dissect_identity(tvb, offset, ss_tree, NULL);
614 offset += dissect_signature_algorithm(tvb, offset, ss_tree);
615 dissect_signature_value(tvb, offset, ss_tree);
617 return length + 3;
621 static void
622 dissect_wai_data(tvbuff_t *tvb, proto_tree *tree, uint8_t subtype, uint16_t lenx)
624 proto_item *data_item;
625 proto_tree *data_tree;
626 const char *type_name;
628 data_item = proto_tree_add_item(tree, hf_wai_data, tvb, 0, lenx, ENC_NA);
629 data_tree = proto_item_add_subtree (data_item, ett_wai_data);
631 type_name = val_to_str_ext_const(subtype, &wai_subtype_names_ext, "Unknown type");
633 proto_item_set_text(data_item, "%s data (%d bytes)", type_name, lenx);
635 switch (subtype) {
636 case WAI_SUB_PRE_AUTHENTICATION:
638 /* Chapter 8.1.4.6 Preauthentication [ref: 1] */
639 dissect_flag(tvb, 0, data_tree);
640 dissect_uskid(tvb, 1, data_tree);
641 dissect_addid(tvb, 2, data_tree);
642 dissect_counter(tvb, 14, data_tree);
643 dissect_message_auth_code(tvb, 30, data_tree);
644 break;
646 case WAI_SUB_STAKEY_REQ:
648 /* Chapter 8.1.4.5 STAKey Establishment procedure [ref: 1] */
649 dissect_flag(tvb, 0, data_tree);
650 proto_tree_add_item(data_tree, hf_wai_sta_key_id, tvb, 1, 1, ENC_BIG_ENDIAN);
651 dissect_uskid(tvb, 2, data_tree);
652 dissect_addid(tvb, 3, data_tree);
653 dissect_counter(tvb, 15, data_tree);
654 dissect_message_auth_code(tvb, 31, data_tree);
655 break;
657 case WAI_SUB_AUTH_ACTIVATION:
659 /* Chapter 8.1.4.2.1 WAI Authentication Activation [ref: 1] */
660 uint16_t offset = 0;
662 dissect_flag(tvb, offset, data_tree);
663 offset += 1;
664 dissect_authentication_id(tvb, offset, data_tree);
665 offset += 32;
666 offset += dissect_identity(tvb, offset, data_tree, "Local ASU ");
667 offset += dissect_certificate(tvb, offset, data_tree, "STE AE ");
668 dissect_ecdh_parameter(tvb, offset, data_tree);
669 break;
671 case WAI_SUB_ACCESS_AUTH_REQ:
673 /* Chapter 8.1.4.2.2 Access WAI Authentication Request [ref: 1] */
674 uint16_t offset = 0;
675 uint8_t optional_field;
677 optional_field = tvb_get_uint8(tvb, 0) & FLAG_BIT3;
679 dissect_flag(tvb, offset, data_tree);
680 offset += 1;
681 dissect_authentication_id(tvb, offset, data_tree);
682 offset += 32;
683 offset += dissect_challenge(tvb, offset, data_tree, "ASUE ");
684 offset += dissect_key_data(tvb, offset, data_tree, "ASUE ");
685 offset += dissect_identity(tvb, offset, data_tree, "STA AE ");
686 offset += dissect_certificate(tvb, offset, data_tree, "STA ASUE ");
687 offset += dissect_ecdh_parameter(tvb, offset, data_tree);
689 if (optional_field) {
690 offset += dissect_identity_list(tvb, offset, data_tree);
693 dissect_signature(tvb, offset, data_tree, "ASUE Signature");
694 break;
696 case WAI_SUB_ACCESS_AUTH_RESP:
698 /* Chapter 8.1.4.2.5 Access WAI Authentication Response [ref: 1] */
699 uint16_t offset = 0;
700 uint8_t optional_field;
702 optional_field = tvb_get_uint8(tvb, 0) & FLAG_BIT3;
704 dissect_flag(tvb, offset, data_tree);
705 offset += 1;
706 offset += dissect_challenge(tvb, offset, data_tree, "ASUE ");
707 offset += dissect_challenge(tvb, offset, data_tree, "AE ");
708 proto_tree_add_item(data_tree, hf_wai_access_res, tvb, offset, 1, ENC_BIG_ENDIAN);
709 offset += 1;
710 offset += dissect_key_data(tvb, offset, data_tree, "ASUE ");
711 offset += dissect_key_data(tvb, offset, data_tree, "AE ");
712 offset += dissect_identity(tvb, offset, data_tree, "STA AE ");
713 offset += dissect_identity(tvb, offset, data_tree, "STA ASUE ");
715 if (optional_field) {
716 unsigned length = 0;
717 offset += dissect_multiple_certificate(tvb, offset, data_tree);
718 offset += dissect_signature(tvb, offset, data_tree, "Server Signature trusted by ASUE");
719 length = tvb_get_ntohs(tvb, offset+1);
720 if (length + 3 + offset + 1 < lenx)
721 offset += dissect_signature(tvb, offset, data_tree, "Server Signature trusted by AE");
724 dissect_signature(tvb, offset, data_tree, "AE Signature");
725 break;
727 case WAI_SUB_CERT_AUTH_REQ:
729 /* Chapter 8.1.4.2.3 Certificate Authentication Request [ref: 1] */
730 uint16_t offset = 0;
731 uint8_t optional_field;
733 optional_field = tvb_get_uint8(tvb, 0) & FLAG_BIT3;
735 dissect_addid(tvb, offset, data_tree);
736 offset += 12;
737 offset += dissect_challenge(tvb, offset, data_tree, "AE ");
738 offset += dissect_challenge(tvb, offset, data_tree, "ASUE ");
739 offset += dissect_certificate(tvb, offset, data_tree, "STE ASUE ");
740 offset += dissect_certificate(tvb, offset, data_tree, "STE AE ");
741 if (optional_field) {
742 dissect_identity_list(tvb, offset, data_tree);
744 break;
746 case WAI_SUB_CERT_AUTH_RESP:
748 /* Chapter 8.1.4.2.4 Certificate Authentication Response [ref: 1] */
749 uint16_t offset = 0;
751 dissect_addid(tvb, offset, data_tree);
752 offset += 12;
753 offset += dissect_multiple_certificate(tvb, offset, data_tree);
754 offset += dissect_signature(tvb, offset, data_tree, "Server Signature trusted by ASUE");
755 if (offset < lenx)
756 dissect_signature(tvb, offset, data_tree, "Server Signature trusted by AE");
757 break;
759 case WAI_SUB_UNICAST_KEY_REQ:
761 /* Chapter 8.1.4.3.1 Unicast Key Negotiation Request [ref: 1] */
762 dissect_flag(tvb, 0, data_tree);
763 dissect_bkid(tvb, 1, data_tree);
764 dissect_uskid(tvb, 17, data_tree);
765 dissect_addid(tvb, 18, data_tree);
766 dissect_challenge(tvb, 30, data_tree , "AE ");
767 break;
769 case WAI_SUB_UNICAST_KEY_RESP:
771 /* Chapter 8.1.4.3.2 Unicast Key Negotiation Response [ref: 1] */
772 tvbuff_t *next_tvb;
773 unsigned length = 0;
775 dissect_flag(tvb, 0, data_tree);
776 dissect_bkid(tvb, 1, data_tree);
777 dissect_uskid(tvb, 17, data_tree);
778 dissect_addid(tvb, 18, data_tree);
779 dissect_challenge(tvb, 30, data_tree, "ASUE ");
780 dissect_challenge(tvb, 62, data_tree, "AE ");
782 next_tvb = tvb_new_subset_remaining(tvb, 96);
783 length = tvb_reported_length(next_tvb);
785 dissect_wie(next_tvb, 0, length-20, data_tree);
786 dissect_message_auth_code(next_tvb, length-20, data_tree);
787 break;
789 case WAI_SUB_UNICAST_KEY_CONFIRM:
791 /* Chapter 8.1.4.3.3 Unicast Key Negotiation Confirmation [ref: 1] */
792 tvbuff_t *next_tvb;
793 unsigned length = 0;
795 dissect_flag(tvb, 0, data_tree);
796 dissect_bkid(tvb, 1, data_tree);
797 dissect_uskid(tvb, 17, data_tree);
798 dissect_addid(tvb, 18, data_tree);
799 dissect_challenge(tvb, 30, data_tree, "ASUE ");
801 next_tvb = tvb_new_subset_remaining(tvb, 62);
802 length = tvb_reported_length(next_tvb);
804 dissect_wie(next_tvb, 0, length-20, data_tree);
805 dissect_message_auth_code(next_tvb, length-20, data_tree);
806 break;
808 case WAI_SUB_MULTICAST_ANNOUNCE:
810 /* Chapter 8.1.4.4.1 Multicast Key/STAKey Announcement [ref: 1] */
811 uint16_t offset = 0;
813 dissect_flag(tvb, offset, data_tree);
814 offset += 1;
815 dissect_mskid(tvb, offset, data_tree);
816 offset += 1;
817 dissect_uskid(tvb, offset, data_tree);
818 offset += 1;
819 dissect_addid(tvb, offset, data_tree);
820 offset += 12;
821 proto_tree_add_item(data_tree, hf_wai_data_pack_num, tvb, offset, 16, ENC_NA);
822 offset += 16;
823 dissect_key_announcement_identifier(tvb, offset, data_tree);
824 offset += 16;
825 offset += dissect_key_data(tvb, offset, data_tree, NULL);
826 dissect_message_auth_code(tvb, offset, data_tree);
827 break;
829 case WAI_SUB_MULTICAST_ANNOUNCE_RESP:
831 /* Chapter 8.1.4.4.2 Multicast Key/STAKey Announcement Response [ref: 1] */
832 dissect_flag(tvb, 0, data_tree);
833 dissect_mskid(tvb, 1, data_tree);
834 dissect_uskid(tvb, 2, data_tree);
835 dissect_addid(tvb, 3, data_tree);
836 dissect_key_announcement_identifier(tvb, 15, data_tree);
837 dissect_message_auth_code(tvb, 31, data_tree);
838 break;
840 default:
841 break;
845 static int
846 dissect_wai(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
848 /* Format of WAPI protocol packet in WAI authentication system
850 0 2 3 4 6 8 10 11 12
851 -------------------------------------------------------------------------------
852 | Ver. | Type | Subtype | Reserved | Length | packet | fragm. | flag | data |
853 | | seq. no | seq. no | |
854 |-----------------------------------------------------------------------------|
855 Figure 18 from [ref:1]
857 #define WAI_MESSAGE_LENGTH 12 /*Length of all fields without 'Data' field*/
858 #define WAI_DATA_OFFSET WAI_MESSAGE_LENGTH
859 uint16_t version;
860 uint8_t subtype;
861 uint16_t length;
862 uint16_t packet_num;
863 uint8_t fragment_num;
864 uint8_t flags;
865 fragment_head *frag_msg;
866 proto_tree *wai_tree = NULL;
867 tvbuff_t *next_tvb;
868 tvbuff_t *new_tvb;
869 const char *subtype_name = "Unknown type";
871 length = tvb_get_ntohs(tvb, 6)-WAI_MESSAGE_LENGTH;
872 subtype = tvb_get_uint8(tvb, 3);
874 /* quick sanity check */
875 if ((length != tvb_reported_length (tvb)-WAI_MESSAGE_LENGTH) ||
876 (subtype > WAI_SUB_MULTICAST_ANNOUNCE_RESP)) {
877 return 0;
880 col_set_str(pinfo->cinfo, COL_PROTOCOL, "WAI");
881 col_clear(pinfo->cinfo, COL_INFO);
882 version = tvb_get_ntohs(tvb, 0);
884 if (version == 1) {
885 subtype_name = val_to_str_ext_const(subtype, &wai_subtype_names_ext, "Unknown type");
887 col_append_str(pinfo->cinfo, COL_INFO, subtype_name);
889 /* Field lengths and offsets in WAI protocol described above */
890 packet_num = tvb_get_ntohs(tvb, 8);
891 fragment_num = tvb_get_uint8(tvb, 10);
892 flags = tvb_get_uint8(tvb, 11);
894 if (tree) {
895 proto_item *wai_item;
897 wai_item = proto_tree_add_item(tree, proto_wai, tvb, 0, -1, ENC_NA);
899 proto_item_set_text (wai_item, "WAI Protocol (%s)",
900 val_to_str_ext_const(subtype, &wai_subtype_names_ext, "Unknown type"));
901 wai_tree = proto_item_add_subtree(wai_item, ett_wai);
903 /* Field lengths and offsets in WAI protocol described above */
904 proto_tree_add_item(wai_tree, hf_wai_version, tvb, 0, 2, ENC_BIG_ENDIAN);
905 proto_tree_add_item(wai_tree, hf_wai_type, tvb, 2, 1, ENC_BIG_ENDIAN);
906 proto_tree_add_item(wai_tree, hf_wai_subtype, tvb, 3, 1, ENC_BIG_ENDIAN);
907 proto_tree_add_item(wai_tree, hf_wai_reserved, tvb, 4, 2, ENC_BIG_ENDIAN);
908 proto_tree_add_item(wai_tree, hf_wai_length, tvb, 6, 2, ENC_BIG_ENDIAN);
909 proto_tree_add_item(wai_tree, hf_wai_seq, tvb, 8, 2, ENC_BIG_ENDIAN);
910 proto_tree_add_item(wai_tree, hf_wai_fragm_seq, tvb, 10, 1, ENC_BIG_ENDIAN);
911 proto_tree_add_item(wai_tree, hf_wai_flag, tvb, 11, 1, ENC_BIG_ENDIAN);
914 frag_msg = fragment_add_seq_check (&wai_reassembly_table,
915 tvb, WAI_DATA_OFFSET,
916 pinfo,
917 packet_num,
918 NULL,
919 fragment_num,
920 length,
921 flags);
923 next_tvb = tvb_new_subset_remaining(tvb, WAI_DATA_OFFSET);
925 /* Replace INFO column if message is fragmented and call data dissector */
926 if (flags) {
927 col_add_fstr(pinfo->cinfo, COL_INFO,
928 "Fragment (%d) of message, data not dissected", fragment_num);
930 process_reassembled_data(tvb, WAI_DATA_OFFSET, pinfo,
931 "Reassembled WAI", frag_msg, &wai_frag_items,
932 NULL, wai_tree);
934 call_data_dissector(next_tvb, pinfo, tree);
935 } else {
936 /* If this is the last fragment of fragmented message, then reassamble and dissect
937 otherwise only dissect */
938 if (fragment_num > 0) {
939 new_tvb = process_reassembled_data(tvb, WAI_DATA_OFFSET, pinfo,
940 "Reassembled WAI", frag_msg, &wai_frag_items,
941 NULL, wai_tree);
943 if (new_tvb) {
944 col_set_str(pinfo->cinfo, COL_INFO, "Last fragment of message, data dissected");
945 col_append_sep_str(pinfo->cinfo, COL_INFO, ": ", subtype_name);
946 next_tvb=new_tvb;
947 length = tvb_reported_length (next_tvb);
950 /* dissect Data field of WAI packet */
951 if (tree) {
952 dissect_wai_data(next_tvb, wai_tree, subtype, length);
956 return tvb_captured_length(tvb);
959 void
960 proto_register_wai(void)
962 static hf_register_info hf[] = {
963 { &hf_wai_version,
964 { "Version", "wai.version",
965 FT_UINT16, BASE_DEC, NULL, 0x0,
966 "Version of authentication infrastructure", HFILL }},
968 { &hf_wai_type,
969 { "Type", "wai.type",
970 FT_UINT8, BASE_HEX, VALS(wai_type_names), 0x0,
971 "Protocol type", HFILL }},
973 { &hf_wai_subtype,
974 { "Subtype", "wai.subtype",
975 FT_UINT8, BASE_DEC|BASE_EXT_STRING, &wai_subtype_names_ext, 0x0,
976 NULL, HFILL }},
978 { &hf_wai_reserved,
979 { "Reserved", "wai.reserved",
980 FT_UINT16, BASE_HEX, NULL, 0x0,
981 NULL, HFILL }},
983 { &hf_wai_length,
984 { "Length", "wai.length",
985 FT_UINT16, BASE_DEC, NULL, 0x0,
986 NULL, HFILL }},
988 { &hf_wai_seq,
989 { "Sequence number", "wai.seq",
990 FT_UINT16, BASE_DEC, NULL, 0x0,
991 "Packet sequence number", HFILL }},
993 { &hf_wai_fragm_seq,
994 { "Fragment sequence number", "wai.fragm.seq",
995 FT_UINT8, BASE_DEC, NULL, 0x0,
996 NULL, HFILL }},
998 { &hf_wai_flag,
999 { "Flag", "wai.flag",
1000 FT_UINT8, BASE_HEX, NULL, 0x0,
1001 NULL, HFILL }},
1003 { &hf_wai_data,
1004 { "Data", "wai.data",
1005 FT_BYTES, BASE_NONE, NULL, 0x0,
1006 NULL, HFILL }},
1008 { &hf_wai_bk_rekeying_flag,
1009 {"BK rekeying", "wai.bk.rekeying.flag",
1010 FT_BOOLEAN, 8, TFS (&wai_bk_rekeying_flag), FLAG_BIT0,
1011 "BK rekeying flag", HFILL }},
1013 { &hf_wai_preauthentication_flag,
1014 {"Pre-Authentication", "wai.preauthentication.flag",
1015 FT_BOOLEAN, 8, TFS (&wai_preauthentication_flag), FLAG_BIT1,
1016 "Pre-Authentication flag", HFILL }},
1018 { &hf_wai_certificate_flag,
1019 {"Certificate", "wai.certificate.flag",
1020 FT_BOOLEAN, 8, TFS (&wai_certificate_flag), FLAG_BIT2,
1021 "Certificate flag", HFILL }},
1023 { &hf_wai_optional_flag,
1024 {"Optional", "wai.optional.flag",
1025 FT_BOOLEAN, 8, TFS (&wai_optional_flag), FLAG_BIT3,
1026 "Optional flag", HFILL }},
1028 { &hf_wai_usk_rekeying_flag,
1029 {"USK rekeying", "wai.usk.rekeying.flag",
1030 FT_BOOLEAN, 8, TFS (&wai_usk_rekeying_flag), FLAG_BIT4,
1031 "USK rekeying flag", HFILL }},
1033 { &hf_wai_negotiation_flag,
1034 {"STA negotiation", "wai.negotiation.flag",
1035 FT_BOOLEAN, 8, TFS (&wai_negotiation_flag), FLAG_BIT5,
1036 "STA negotiation flag", HFILL }},
1038 { &hf_wai_revoking_flag,
1039 {"STA revoking", "wai.revoking.flag",
1040 FT_BOOLEAN, 8, TFS (&wai_revoking_flag), FLAG_BIT6,
1041 "STA revoking flag", HFILL }},
1043 { &hf_wai_reserved_flag,
1044 {"Reserved", "wai.reserved.flag",
1045 FT_BOOLEAN, 8, TFS (&wai_reserved_flag), FLAG_BIT7,
1046 "Reserved flag", HFILL }},
1048 { &hf_wai_attr_type,
1049 { "Type", "wai.attrtype",
1050 FT_UINT8, BASE_HEX, VALS(wai_attr_type_names), 0x0,
1051 "Attribute type", HFILL }},
1053 { &hf_wai_cert,
1054 {"Certificate", "wai.cert",
1055 FT_BYTES, BASE_NONE, NULL, 0x0,
1056 NULL, HFILL }},
1058 { &hf_wai_cert_id,
1059 {"Id", "wai.cert.id",
1060 FT_UINT16, BASE_HEX, NULL, 0x0,
1061 "Certificate Id", HFILL }},
1063 { &hf_wai_cert_data,
1064 {"Data", "wai.cert.data",
1065 FT_BYTES, BASE_NONE, NULL, 0x0,
1066 "Certificate data", HFILL }},
1068 { &hf_wai_cert_len,
1069 {"Length", "wai.cert.len",
1070 FT_UINT16, BASE_DEC, NULL, 0x0,
1071 "Certificate length", HFILL }},
1073 { &hf_wai_addid,
1074 {"ADDID", "wai.addid",
1075 FT_STRING, BASE_NONE, NULL, 0x0,
1076 NULL, HFILL }},
1078 { &hf_wai_ae_mac,
1079 {"AE MAC", "wai.ae.mac",
1080 FT_ETHER, BASE_NONE, NULL, 0x0,
1081 "AE MAC address", HFILL }},
1083 { &hf_wai_asue_mac,
1084 {"ASUE MAC", "wai.asue.mac",
1085 FT_ETHER, BASE_NONE, NULL, 0x0,
1086 "ASUE MAC address", HFILL }},
1088 { &hf_wai_bkid,
1089 {"BKID", "wai.bkid",
1090 FT_BYTES, BASE_NONE, NULL, 0x0,
1091 NULL, HFILL }},
1093 { &hf_wai_uskid,
1094 {"USKID", "wai.uskid",
1095 FT_BYTES, BASE_NONE, NULL, 0x0,
1096 NULL, HFILL }},
1098 { &hf_wai_wie,
1099 {"WIE from ASUE", "wai.wie",
1100 FT_BYTES, BASE_NONE, NULL, 0x0,
1101 NULL, HFILL }},
1103 { &hf_wai_message_auth_code,
1104 {"Message Authentication Code", "wai.message.auth.code",
1105 FT_BYTES, BASE_NONE, NULL, 0x0,
1106 NULL, HFILL }},
1108 { &hf_wai_mskid,
1109 {"MSKID/STAKeyID", "wai.mskid",
1110 FT_BYTES, BASE_NONE, NULL, 0x0,
1111 NULL, HFILL }},
1113 { &hf_wai_data_pack_num,
1114 {"Data packet number", "wai.data.packet.num",
1115 FT_BYTES, BASE_NONE, NULL, 0x0,
1116 NULL, HFILL }},
1118 { &hf_wai_key_data,
1119 {"Key Data", "wai.key.data",
1120 FT_BYTES, BASE_NONE, NULL, 0x0,
1121 NULL, HFILL }},
1123 { &hf_wai_key_data_len,
1124 {"Length", "wai.key.data.len",
1125 FT_UINT8, BASE_DEC, NULL, 0x0,
1126 "Key data length", HFILL }},
1128 { &hf_wai_key_data_content,
1129 {"Content", "wai.key.data.content",
1130 FT_BYTES, BASE_NONE, NULL, 0x0,
1131 "Key data content", HFILL }},
1133 { &hf_wai_key_ann_id,
1134 {"Key Announcement Identifier", "wai.key.ann.id",
1135 FT_BYTES, BASE_NONE, NULL, 0x0,
1136 NULL, HFILL }},
1138 { &hf_wai_auth_id,
1139 {"Authentication Identifier", "wai.auth.id",
1140 FT_BYTES, BASE_NONE, NULL, 0x0,
1141 NULL, HFILL }},
1143 { &hf_wai_identity,
1144 {"Identifier", "wai.identity",
1145 FT_BYTES, BASE_NONE, NULL, 0x0,
1146 NULL, HFILL }},
1148 { &hf_wai_identity_id,
1149 {"Id", "wai.identity.id",
1150 FT_UINT16, BASE_HEX, NULL, 0x0,
1151 NULL, HFILL }},
1153 { &hf_wai_identity_len,
1154 {"Length", "wai.identity.len",
1155 FT_UINT16, BASE_DEC, NULL, 0x0,
1156 "Identity length", HFILL }},
1158 { &hf_wai_identity_data,
1159 {"Data", "wai.identity.data",
1160 FT_BYTES, BASE_NONE, NULL, 0x0,
1161 "Identity data", HFILL }},
1163 { &hf_wai_ecdh,
1164 {"ECDH Parameter", "wai.ecdhp",
1165 FT_BYTES, BASE_NONE, NULL, 0x0,
1166 NULL, HFILL }},
1168 { &hf_wai_ecdh_id,
1169 {"ID", "wai.edch.id",
1170 FT_UINT8, BASE_HEX, NULL, 0x0,
1171 "ECDH Parameter Identifier", HFILL }},
1173 { &hf_wai_ecdh_len,
1174 {"Length", "wai.ecdh.len",
1175 FT_UINT16, BASE_DEC, NULL, 0x0,
1176 "ECDH Parameter Length", HFILL }},
1178 { &hf_wai_ecdh_content,
1179 {"Content", "wai.ecdh.content",
1180 FT_BYTES, BASE_NONE, NULL, 0x0,
1181 "ECDH Parameter Content", HFILL }},
1183 { &hf_wai_counter,
1184 {"Replay counter", "wai.counter",
1185 FT_BYTES, BASE_NONE, NULL, 0x0,
1186 NULL, HFILL }},
1188 { &hf_wai_sta_key_id,
1189 {"STAKeyID", "wai.sta.key.id",
1190 FT_UINT8, BASE_HEX, NULL, 0x0,
1191 NULL, HFILL }},
1193 { &hf_wai_challenge,
1194 {"Challenge", "wai.challenge",
1195 FT_BYTES, BASE_NONE, NULL, 0x0,
1196 NULL, HFILL }},
1198 { &hf_wai_cert_ver,
1199 {"Multiple Certificate Verification Result", "wai.cert.ver",
1200 FT_BYTES, BASE_NONE, NULL, 0x0,
1201 NULL, HFILL }},
1203 { &hf_wai_nonce,
1204 {"Nonce", "wai.nonce",
1205 FT_BYTES, BASE_NONE, NULL, 0x0,
1206 NULL, HFILL }},
1208 { &hf_wai_ver_res,
1209 {"Verification result", "wai.ver.res",
1210 FT_UINT8, BASE_HEX, VALS(wai_ver_res_names), 0x0,
1211 NULL, HFILL }},
1213 { &hf_wai_sign_alg,
1214 {"Signature Algorithm", "wai.sign.alg",
1215 FT_BYTES, BASE_NONE, NULL, 0x0,
1216 NULL, HFILL }},
1218 { &hf_wai_hash_alg_id,
1219 {"Hash Algorithm Identifier", "wai.hash.alg.id",
1220 FT_UINT8, BASE_HEX, NULL, 0x0,
1221 NULL, HFILL }},
1223 { &hf_wai_sign_alg_id,
1224 {"Signature Algorithm Identifier", "wai.sign.alg.id",
1225 FT_UINT8, BASE_HEX, NULL, 0x0,
1226 NULL, HFILL }},
1228 { &hf_wai_param,
1229 {"Parameter", "wai.param",
1230 FT_BYTES, BASE_NONE, NULL, 0x0,
1231 NULL, HFILL }},
1233 { &hf_wai_param_id,
1234 {"Parameter Identifier", "wai.param.id",
1235 FT_BYTES, BASE_NONE, NULL, 0x0,
1236 NULL, HFILL }},
1238 { &hf_wai_param_content,
1239 {"Parameter Content", "wai.param.content",
1240 FT_BYTES, BASE_NONE, NULL, 0x0,
1241 NULL, HFILL }},
1243 { &hf_wai_sign_val,
1244 {"Signature Value", "wai.sign.val",
1245 FT_BYTES, BASE_NONE, NULL, 0x0,
1246 NULL, HFILL }},
1248 { &hf_wai_sign_content,
1249 {"Signature Content", "wai.sign.content",
1250 FT_BYTES, BASE_NONE, NULL, 0x0,
1251 NULL, HFILL }},
1253 { &hf_wai_sign,
1254 {"Signature", "wai.sign",
1255 FT_BYTES, BASE_NONE, NULL, 0x0,
1256 NULL, HFILL }},
1258 { &hf_wai_identity_list,
1259 {"ASU List trusted by ASUE", "wai.identity_list",
1260 FT_BYTES, BASE_NONE, NULL, 0x0,
1261 "Identity list", HFILL }},
1263 { &hf_wai_reserved_byte,
1264 {"Reserved", "wai.reserved.byte",
1265 FT_UINT8, BASE_HEX, NULL, 0x0,
1266 NULL, HFILL }},
1268 { &hf_wai_no_of_ids,
1269 {"Number of Identities", "wai.no.of.ids",
1270 FT_UINT16, BASE_DEC, NULL, 0x0,
1271 NULL, HFILL }},
1273 { &hf_wai_access_res,
1274 {"Access result", "wai.access_result",
1275 FT_UINT8, BASE_HEX, VALS(wai_access_res_names), 0x0,
1276 NULL, HFILL }},
1278 { &hf_wai_fragments,
1279 {"Message fragments", "wai.fragments",
1280 FT_NONE, BASE_NONE, NULL, 0x00,
1281 NULL, HFILL }},
1283 { &hf_wai_fragment,
1284 {"Message fragment", "wai.fragment",
1285 FT_FRAMENUM, BASE_NONE, NULL, 0x00,
1286 NULL, HFILL }},
1288 { &hf_wai_fragment_overlap,
1289 {"Message fragment overlap", "wai.fragment.overlap",
1290 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
1291 NULL, HFILL }},
1293 { &hf_wai_fragment_overlap_conflicts,
1294 {"Message fragment overlapping with conflicting data", "wai.fragment.overlap.conflicts",
1295 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
1296 NULL, HFILL }},
1298 { &hf_wai_fragment_multiple_tails,
1299 {"Message has multiple tail fragments", "wai.fragment.multiple_tails",
1300 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
1301 NULL, HFILL }},
1303 { &hf_wai_fragment_too_long_fragment,
1304 {"Message fragment too long", "wai.fragment.too_long_fragment",
1305 FT_BOOLEAN, BASE_NONE, NULL, 0x00,
1306 NULL, HFILL }},
1308 { &hf_wai_fragment_error,
1309 {"Message defragmentation error", "wai.fragment.error",
1310 FT_FRAMENUM, BASE_NONE, NULL, 0x00,
1311 NULL, HFILL }},
1313 { &hf_wai_fragment_count,
1314 {"Message fragment count", "wai.fragment.count",
1315 FT_UINT32, BASE_DEC, NULL, 0x00,
1316 NULL, HFILL }},
1318 { &hf_wai_reassembled_in,
1319 {"Reassembled in", "wai.reassembled.in",
1320 FT_FRAMENUM, BASE_NONE, NULL, 0x00,
1321 NULL, HFILL }},
1323 { &hf_wai_reassembled_length,
1324 {"Reassembled length", "wai.reassembled.length",
1325 FT_UINT32, BASE_DEC, NULL, 0x00,
1326 NULL, HFILL }}
1329 static int *ett[] = {
1330 &ett_wai,
1331 &ett_wai_data,
1332 &ett_wai_flags,
1333 &ett_wai_certificate,
1334 &ett_wai_mac,
1335 &ett_wai_identity,
1336 &ett_wai_key_data,
1337 &ett_wai_ecdh_param,
1338 &ett_wai_certificate_verification,
1339 &ett_wai_identity_list,
1340 &ett_wai_sign,
1341 &ett_wai_sign_alg,
1342 &ett_wai_sign_val,
1343 &ett_wai_parameter,
1344 &ett_wai_fragment,
1345 &ett_wai_fragments
1348 proto_wai = proto_register_protocol("WAI Protocol", "WAI", "wai");
1349 proto_register_field_array(proto_wai, hf, array_length(hf));
1350 proto_register_subtree_array(ett, array_length(ett));
1351 reassembly_table_register(&wai_reassembly_table,
1352 &addresses_reassembly_table_functions);
1354 wai_handle = register_dissector("wai", dissect_wai, proto_wai);
1357 void
1358 proto_reg_handoff_wai(void)
1360 dissector_add_uint("ethertype", ETHERTYPE_WAI, wai_handle);
1364 * Editor modelines - https://www.wireshark.org/tools/modelines.html
1366 * Local variables:
1367 * c-basic-offset: 4
1368 * tab-width: 8
1369 * indent-tabs-mode: nil
1370 * End:
1372 * vi: set shiftwidth=4 tabstop=8 expandtab:
1373 * :indentSize=4:tabSize=8:noTabs=true: