2 * Routines for dtls dissection
3 * Copyright (c) 2006, Authesserre Samuel <sauthess@gmail.com>
4 * Copyright (c) 2007, Mikael Magnusson <mikma@users.sourceforge.net>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 * DTLS dissection and decryption.
28 * See RFC 4347 for details about DTLS specs.
31 * This dissector is based on TLS one (packet-ssl.c) because of the proximity of DTLS and TLS, decryption works like him with RSA key exchange.
32 * It uses the sames things (file, libraries) that SSL one (gnutls, packet-ssl-utils.h) to make it easily maintenable.
34 * It was developped to dissect and decrypt OpenSSL v 0.9.8f DTLS implementation.
35 * It is limited to this implementation while there is no complete implementation.
39 * - DTLS decryption (openssl one)
42 * - activate correct Mac calculation when openssl will be corrected
43 * (or if an other implementation works),
44 * corrected code is ready and commented in packet-ssl-utils.h file.
45 * - add missings things (desegmentation, reordering... that aren't present in actual OpenSSL implementation)
56 #include <sys/types.h>
57 #ifdef HAVE_SYS_SOCKET_H
58 #include <sys/socket.h>
61 #ifdef HAVE_WINSOCK2_H
67 #include <epan/conversation.h>
68 #include <epan/prefs.h>
69 #include <epan/asn1.h>
70 #include <epan/dissectors/packet-x509af.h>
71 #include <epan/emem.h>
73 #include <epan/reassemble.h>
74 #include "inet_v6defs.h"
75 #include "packet-ssl-utils.h"
77 extern const gchar *ssl_version_short_names[];
79 /* we need to remember the top tree so that subdissectors we call are created
80 * at the root and not deep down inside the DTLS decode
82 static proto_tree *top_tree;
84 /*********************************************************************
86 * Protocol Constants, Variables, Data Structures
88 *********************************************************************/
90 /* Initialize the protocol and registered fields */
91 static gint dtls_tap = -1;
92 static gint proto_dtls = -1;
93 static gint hf_dtls_record = -1;
94 static gint hf_dtls_record_content_type = -1;
95 static gint hf_dtls_record_version = -1;
96 static gint hf_dtls_record_epoch = -1;
97 static gint hf_dtls_record_sequence_number = -1;
98 static gint hf_dtls_record_length = -1;
99 static gint hf_dtls_record_appdata = -1;
100 static gint hf_dtls_change_cipher_spec = -1;
101 static gint hf_dtls_alert_message = -1;
102 static gint hf_dtls_alert_message_level = -1;
103 static gint hf_dtls_alert_message_description = -1;
104 static gint hf_dtls_handshake_protocol = -1;
105 static gint hf_dtls_handshake_type = -1;
106 static gint hf_dtls_handshake_length = -1;
107 static gint hf_dtls_handshake_message_seq = -1;
108 static gint hf_dtls_handshake_fragment_offset = -1;
109 static gint hf_dtls_handshake_fragment_length = -1;
110 static gint hf_dtls_handshake_client_version = -1;
111 static gint hf_dtls_handshake_server_version = -1;
112 static gint hf_dtls_handshake_random_time = -1;
113 static gint hf_dtls_handshake_random_bytes = -1;
114 static gint hf_dtls_handshake_cookie_len = -1;
115 static gint hf_dtls_handshake_cookie = -1;
116 static gint hf_dtls_handshake_cipher_suites_len = -1;
117 static gint hf_dtls_handshake_cipher_suites = -1;
118 static gint hf_dtls_handshake_cipher_suite = -1;
119 static gint hf_dtls_handshake_session_id = -1;
120 static gint hf_dtls_handshake_comp_methods_len = -1;
121 static gint hf_dtls_handshake_comp_methods = -1;
122 static gint hf_dtls_handshake_comp_method = -1;
123 static gint hf_dtls_handshake_extensions_len = -1;
124 static gint hf_dtls_handshake_extension_type = -1;
125 static gint hf_dtls_handshake_extension_len = -1;
126 static gint hf_dtls_handshake_extension_data = -1;
127 static gint hf_dtls_handshake_certificates_len = -1;
128 static gint hf_dtls_handshake_certificates = -1;
129 static gint hf_dtls_handshake_certificate = -1;
130 static gint hf_dtls_handshake_certificate_len = -1;
131 static gint hf_dtls_handshake_cert_types_count = -1;
132 static gint hf_dtls_handshake_cert_types = -1;
133 static gint hf_dtls_handshake_cert_type = -1;
134 static gint hf_dtls_handshake_finished = -1;
135 static gint hf_dtls_handshake_md5_hash = -1;
136 static gint hf_dtls_handshake_sha_hash = -1;
137 static gint hf_dtls_handshake_session_id_len = -1;
138 static gint hf_dtls_handshake_dnames_len = -1;
139 static gint hf_dtls_handshake_dnames = -1;
140 static gint hf_dtls_handshake_dname_len = -1;
141 static gint hf_dtls_handshake_dname = -1;
143 static gint hf_dtls_fragments = -1;
144 static gint hf_dtls_fragment = -1;
145 static gint hf_dtls_fragment_overlap = -1;
146 static gint hf_dtls_fragment_overlap_conflicts = -1;
147 static gint hf_dtls_fragment_multiple_tails = -1;
148 static gint hf_dtls_fragment_too_long_fragment = -1;
149 static gint hf_dtls_fragment_error = -1;
150 static gint hf_dtls_reassembled_in = -1;
152 /* Initialize the subtree pointers */
153 static gint ett_dtls = -1;
154 static gint ett_dtls_record = -1;
155 static gint ett_dtls_alert = -1;
156 static gint ett_dtls_handshake = -1;
157 static gint ett_dtls_cipher_suites = -1;
158 static gint ett_dtls_comp_methods = -1;
159 static gint ett_dtls_extension = -1;
160 static gint ett_dtls_certs = -1;
161 static gint ett_dtls_cert_types = -1;
162 static gint ett_dtls_dnames = -1;
164 static gint ett_dtls_fragment = -1;
165 static gint ett_dtls_fragments = -1;
167 static GHashTable *dtls_session_hash = NULL;
168 static GHashTable *dtls_key_hash = NULL;
169 static GHashTable *dtls_fragment_table = NULL;
170 static GHashTable *dtls_reassembled_table = NULL;
171 static GTree* dtls_associations = NULL;
172 static dissector_handle_t dtls_handle = NULL;
173 static StringInfo dtls_compressed_data = {NULL, 0};
174 static StringInfo dtls_decrypted_data = {NULL, 0};
175 static gint dtls_decrypted_data_avail = 0;
177 static gchar* dtls_keys_list = NULL;
178 #ifdef HAVE_LIBGNUTLS
179 static gchar* dtls_debug_file_name = NULL;
182 static const fragment_items dtls_frag_items = {
183 /* Fragment subtrees */
186 /* Fragment fields */
189 &hf_dtls_fragment_overlap,
190 &hf_dtls_fragment_overlap_conflicts,
191 &hf_dtls_fragment_multiple_tails,
192 &hf_dtls_fragment_too_long_fragment,
193 &hf_dtls_fragment_error,
194 /* Reassembled in field */
195 &hf_dtls_reassembled_in,
200 /* initialize/reset per capture state data (dtls sessions cache) */
204 ssl_common_init(&dtls_session_hash, &dtls_decrypted_data, &dtls_compressed_data);
205 fragment_table_init (&dtls_fragment_table);
206 reassembled_table_init(&dtls_reassembled_table);
209 /* parse dtls related preferences (private keys and ports association strings) */
213 ep_stack_t tmp_stack;
214 SslAssociation *tmp_assoc;
218 g_hash_table_foreach(dtls_key_hash, ssl_private_key_free, NULL);
219 g_hash_table_destroy(dtls_key_hash);
222 /* remove only associations created from key list */
223 tmp_stack = ep_stack_new();
224 g_tree_foreach(dtls_associations, ssl_assoc_from_key_list, tmp_stack);
225 while ((tmp_assoc = ep_stack_pop(tmp_stack)) != NULL) {
226 ssl_association_remove(dtls_associations, tmp_assoc);
229 /* parse private keys string, load available keys and put them in key hash*/
230 dtls_key_hash = g_hash_table_new(ssl_private_key_hash, ssl_private_key_equal);
232 if (dtls_keys_list && (dtls_keys_list[0] != 0))
234 ssl_parse_key_list(dtls_keys_list,dtls_key_hash,dtls_associations,dtls_handle,FALSE);
237 ssl_set_debug(dtls_debug_file_name);
239 dissector_add_handle("sctp.port", dtls_handle);
240 dissector_add_handle("udp.port", dtls_handle);
244 * DTLS Dissection Routines
248 /* record layer dissector */
249 static gint dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
250 proto_tree *tree, guint32 offset,
252 SslDecryptSession *conv_data);
254 /* change cipher spec dissector */
255 static void dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
258 guint *conv_version, guint8 content_type);
260 /* alert message dissector */
261 static void dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
262 proto_tree *tree, guint32 offset,
263 guint *conv_version);
265 /* handshake protocol dissector */
266 static void dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
267 proto_tree *tree, guint32 offset,
268 guint32 record_length,
270 SslDecryptSession *conv_data, guint8 content_type);
273 static void dissect_dtls_hnd_cli_hello(tvbuff_t *tvb,
275 guint32 offset, guint32 length,
276 SslDecryptSession* ssl);
278 static void dissect_dtls_hnd_hello_verify_request(tvbuff_t *tvb,
281 SslDecryptSession* ssl);
283 static void dissect_dtls_hnd_srv_hello(tvbuff_t *tvb,
285 guint32 offset, guint32 length,
286 SslDecryptSession* ssl);
288 static void dissect_dtls_hnd_cert(tvbuff_t *tvb,
289 proto_tree *tree, guint32 offset, packet_info *pinfo);
291 static void dissect_dtls_hnd_cert_req(tvbuff_t *tvb,
295 static void dissect_dtls_hnd_finished(tvbuff_t *tvb,
298 guint* conv_version);
304 /*static void ssl_set_conv_version(packet_info *pinfo, guint version);*/
305 static gint dtls_is_valid_handshake_type(guint8 type);
307 static gint dtls_is_authoritative_version_message(guint8 content_type,
309 static gint looks_like_dtls(tvbuff_t *tvb, guint32 offset);
311 /*********************************************************************
315 *********************************************************************/
317 * Code to actually dissect the packets
320 dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
323 conversation_t *conversation;
326 proto_tree *dtls_tree;
328 gboolean first_record_in_frame;
329 SslDecryptSession* ssl_session;
334 first_record_in_frame = TRUE;
338 /* Track the version using conversations allows
339 * us to more frequently set the protocol column properly
340 * for continuation data frames.
342 * Also: We use the copy in conv_version as our cached copy,
343 * so that we don't have to search the conversation
344 * table every time we want the version; when setting
345 * the conv_version, must set the copy in the conversation
346 * in addition to conv_version
348 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
349 pinfo->srcport, pinfo->destport, 0);
352 /* create a new conversation */
353 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
354 pinfo->srcport, pinfo->destport, 0);
356 conv_data = conversation_get_proto_data(conversation, proto_dtls);
358 /* manage dtls decryption data */
359 /*get a valid ssl session pointer*/
360 if (conv_data != NULL)
361 ssl_session = conv_data;
365 ssl_session = se_alloc0(sizeof(SslDecryptSession));
366 ssl_session_init(ssl_session);
367 ssl_session->version = SSL_VER_UNKNOWN;
368 conversation_add_proto_data(conversation, proto_dtls, ssl_session);
370 /* we need to know witch side of conversation is speaking */
371 if (ssl_packet_from_server(dtls_associations, pinfo->srcport, pinfo->ptype == PT_TCP)) {
372 dummy.addr = pinfo->src;
373 dummy.port = pinfo->srcport;
376 dummy.addr = pinfo->dst;
377 dummy.port = pinfo->destport;
379 ssl_debug_printf("dissect_dtls server %s:%d\n",
380 address_to_str(&dummy.addr),dummy.port);
382 /* try to retrive private key for this service. Do it now 'cause pinfo
383 * is not always available
384 * Note that with HAVE_LIBGNUTLS undefined private_key is allways 0
385 * and thus decryption never engaged*/
386 ssl_session->private_key = g_hash_table_lookup(dtls_key_hash, &dummy);
387 if (!ssl_session->private_key)
388 ssl_debug_printf("dissect_dtls can't find private key for this server!\n");
390 conv_version= & ssl_session->version;
392 /* try decryption only the first time we see this packet
393 * (to keep cipher synchronized)and only if we have
394 * the server private key*/
395 if (!ssl_session->private_key || pinfo->fd->flags.visited)
398 /* Initialize the protocol column; we'll set it later when we
399 * figure out what flavor of DTLS it is (actually only one
401 if (check_col(pinfo->cinfo, COL_PROTOCOL))
403 col_set_str(pinfo->cinfo, COL_PROTOCOL, "DTLS");
406 /* clear the the info column */
407 if (check_col(pinfo->cinfo, COL_INFO))
408 col_clear(pinfo->cinfo, COL_INFO);
410 /* Create display subtree for SSL as a whole */
413 ti = proto_tree_add_item(tree, proto_dtls, tvb, 0, -1, FALSE);
414 dtls_tree = proto_item_add_subtree(ti, ett_dtls);
417 /* iterate through the records in this tvbuff */
418 while (tvb_reported_length_remaining(tvb, offset) != 0)
420 /* on second and subsequent records per frame
421 * add a delimiter on info column
423 if (!first_record_in_frame
424 && check_col(pinfo->cinfo, COL_INFO))
426 col_append_str(pinfo->cinfo, COL_INFO, ", ");
429 /* first try to dispatch off the cached version
430 * known to be associated with the conversation
432 switch(*conv_version) {
434 offset = dissect_dtls_record(tvb, pinfo, dtls_tree,
435 offset, conv_version,
439 /* that failed, so apply some heuristics based
440 * on this individual packet
443 if (looks_like_dtls(tvb, offset))
445 /* looks like dtls */
446 offset = dissect_dtls_record(tvb, pinfo, dtls_tree,
447 offset, conv_version,
452 /* looks like something unknown, so lump into
455 offset = tvb_length(tvb);
456 if (check_col(pinfo->cinfo, COL_INFO))
457 col_append_str(pinfo->cinfo, COL_INFO,
458 "Continuation Data");
460 /* Set the protocol column */
461 if (check_col(pinfo->cinfo, COL_PROTOCOL))
463 col_set_str(pinfo->cinfo, COL_PROTOCOL,"DTLS");
469 /* set up for next record in frame, if any */
470 first_record_in_frame = FALSE;
473 tap_queue_packet(dtls_tap, pinfo, NULL);
477 decrypt_dtls_record(tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
478 guint32 record_length, guint8 content_type, SslDecryptSession* ssl,
479 gboolean save_plaintext)
486 /* if we can decrypt and decryption have success
487 * add decrypted data to this packet info */
488 ssl_debug_printf("decrypt_dtls_record: app_data len %d ssl state %X\n",
489 record_length, ssl->state);
490 if (!(ssl->state & SSL_HAVE_SESSION_KEY)) {
491 ssl_debug_printf("decrypt_dtls_record: no session key\n");
495 /* retrive decoder for this packet direction */
496 if ((direction = ssl_packet_from_server(dtls_associations, pinfo->srcport, pinfo->ptype == PT_TCP)) != 0) {
497 ssl_debug_printf("decrypt_dtls_record: using server decoder\n");
498 decoder = ssl->server;
501 ssl_debug_printf("decrypt_dtls_record: using client decoder\n");
502 decoder = ssl->client;
505 /* ensure we have enough storage space for decrypted data */
506 if (record_length > dtls_decrypted_data.data_len)
508 ssl_debug_printf("decrypt_dtls_record: allocating %d bytes"
509 " for decrypt data (old len %d)\n",
510 record_length + 32, dtls_decrypted_data.data_len);
511 dtls_decrypted_data.data = g_realloc(dtls_decrypted_data.data,
513 dtls_decrypted_data.data_len = record_length + 32;
516 /* run decryption and add decrypted payload to protocol data, if decryption
518 dtls_decrypted_data_avail = dtls_decrypted_data.data_len;
519 if (ssl_decrypt_record(ssl, decoder,
520 content_type, tvb_get_ptr(tvb, offset, record_length),
521 record_length, &dtls_compressed_data, &dtls_decrypted_data, &dtls_decrypted_data_avail) == 0)
524 if (ret && save_plaintext) {
525 ssl_add_data_info(proto_dtls, pinfo, dtls_decrypted_data.data, dtls_decrypted_data_avail, TVB_RAW_OFFSET(tvb)+offset, 0);
535 /*********************************************************************
537 * DTLS Dissection Routines
539 *********************************************************************/
541 dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
542 proto_tree *tree, guint32 offset,
544 SslDecryptSession* ssl)
549 * uint8 major, minor;
554 * change_cipher_spec(20), alert(21), handshake(22),
555 * application_data(23), (255)
560 * ProtocolVersion version;
561 * uint16 epoch; // New field
562 * uint48 sequence_number; // New field
564 * opaque fragment[TLSPlaintext.length];
567 guint32 record_length;
570 gdouble sequence_number;
571 gint64 sequence_number_temp;
575 proto_tree *dtls_record_tree;
576 guint32 available_bytes;
577 SslAssociation* association;
578 SslDataInfo *appl_data;
580 dtls_record_tree = NULL;
581 available_bytes = tvb_length_remaining(tvb, offset);
584 * Get the record layer fields of interest
586 content_type = tvb_get_guint8(tvb, offset);
587 version = tvb_get_ntohs(tvb, offset + 1);
588 epoch = tvb_get_ntohs(tvb, offset + 3);
589 sequence_number = tvb_get_ntohl(tvb, offset + 7);
590 sequence_number_temp=tvb_get_ntohs(tvb, offset + 5);
591 sequence_number_temp=sequence_number_temp<<32;
592 sequence_number+=sequence_number_temp;
593 record_length = tvb_get_ntohs(tvb, offset + 11);
596 if(ssl_packet_from_server(dtls_associations, pinfo->srcport, pinfo->ptype == PT_TCP)){
598 ssl->server->seq=(guint32)sequence_number;
599 ssl->server->epoch=epoch;
604 ssl->client->seq=(guint32)sequence_number;
605 ssl->client->epoch=epoch;
609 if (!ssl_is_valid_content_type(content_type)) {
611 /* if we don't have a valid content_type, there's no sense
612 * continuing any further
614 if (check_col(pinfo->cinfo, COL_INFO))
615 col_append_str(pinfo->cinfo, COL_INFO, "Continuation Data");
617 /* Set the protocol column */
618 if (check_col(pinfo->cinfo, COL_PROTOCOL))
620 col_set_str(pinfo->cinfo, COL_PROTOCOL,"DTLS");
622 return offset + 13 + record_length;
626 * If GUI, fill in record layer part of tree
631 /* add the record layer subtree header */
632 tvb_ensure_bytes_exist(tvb, offset, 13 + record_length);
633 ti = proto_tree_add_item(tree, hf_dtls_record, tvb,
634 offset, 13 + record_length, 0);
635 dtls_record_tree = proto_item_add_subtree(ti, ett_dtls_record);
638 if (dtls_record_tree)
641 /* show the one-byte content type */
642 proto_tree_add_item(dtls_record_tree, hf_dtls_record_content_type,
643 tvb, offset, 1, FALSE);
646 /* add the version */
647 proto_tree_add_item(dtls_record_tree, hf_dtls_record_version, tvb,
652 proto_tree_add_uint(dtls_record_tree, hf_dtls_record_epoch, tvb, offset, 2, epoch);
656 /* add sequence_number */
658 proto_tree_add_double(dtls_record_tree, hf_dtls_record_sequence_number, tvb, offset, 6, sequence_number);
663 proto_tree_add_uint(dtls_record_tree, hf_dtls_record_length, tvb,
664 offset, 2, record_length);
665 offset += 2; /* move past length field itself */
670 /* if no GUI tree, then just skip over those fields */
676 * if we don't already have a version set for this conversation,
677 * but this message's version is authoritative (i.e., it's
678 * not client_hello, then save the version to to conversation
679 * structure and print the column version
681 next_byte = tvb_get_guint8(tvb, offset);
682 if (*conv_version == SSL_VER_UNKNOWN
683 && dtls_is_authoritative_version_message(content_type, next_byte))
685 if (version == DTLSV1DOT0_VERSION ||
686 version == DTLSV1DOT0_VERSION_NOT)
689 *conv_version = SSL_VER_DTLS;
691 ssl->version_netorder = version;
692 ssl->state |= SSL_VERSION;
694 /*ssl_set_conv_version(pinfo, ssl->version);*/
697 if (check_col(pinfo->cinfo, COL_PROTOCOL))
699 if (version == DTLSV1DOT0_VERSION)
701 col_set_str(pinfo->cinfo, COL_PROTOCOL,
702 ssl_version_short_names[SSL_VER_DTLS]);
706 col_set_str(pinfo->cinfo, COL_PROTOCOL,"DTLS");
711 * now dissect the next layer
713 ssl_debug_printf("dissect_dtls_record: content_type %d\n",content_type);
715 /* PAOLO try to decrypt each record (we must keep ciphers "in sync")
716 * store plain text only for app data */
718 switch (content_type) {
719 case SSL_ID_CHG_CIPHER_SPEC:
720 if (check_col(pinfo->cinfo, COL_INFO))
721 col_append_str(pinfo->cinfo, COL_INFO, "Change Cipher Spec");
722 dissect_dtls_change_cipher_spec(tvb, dtls_record_tree,
723 offset, conv_version, content_type);
729 if (ssl&&decrypt_dtls_record(tvb, pinfo, offset,
730 record_length, content_type, ssl, FALSE))
731 ssl_add_record_info(proto_dtls, pinfo, dtls_decrypted_data.data,
732 dtls_decrypted_data_avail, offset);
734 /* try to retrive and use decrypted alert record, if any. */
735 decrypted = ssl_get_record_info(proto_dtls, pinfo, offset);
737 dissect_dtls_alert(decrypted, pinfo, dtls_record_tree, 0,
740 dissect_dtls_alert(tvb, pinfo, dtls_record_tree, offset,
744 case SSL_ID_HANDSHAKE:
748 /* try to decrypt handshake record, if possible. Store decrypted
749 * record for later usage. The offset is used as 'key' to itentify
750 * this record into the packet (we can have multiple handshake records
751 * in the same frame) */
752 if (ssl && decrypt_dtls_record(tvb, pinfo, offset,
753 record_length, content_type, ssl, FALSE))
754 ssl_add_record_info(proto_dtls, pinfo, dtls_decrypted_data.data,
755 dtls_decrypted_data_avail, offset);
757 /* try to retrive and use decrypted handshake record, if any. */
758 decrypted = ssl_get_record_info(proto_dtls, pinfo, offset);
760 dissect_dtls_handshake(decrypted, pinfo, dtls_record_tree, 0,
761 decrypted->length, conv_version, ssl, content_type);
763 dissect_dtls_handshake(tvb, pinfo, dtls_record_tree, offset,
764 record_length, conv_version, ssl, content_type);
767 case SSL_ID_APP_DATA:
769 decrypt_dtls_record(tvb, pinfo, offset,
770 record_length, content_type, ssl, TRUE);
772 /* show on info colum what we are decoding */
773 if (check_col(pinfo->cinfo, COL_INFO))
774 col_append_str(pinfo->cinfo, COL_INFO, "Application Data");
776 if (!dtls_record_tree)
779 /* we need dissector information when the selected packet is shown.
780 * ssl session pointer is NULL at that time, so we can't access
781 * info cached there*/
782 association = ssl_association_find(dtls_associations, pinfo->srcport, pinfo->ptype == PT_TCP);
783 association = association ? association: ssl_association_find(dtls_associations, pinfo->destport, pinfo->ptype == PT_TCP);
785 proto_item_set_text(dtls_record_tree,
786 "%s Record Layer: %s Protocol: %s",
787 ssl_version_short_names[*conv_version],
788 val_to_str(content_type, ssl_31_content_type, "unknown"),
789 association?association->info:"Application Data");
791 proto_tree_add_item(dtls_record_tree, hf_dtls_record_appdata, tvb,
792 offset, record_length, 0);
794 /* show decrypted data info, if available */
795 appl_data = ssl_get_data_info(proto_dtls, pinfo, TVB_RAW_OFFSET(tvb)+offset);
796 if (appl_data && (appl_data->plain_data.data_len > 0))
799 /* try to dissect decrypted data*/
800 ssl_debug_printf("dissect_dtls_record decrypted len %d\n",
801 appl_data->plain_data.data_len);
803 /* create a new TVB structure for desegmented data */
804 next_tvb = tvb_new_child_real_data(tvb, appl_data->plain_data.data, appl_data->plain_data.data_len, appl_data->plain_data.data_len);
806 add_new_data_source(pinfo, next_tvb, "Decrypted DTLS data");
808 /* find out a dissector using server port*/
809 if (association && association->handle) {
810 ssl_debug_printf("dissect_dtls_record found association %p\n", (void *)association);
811 ssl_print_text_data("decrypted app data",appl_data->plain_data.data, appl_data->plain_data.data_len);
813 call_dissector(association->handle, next_tvb, pinfo, top_tree);
819 /* shouldn't get here since we check above for valid types */
820 if (check_col(pinfo->cinfo, COL_INFO))
821 col_append_str(pinfo->cinfo, COL_INFO, "Bad DTLS Content Type");
824 offset += record_length; /* skip to end of record */
829 /* dissects the change cipher spec procotol, filling in the tree */
831 dissect_dtls_change_cipher_spec(tvbuff_t *tvb,
832 proto_tree *tree, guint32 offset,
833 guint* conv_version, guint8 content_type)
837 * enum { change_cipher_spec(1), (255) } type;
838 * } ChangeCipherSpec;
843 proto_item_set_text(tree,
844 "%s Record Layer: %s Protocol: Change Cipher Spec",
845 ssl_version_short_names[*conv_version],
846 val_to_str(content_type, ssl_31_content_type, "unknown"));
847 proto_tree_add_item(tree, hf_dtls_change_cipher_spec, tvb,
852 /* dissects the alert message, filling in the tree */
854 dissect_dtls_alert(tvbuff_t *tvb, packet_info *pinfo,
855 proto_tree *tree, guint32 offset,
860 * AlertDescription description;
864 proto_tree *ssl_alert_tree;
868 ssl_alert_tree = NULL;
872 ti = proto_tree_add_item(tree, hf_dtls_alert_message, tvb,
874 ssl_alert_tree = proto_item_add_subtree(ti, ett_dtls_alert);
878 * set the record layer label
881 /* first lookup the names for the alert level and description */
882 byte = tvb_get_guint8(tvb, offset); /* grab the level byte */
883 level = match_strval(byte, ssl_31_alert_level);
885 byte = tvb_get_guint8(tvb, offset+1); /* grab the desc byte */
886 desc = match_strval(byte, ssl_31_alert_description);
888 /* now set the text in the record layer line */
891 if (check_col(pinfo->cinfo, COL_INFO))
892 col_append_fstr(pinfo->cinfo, COL_INFO,
893 "Alert (Level: %s, Description: %s)",
898 if (check_col(pinfo->cinfo, COL_INFO))
899 col_append_str(pinfo->cinfo, COL_INFO, "Encrypted Alert");
906 proto_item_set_text(tree, "%s Record Layer: Alert "
907 "(Level: %s, Description: %s)",
908 ssl_version_short_names[*conv_version],
910 proto_tree_add_item(ssl_alert_tree, hf_dtls_alert_message_level,
911 tvb, offset++, 1, FALSE);
913 proto_tree_add_item(ssl_alert_tree, hf_dtls_alert_message_description,
914 tvb, offset++, 1, FALSE);
918 proto_item_set_text(tree,
919 "%s Record Layer: Encrypted Alert",
920 ssl_version_short_names[*conv_version]);
921 proto_item_set_text(ssl_alert_tree,
922 "Alert Message: Encrypted Alert");
928 /* dissects the handshake protocol, filling the tree */
930 dissect_dtls_handshake(tvbuff_t *tvb, packet_info *pinfo,
931 proto_tree *tree, guint32 offset,
932 guint32 record_length, guint *conv_version,
933 SslDecryptSession* ssl, guint8 content_type)
936 * HandshakeType msg_type;
938 * uint16 message_seq; //new field
939 * uint24 fragment_offset; //new field
940 * uint24 fragment_length; //new field
941 * select (HandshakeType) {
942 * case hello_request: HelloRequest;
943 * case client_hello: ClientHello;
944 * case server_hello: ServerHello;
945 * case hello_verify_request: HelloVerifyRequest; //new field
946 * case certificate: Certificate;
947 * case server_key_exchange: ServerKeyExchange;
948 * case certificate_request: CertificateRequest;
949 * case server_hello_done: ServerHelloDone;
950 * case certificate_verify: CertificateVerify;
951 * case client_key_exchange: ClientKeyExchange;
952 * case finished: Finished;
957 proto_tree *ssl_hand_tree;
958 const gchar *msg_type_str;
962 guint32 fragment_offset;
963 guint32 fragment_length;
964 gboolean first_iteration;
966 ssl_hand_tree = NULL;
968 first_iteration = TRUE;
970 /* just as there can be multiple records per packet, there
971 * can be multiple messages per record as long as they have
972 * the same content type
974 * we really only care about this for handshake messages
977 /* set record_length to the max offset */
978 record_length += offset;
979 for (; offset < record_length; offset += fragment_length,
980 first_iteration = FALSE) /* set up for next pass, if any */
982 fragment_data *frag_msg = NULL;
983 tvbuff_t *new_tvb = NULL;
984 const gchar *frag_str = NULL;
987 msg_type = tvb_get_guint8(tvb, offset);
988 msg_type_str = match_strval(msg_type, ssl_31_handshake_type);
989 length = tvb_get_ntoh24(tvb, offset + 1);
990 message_seq = tvb_get_ntohs(tvb,offset + 4);
991 fragment_offset = tvb_get_ntoh24(tvb, offset + 6);
992 fragment_length = tvb_get_ntoh24(tvb, offset + 9);
993 fragmented = fragment_length != length;
995 if (!msg_type_str && !first_iteration)
997 /* only dissect / report messages if they're
998 * either the first message in this record
999 * or they're a valid message type
1004 /* on second and later iterations, add comma to info col */
1005 if (!first_iteration)
1007 if (check_col(pinfo->cinfo, COL_INFO))
1008 col_append_str(pinfo->cinfo, COL_INFO, ", ");
1012 * Update our info string
1014 if (check_col(pinfo->cinfo, COL_INFO))
1015 col_append_str(pinfo->cinfo, COL_INFO, (msg_type_str != NULL)
1016 ? msg_type_str : "Encrypted Handshake Message");
1018 /* Handle fragments of known message type */
1024 case SSL_HND_HELLO_REQUEST:
1025 case SSL_HND_CLIENT_HELLO:
1026 case SSL_HND_HELLO_VERIFY_REQUEST:
1027 case SSL_HND_SERVER_HELLO:
1028 case SSL_HND_CERTIFICATE:
1029 case SSL_HND_SERVER_KEY_EXCHG:
1030 case SSL_HND_CERT_REQUEST:
1031 case SSL_HND_SVR_HELLO_DONE:
1032 case SSL_HND_CERT_VERIFY:
1033 case SSL_HND_CLIENT_KEY_EXCHG:
1034 case SSL_HND_FINISHED:
1038 /* Ignore encrypted handshake messages */
1044 /* Fragmented handshake message */
1045 pinfo->fragmented = TRUE;
1046 frag_msg = fragment_add(tvb, offset+12, pinfo, message_seq,
1047 dtls_fragment_table,
1048 fragment_offset, fragment_length, TRUE);
1049 fragment_set_tot_len(pinfo, message_seq, dtls_fragment_table,
1052 if (frag_msg && (fragment_length + fragment_offset) == length)
1055 new_tvb = process_reassembled_data(tvb, offset+12, pinfo,
1056 "Reassembled Message",
1060 frag_str = " (Reassembled)";
1064 frag_str = " (Fragment)";
1067 if (check_col(pinfo->cinfo, COL_INFO))
1068 col_append_str(pinfo->cinfo, COL_INFO, frag_str);
1074 /* set the label text on the record layer expanding node */
1075 if (first_iteration)
1077 proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s%s",
1078 ssl_version_short_names[*conv_version],
1079 val_to_str(content_type, ssl_31_content_type, "unknown"),
1080 (msg_type_str!=NULL) ? msg_type_str :
1081 "Encrypted Handshake Message",
1082 (frag_str!=NULL) ? frag_str : "");
1086 proto_item_set_text(tree, "%s Record Layer: %s Protocol: %s%s",
1087 ssl_version_short_names[*conv_version],
1088 val_to_str(content_type, ssl_31_content_type, "unknown"),
1089 "Multiple Handshake Messages",
1090 (frag_str!=NULL) ? frag_str : "");
1093 /* add a subtree for the handshake protocol */
1094 ti = proto_tree_add_item(tree, hf_dtls_handshake_protocol, tvb,
1095 offset, fragment_length + 12, 0);
1096 ssl_hand_tree = proto_item_add_subtree(ti, ett_dtls_handshake);
1100 /* set the text label on the subtree node */
1101 proto_item_set_text(ssl_hand_tree, "Handshake Protocol: %s%s",
1102 (msg_type_str != NULL) ? msg_type_str :
1103 "Encrypted Handshake Message",
1104 (frag_str!=NULL) ? frag_str : "");
1108 /* if we don't have a valid handshake type, just quit dissecting */
1112 /* if we are doing ssl decryption we must dissect some requests type */
1113 if (ssl_hand_tree || ssl)
1115 tvbuff_t *sub_tvb = NULL;
1117 /* add nodes for the message type and message length */
1119 proto_tree_add_item(ssl_hand_tree, hf_dtls_handshake_type,
1120 tvb, offset, 1, msg_type);
1123 proto_tree_add_uint(ssl_hand_tree, hf_dtls_handshake_length,
1124 tvb, offset, 3, length);
1128 proto_tree_add_uint(ssl_hand_tree, hf_dtls_handshake_message_seq,
1129 tvb, offset, 2, message_seq);
1132 proto_tree_add_uint(ssl_hand_tree, hf_dtls_handshake_fragment_offset,
1133 tvb, offset, 3, fragment_offset);
1136 proto_tree_add_uint(ssl_hand_tree, hf_dtls_handshake_fragment_length,
1137 tvb, offset, 3, fragment_length);
1140 if (fragmented && !new_tvb)
1142 /* Skip fragmented messages not reassembled yet */
1152 sub_tvb = tvb_new_subset(tvb, offset, fragment_length,
1156 /* now dissect the handshake message, if necessary */
1158 case SSL_HND_HELLO_REQUEST:
1159 /* hello_request has no fields, so nothing to do! */
1162 case SSL_HND_CLIENT_HELLO:
1163 dissect_dtls_hnd_cli_hello(sub_tvb, ssl_hand_tree, 0, length, ssl);
1166 case SSL_HND_HELLO_VERIFY_REQUEST:
1167 dissect_dtls_hnd_hello_verify_request(sub_tvb, ssl_hand_tree, 0, ssl);
1170 case SSL_HND_SERVER_HELLO:
1171 dissect_dtls_hnd_srv_hello(sub_tvb, ssl_hand_tree, 0, length, ssl);
1174 case SSL_HND_CERTIFICATE:
1175 dissect_dtls_hnd_cert(sub_tvb, ssl_hand_tree, 0, pinfo);
1178 case SSL_HND_SERVER_KEY_EXCHG:
1182 case SSL_HND_CERT_REQUEST:
1183 dissect_dtls_hnd_cert_req(sub_tvb, ssl_hand_tree, 0);
1186 case SSL_HND_SVR_HELLO_DONE:
1187 /* server_hello_done has no fields, so nothing to do! */
1190 case SSL_HND_CERT_VERIFY:
1194 case SSL_HND_CLIENT_KEY_EXCHG:
1196 /* here we can have all the data to build session key */
1197 StringInfo encrypted_pre_master;
1199 guint encrlen = length, skip;
1205 /* check for required session data */
1206 ssl_debug_printf("dissect_dtls_handshake found SSL_HND_CLIENT_KEY_EXCHG state %X\n",
1208 if ((ssl->state & (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION)) !=
1209 (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION)) {
1210 ssl_debug_printf("dissect_dtls_handshake not enough data to generate key (required %X)\n",
1211 (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION));
1215 encrypted_pre_master.data = se_alloc(encrlen);
1216 encrypted_pre_master.data_len = encrlen;
1217 tvb_memcpy(tvb, encrypted_pre_master.data, offset+skip, encrlen);
1219 if (!ssl->private_key) {
1220 ssl_debug_printf("dissect_dtls_handshake can't find private key\n");
1224 /* go with ssl key processessing; encrypted_pre_master
1225 * will be used for master secret store*/
1226 ret = ssl_decrypt_pre_master_secret(ssl, &encrypted_pre_master, ssl->private_key);
1228 ssl_debug_printf("dissect_dtls_handshake can't decrypt pre master secret\n");
1231 if (ssl_generate_keyring_material(ssl)<0) {
1232 ssl_debug_printf("dissect_dtls_handshake can't generate keyring material\n");
1235 ssl->state |= SSL_HAVE_SESSION_KEY;
1236 ssl_save_session(ssl, dtls_session_hash);
1237 ssl_debug_printf("dissect_dtls_handshake session keys successfully generated\n");
1241 case SSL_HND_FINISHED:
1242 dissect_dtls_hnd_finished(sub_tvb, ssl_hand_tree,
1249 offset += 12; /* skip the handshake header when handshake is not processed*/
1255 dissect_dtls_hnd_hello_common(tvbuff_t *tvb, proto_tree *tree,
1256 guint32 offset, SslDecryptSession* ssl, gint from_server)
1258 /* show the client's random challenge */
1259 nstime_t gmt_unix_time;
1260 guint8 session_id_length;
1261 session_id_length = 0;
1264 /* get proper peer information*/
1267 rnd = &ssl->server_random;
1269 rnd = &ssl->client_random;
1271 /* get provided random for keyring generation*/
1272 tvb_memcpy(tvb, rnd->data, offset, 32);
1275 ssl->state |= SSL_SERVER_RANDOM;
1277 ssl->state |= SSL_CLIENT_RANDOM;
1278 ssl_debug_printf("dissect_dtls_hnd_hello_common found random state %X\n",
1281 session_id_length = tvb_get_guint8(tvb, offset + 32);
1282 /* check stored session id info */
1283 if (from_server && (session_id_length == ssl->session_id.data_len) &&
1284 (tvb_memeql(tvb, offset+33, ssl->session_id.data, session_id_length) == 0))
1286 /* clinet/server id match: try to restore a previous cached session*/
1287 ssl_restore_session(ssl, dtls_session_hash);
1290 tvb_memcpy(tvb,ssl->session_id.data, offset+33, session_id_length);
1291 ssl->session_id.data_len = session_id_length;
1298 gmt_unix_time.secs = tvb_get_ntohl(tvb, offset);
1299 gmt_unix_time.nsecs = 0;
1300 proto_tree_add_time(tree, hf_dtls_handshake_random_time,
1301 tvb, offset, 4, &gmt_unix_time);
1304 /* show the random bytes */
1305 proto_tree_add_item(tree, hf_dtls_handshake_random_bytes,
1306 tvb, offset, 28, 0);
1309 /* show the session id */
1310 session_id_length = tvb_get_guint8(tvb, offset);
1311 proto_tree_add_item(tree, hf_dtls_handshake_session_id_len,
1312 tvb, offset++, 1, 0);
1313 if (session_id_length > 0)
1315 proto_tree_add_bytes_format(tree, hf_dtls_handshake_session_id,
1316 tvb, offset, session_id_length,
1317 tvb_get_ptr(tvb, offset, session_id_length),
1318 "Session ID (%u byte%s)",
1320 plurality(session_id_length, "", "s"));
1321 offset += session_id_length;
1327 return session_id_length+33;
1331 dissect_dtls_hnd_hello_ext(tvbuff_t *tvb,
1332 proto_tree *tree, guint32 offset, guint32 left)
1334 guint16 extension_length;
1338 proto_tree *ext_tree;
1343 extension_length = tvb_get_ntohs(tvb, offset);
1344 proto_tree_add_uint(tree, hf_dtls_handshake_extensions_len,
1345 tvb, offset, 2, extension_length);
1351 ext_type = tvb_get_ntohs(tvb, offset);
1352 ext_len = tvb_get_ntohs(tvb, offset + 2);
1354 pi = proto_tree_add_text(tree, tvb, offset, 4 + ext_len,
1356 val_to_str(ext_type,
1357 tls_hello_extension_types,
1359 ext_tree = proto_item_add_subtree(pi, ett_dtls_extension);
1363 proto_tree_add_uint(ext_tree, hf_dtls_handshake_extension_type,
1364 tvb, offset, 2, ext_type);
1367 proto_tree_add_uint(ext_tree, hf_dtls_handshake_extension_len,
1368 tvb, offset, 2, ext_len);
1371 proto_tree_add_bytes_format(ext_tree, hf_dtls_handshake_extension_data,
1372 tvb, offset, ext_len,
1373 tvb_get_ptr(tvb, offset, ext_len),
1375 ext_len, plurality(ext_len, "", "s"));
1377 left -= 2 + 2 + ext_len;
1384 dissect_dtls_hnd_cli_hello(tvbuff_t *tvb,
1385 proto_tree *tree, guint32 offset, guint32 length,
1386 SslDecryptSession*ssl)
1389 * ProtocolVersion client_version;
1391 * SessionID session_id;
1392 * opaque cookie<0..32>; //new field
1393 * CipherSuite cipher_suites<2..2^16-1>;
1394 * CompressionMethod compression_methods<1..2^8-1>;
1395 * Extension client_hello_extension_list<0..2^16-1>;
1400 proto_tree *cs_tree;
1401 guint16 cipher_suite_length;
1402 guint8 compression_methods_length;
1403 guint8 compression_method;
1404 guint16 start_offset = offset;
1405 guint8 cookie_length;
1406 cipher_suite_length = 0;
1407 compression_methods_length = 0;
1412 /* show the client version */
1414 proto_tree_add_item(tree, hf_dtls_handshake_client_version, tvb,
1418 /* show the fields in common with server hello */
1419 offset += dissect_dtls_hnd_hello_common(tvb, tree, offset, ssl, 0);
1421 /* look for a cookie */
1422 cookie_length = tvb_get_guint8(tvb, offset);
1426 proto_tree_add_uint(tree, hf_dtls_handshake_cookie_len,
1427 tvb, offset, 1, cookie_length);
1428 offset ++; /* skip opaque length */
1430 if (cookie_length > 0)
1432 proto_tree_add_bytes_format(tree, hf_dtls_handshake_cookie,
1433 tvb, offset, cookie_length,
1434 tvb_get_ptr(tvb, offset, cookie_length),
1435 "Cookie (%u byte%s)",
1437 plurality(cookie_length, "", "s"));
1438 offset += cookie_length;
1441 /* tell the user how many cipher suites there are */
1442 cipher_suite_length = tvb_get_ntohs(tvb, offset);
1444 proto_tree_add_uint(tree, hf_dtls_handshake_cipher_suites_len,
1445 tvb, offset, 2, cipher_suite_length);
1446 offset += 2; /* skip opaque length */
1448 if (cipher_suite_length > 0)
1450 tvb_ensure_bytes_exist(tvb, offset, cipher_suite_length);
1451 ti = proto_tree_add_none_format(tree,
1452 hf_dtls_handshake_cipher_suites,
1453 tvb, offset, cipher_suite_length,
1454 "Cipher Suites (%u suite%s)",
1455 cipher_suite_length / 2,
1456 plurality(cipher_suite_length/2, "", "s"));
1458 /* make this a subtree */
1459 cs_tree = proto_item_add_subtree(ti, ett_dtls_cipher_suites);
1462 cs_tree = tree; /* failsafe */
1465 while (cipher_suite_length > 0)
1467 proto_tree_add_item(cs_tree, hf_dtls_handshake_cipher_suite,
1468 tvb, offset, 2, FALSE);
1470 cipher_suite_length -= 2;
1474 /* tell the user how man compression methods there are */
1475 compression_methods_length = tvb_get_guint8(tvb, offset);
1476 proto_tree_add_uint(tree, hf_dtls_handshake_comp_methods_len,
1477 tvb, offset, 1, compression_methods_length);
1480 if (compression_methods_length > 0)
1482 tvb_ensure_bytes_exist(tvb, offset, compression_methods_length);
1483 ti = proto_tree_add_none_format(tree,
1484 hf_dtls_handshake_comp_methods,
1485 tvb, offset, compression_methods_length,
1486 "Compression Methods (%u method%s)",
1487 compression_methods_length,
1488 plurality(compression_methods_length,
1491 /* make this a subtree */
1492 cs_tree = proto_item_add_subtree(ti, ett_dtls_comp_methods);
1495 cs_tree = tree; /* failsafe */
1498 while (compression_methods_length > 0)
1500 compression_method = tvb_get_guint8(tvb, offset);
1501 if (compression_method < 64)
1502 proto_tree_add_uint(cs_tree, hf_dtls_handshake_comp_method,
1503 tvb, offset, 1, compression_method);
1504 else if (compression_method > 63 && compression_method < 193)
1505 proto_tree_add_text(cs_tree, tvb, offset, 1,
1506 "Compression Method: Reserved - to be assigned by IANA (%u)",
1507 compression_method);
1509 proto_tree_add_text(cs_tree, tvb, offset, 1,
1510 "Compression Method: Private use range (%u)",
1511 compression_method);
1513 compression_methods_length--;
1517 if (length > offset - start_offset)
1519 offset = dissect_dtls_hnd_hello_ext(tvb, tree, offset,
1521 (offset - start_offset));
1527 static void dissect_dtls_hnd_hello_verify_request(tvbuff_t *tvb,
1530 SslDecryptSession* ssl)
1534 * ProtocolVersion server_version;
1535 * opaque cookie<0..32>;
1536 * } HelloVerifyRequest;
1539 guint8 cookie_length;
1544 /* show the client version */
1546 proto_tree_add_item(tree, hf_dtls_handshake_server_version, tvb,
1551 /* look for a cookie */
1552 cookie_length = tvb_get_guint8(tvb, offset);
1556 proto_tree_add_uint(tree, hf_dtls_handshake_cookie_len,
1557 tvb, offset, 1, cookie_length);
1558 offset ++; /* skip opaque length */
1560 if (cookie_length > 0)
1562 proto_tree_add_bytes_format(tree, hf_dtls_handshake_cookie,
1563 tvb, offset, cookie_length,
1564 tvb_get_ptr(tvb, offset, cookie_length),
1565 "Cookie (%u byte%s)",
1567 plurality(cookie_length, "", "s"));
1568 offset += cookie_length;
1575 dissect_dtls_hnd_srv_hello(tvbuff_t *tvb,
1576 proto_tree *tree, guint32 offset, guint32 length, SslDecryptSession* ssl)
1579 * ProtocolVersion server_version;
1581 * SessionID session_id;
1582 * CipherSuite cipher_suite;
1583 * CompressionMethod compression_method;
1584 * Extension server_hello_extension_list<0..2^16-1>;
1587 guint16 start_offset;
1588 start_offset = offset;
1592 /* show the server version */
1594 proto_tree_add_item(tree, hf_dtls_handshake_server_version, tvb,
1598 /* first display the elements conveniently in
1599 * common with client hello
1601 offset += dissect_dtls_hnd_hello_common(tvb, tree, offset, ssl, 1);
1603 /* PAOLO: handle session cipher suite */
1605 /* store selected cipher suite for decryption */
1606 ssl->cipher = tvb_get_ntohs(tvb, offset);
1607 if (ssl_find_cipher(ssl->cipher,&ssl->cipher_suite) < 0) {
1608 ssl_debug_printf("dissect_dtls_hnd_srv_hello can't find cipher suite %X\n", ssl->cipher);
1612 ssl->state |= SSL_CIPHER;
1613 ssl_debug_printf("dissect_dtls_hnd_srv_hello found cipher %X, state %X\n",
1614 ssl->cipher, ssl->state);
1616 /* if we have restored a session now we can have enought material
1617 * to build session key, check it out*/
1619 (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION|SSL_MASTER_SECRET)) !=
1620 (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION|SSL_MASTER_SECRET)) {
1621 ssl_debug_printf("dissect_dtls_hnd_srv_hello not enough data to generate key (required %X)\n",
1622 (SSL_CIPHER|SSL_CLIENT_RANDOM|SSL_SERVER_RANDOM|SSL_VERSION|SSL_MASTER_SECRET));
1626 ssl_debug_printf("dissect_dtls_hnd_srv_hello trying to generate keys\n");
1627 if (ssl_generate_keyring_material(ssl)<0) {
1628 ssl_debug_printf("dissect_dtls_hnd_srv_hello can't generate keyring material\n");
1631 ssl->state |= SSL_HAVE_SESSION_KEY;
1637 /* now the server-selected cipher suite */
1638 proto_tree_add_item(tree, hf_dtls_handshake_cipher_suite,
1639 tvb, offset, 2, FALSE);
1642 /* and the server-selected compression method */
1643 proto_tree_add_item(tree, hf_dtls_handshake_comp_method,
1644 tvb, offset, 1, FALSE);
1647 if (length > offset - start_offset)
1649 offset = dissect_dtls_hnd_hello_ext(tvb, tree, offset,
1651 (offset - start_offset));
1657 dissect_dtls_hnd_cert(tvbuff_t *tvb,
1658 proto_tree *tree, guint32 offset, packet_info *pinfo)
1661 /* opaque ASN.1Cert<2^24-1>;
1664 * ASN.1Cert certificate_list<1..2^24-1>;
1667 guint32 certificate_list_length;
1669 proto_tree *subtree;
1670 asn1_ctx_t asn1_ctx;
1671 asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo);
1675 certificate_list_length = tvb_get_ntoh24(tvb, offset);
1676 proto_tree_add_uint(tree, hf_dtls_handshake_certificates_len,
1677 tvb, offset, 3, certificate_list_length);
1678 offset += 3; /* 24-bit length value */
1680 if (certificate_list_length > 0)
1682 tvb_ensure_bytes_exist(tvb, offset, certificate_list_length);
1683 ti = proto_tree_add_none_format(tree,
1684 hf_dtls_handshake_certificates,
1685 tvb, offset, certificate_list_length,
1686 "Certificates (%u byte%s)",
1687 certificate_list_length,
1688 plurality(certificate_list_length,
1691 /* make it a subtree */
1692 subtree = proto_item_add_subtree(ti, ett_dtls_certs);
1695 subtree = tree; /* failsafe */
1698 /* iterate through each certificate */
1699 while (certificate_list_length > 0)
1701 /* get the length of the current certificate */
1702 guint32 cert_length = tvb_get_ntoh24(tvb, offset);
1703 certificate_list_length -= 3 + cert_length;
1705 proto_tree_add_item(subtree, hf_dtls_handshake_certificate_len,
1706 tvb, offset, 3, FALSE);
1709 dissect_x509af_Certificate(FALSE, tvb, offset, &asn1_ctx, subtree, hf_dtls_handshake_certificate);
1710 offset += cert_length;
1718 dissect_dtls_hnd_cert_req(tvbuff_t *tvb,
1719 proto_tree *tree, guint32 offset)
1723 * rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4),
1725 * } ClientCertificateType;
1727 * opaque DistinguishedName<1..2^16-1>;
1730 * ClientCertificateType certificate_types<1..2^8-1>;
1731 * DistinguishedName certificate_authorities<3..2^16-1>;
1732 * } CertificateRequest;
1736 proto_tree *subtree;
1737 guint8 cert_types_count;
1739 cert_types_count = 0;
1744 cert_types_count = tvb_get_guint8(tvb, offset);
1745 proto_tree_add_uint(tree, hf_dtls_handshake_cert_types_count,
1746 tvb, offset, 1, cert_types_count);
1749 if (cert_types_count > 0)
1751 ti = proto_tree_add_none_format(tree,
1752 hf_dtls_handshake_cert_types,
1753 tvb, offset, cert_types_count,
1754 "Certificate types (%u type%s)",
1756 plurality(cert_types_count, "", "s"));
1757 subtree = proto_item_add_subtree(ti, ett_dtls_cert_types);
1763 while (cert_types_count > 0)
1765 proto_tree_add_item(subtree, hf_dtls_handshake_cert_type,
1766 tvb, offset, 1, FALSE);
1772 dnames_length = tvb_get_ntohs(tvb, offset);
1773 proto_tree_add_uint(tree, hf_dtls_handshake_dnames_len,
1774 tvb, offset, 2, dnames_length);
1777 if (dnames_length > 0)
1779 tvb_ensure_bytes_exist(tvb, offset, dnames_length);
1780 ti = proto_tree_add_none_format(tree,
1781 hf_dtls_handshake_dnames,
1782 tvb, offset, dnames_length,
1783 "Distinguished Names (%d byte%s)",
1785 plurality(dnames_length, "", "s"));
1786 subtree = proto_item_add_subtree(ti, ett_dtls_dnames);
1792 while (dnames_length > 0)
1794 /* get the length of the current certificate */
1795 guint16 name_length = tvb_get_ntohs(tvb, offset);
1796 dnames_length -= 2 + name_length;
1798 proto_tree_add_item(subtree, hf_dtls_handshake_dname_len,
1799 tvb, offset, 2, FALSE);
1802 proto_tree_add_bytes_format(subtree,
1803 hf_dtls_handshake_dname,
1804 tvb, offset, name_length,
1805 tvb_get_ptr(tvb, offset, name_length),
1806 "Distinguished Name (%u byte%s)",
1808 plurality(name_length, "", "s"));
1809 offset += name_length;
1817 dissect_dtls_hnd_finished(tvbuff_t *tvb,
1818 proto_tree *tree, guint32 offset,
1819 guint* conv_version)
1823 * opaque verify_data[12];
1827 /* this all needs a tree, so bail if we don't have one */
1833 switch(*conv_version) {
1835 proto_tree_add_item(tree, hf_dtls_handshake_finished,
1836 tvb, offset, 12, FALSE);
1841 /*********************************************************************
1845 *********************************************************************/
1848 ssl_set_conv_version(packet_info *pinfo, guint version)
1850 conversation_t *conversation;
1852 if (pinfo->fd->flags.visited)
1854 /* We've already processed this frame; no need to do any more
1860 conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
1861 pinfo->srcport, pinfo->destport, 0);
1863 if (conversation == NULL)
1865 /* create a new conversation */
1866 conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype,
1867 pinfo->srcport, pinfo->destport, 0);
1870 if (conversation_get_proto_data(conversation, proto_dtls) != NULL)
1872 /* get rid of the current data */
1873 conversation_delete_proto_data(conversation, proto_dtls);
1875 conversation_add_proto_data(conversation, proto_dtls, GINT_TO_POINTER(version));
1880 dtls_is_valid_handshake_type(guint8 type)
1884 case SSL_HND_HELLO_REQUEST:
1885 case SSL_HND_CLIENT_HELLO:
1886 case SSL_HND_SERVER_HELLO:
1887 case SSL_HND_HELLO_VERIFY_REQUEST:
1888 case SSL_HND_CERTIFICATE:
1889 case SSL_HND_SERVER_KEY_EXCHG:
1890 case SSL_HND_CERT_REQUEST:
1891 case SSL_HND_SVR_HELLO_DONE:
1892 case SSL_HND_CERT_VERIFY:
1893 case SSL_HND_CLIENT_KEY_EXCHG:
1894 case SSL_HND_FINISHED:
1901 dtls_is_authoritative_version_message(guint8 content_type,
1904 if (content_type == SSL_ID_HANDSHAKE
1905 && dtls_is_valid_handshake_type(next_byte))
1907 return (next_byte != SSL_HND_CLIENT_HELLO);
1909 else if (ssl_is_valid_content_type(content_type)
1910 && content_type != SSL_ID_HANDSHAKE)
1917 /* this applies a heuristic to determine whether
1918 * or not the data beginning at offset looks like a
1919 * valid dtls record.
1922 looks_like_dtls(tvbuff_t *tvb, guint32 offset)
1924 /* have to have a valid content type followed by a valid
1930 /* see if the first byte is a valid content type */
1931 byte = tvb_get_guint8(tvb, offset);
1932 if (!ssl_is_valid_content_type(byte))
1937 /* now check to see if the version byte appears valid */
1938 version = tvb_get_ntohs(tvb, offset + 1);
1939 if (version != DTLSV1DOT0_VERSION && version != DTLSV1DOT0_VERSION_NOT)
1947 /*********************************************************************
1949 * Standard Wireshark Protocol Registration and housekeeping
1951 *********************************************************************/
1953 proto_register_dtls(void)
1956 /* Setup list of header fields See Section 1.6.1 for details*/
1957 static hf_register_info hf[] = {
1959 { "Record Layer", "dtls.record",
1960 FT_NONE, BASE_NONE, NULL, 0x0,
1961 "Record layer", HFILL }
1963 { &hf_dtls_record_content_type,
1964 { "Content Type", "dtls.record.content_type",
1965 FT_UINT8, BASE_DEC, VALS(ssl_31_content_type), 0x0,
1966 "Content type", HFILL}
1968 { &hf_dtls_record_version,
1969 { "Version", "dtls.record.version",
1970 FT_UINT16, BASE_HEX, VALS(ssl_versions), 0x0,
1971 "Record layer version.", HFILL }
1973 { &hf_dtls_record_epoch,
1974 { "Epoch", "dtls.record.epoch",
1975 FT_UINT16, BASE_DEC, NULL, 0x0,
1978 { &hf_dtls_record_sequence_number,
1979 { "Sequence Number", "dtls.record.sequence_number",
1980 FT_DOUBLE, BASE_DEC, NULL, 0x0,
1981 "Sequence Number", HFILL }
1983 { &hf_dtls_record_length,
1984 { "Length", "dtls.record.length",
1985 FT_UINT16, BASE_DEC, NULL, 0x0,
1986 "Length of DTLS record data", HFILL }
1988 { &hf_dtls_record_appdata,
1989 { "Encrypted Application Data", "dtls.app_data",
1990 FT_BYTES, BASE_HEX, NULL, 0x0,
1991 "Payload is encrypted application data", HFILL }
1993 { &hf_dtls_change_cipher_spec,
1994 { "Change Cipher Spec Message", "dtls.change_cipher_spec",
1995 FT_NONE, BASE_NONE, NULL, 0x0,
1996 "Signals a change in cipher specifications", HFILL }
1998 { & hf_dtls_alert_message,
1999 { "Alert Message", "dtls.alert_message",
2000 FT_NONE, BASE_NONE, NULL, 0x0,
2001 "Alert message", HFILL }
2003 { & hf_dtls_alert_message_level,
2004 { "Level", "dtls.alert_message.level",
2005 FT_UINT8, BASE_DEC, VALS(ssl_31_alert_level), 0x0,
2006 "Alert message level", HFILL }
2008 { &hf_dtls_alert_message_description,
2009 { "Description", "dtls.alert_message.desc",
2010 FT_UINT8, BASE_DEC, VALS(ssl_31_alert_description), 0x0,
2011 "Alert message description", HFILL }
2013 { &hf_dtls_handshake_protocol,
2014 { "Handshake Protocol", "dtls.handshake",
2015 FT_NONE, BASE_NONE, NULL, 0x0,
2016 "Handshake protocol message", HFILL}
2018 { &hf_dtls_handshake_type,
2019 { "Handshake Type", "dtls.handshake.type",
2020 FT_UINT8, BASE_DEC, VALS(ssl_31_handshake_type), 0x0,
2021 "Type of handshake message", HFILL}
2023 { &hf_dtls_handshake_length,
2024 { "Length", "dtls.handshake.length",
2025 FT_UINT24, BASE_DEC, NULL, 0x0,
2026 "Length of handshake message", HFILL }
2028 { &hf_dtls_handshake_message_seq,
2029 { "Message Sequence", "dtls.handshake.message_seq",
2030 FT_UINT16, BASE_DEC, NULL, 0x0,
2031 "Message sequence of handshake message", HFILL }
2033 { &hf_dtls_handshake_fragment_offset,
2034 { "Fragment Offset", "dtls.handshake.fragment_offset",
2035 FT_UINT24, BASE_DEC, NULL, 0x0,
2036 "Fragment offset of handshake message", HFILL }
2038 { &hf_dtls_handshake_fragment_length,
2039 { "Fragment Length", "dtls.handshake.fragment_length",
2040 FT_UINT24, BASE_DEC, NULL, 0x0,
2041 "Fragment length of handshake message", HFILL }
2043 { &hf_dtls_handshake_client_version,
2044 { "Version", "dtls.handshake.version",
2045 FT_UINT16, BASE_HEX, VALS(ssl_versions), 0x0,
2046 "Maximum version supported by client", HFILL }
2048 { &hf_dtls_handshake_server_version,
2049 { "Version", "dtls.handshake.version",
2050 FT_UINT16, BASE_HEX, VALS(ssl_versions), 0x0,
2051 "Version selected by server", HFILL }
2053 { &hf_dtls_handshake_random_time,
2054 { "Random.gmt_unix_time", "dtls.handshake.random_time",
2055 FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x0,
2056 "Unix time field of random structure", HFILL }
2058 { &hf_dtls_handshake_random_bytes,
2059 { "Random.bytes", "dtls.handshake.random",
2060 FT_NONE, BASE_NONE, NULL, 0x0,
2061 "Random challenge used to authenticate server", HFILL }
2063 { &hf_dtls_handshake_cipher_suites_len,
2064 { "Cipher Suites Length", "dtls.handshake.cipher_suites_length",
2065 FT_UINT16, BASE_DEC, NULL, 0x0,
2066 "Length of cipher suites field", HFILL }
2068 { &hf_dtls_handshake_cipher_suites,
2069 { "Cipher Suites", "dtls.handshake.ciphersuites",
2070 FT_NONE, BASE_NONE, NULL, 0x0,
2071 "List of cipher suites supported by client", HFILL }
2073 { &hf_dtls_handshake_cipher_suite,
2074 { "Cipher Suite", "dtls.handshake.ciphersuite",
2075 FT_UINT16, BASE_HEX, VALS(ssl_31_ciphersuite), 0x0,
2076 "Cipher suite", HFILL }
2078 { &hf_dtls_handshake_cookie_len,
2079 { "Cookie Length", "dtls.handshake.cookie_length",
2080 FT_UINT8, BASE_DEC, NULL, 0x0,
2081 "Length of the cookie field", HFILL }
2083 { &hf_dtls_handshake_cookie,
2084 { "Cookie", "dtls.handshake.cookie",
2085 FT_BYTES, BASE_NONE, NULL, 0x0,
2088 { &hf_dtls_handshake_session_id,
2089 { "Session ID", "dtls.handshake.session_id",
2090 FT_BYTES, BASE_NONE, NULL, 0x0,
2091 "Identifies the DTLS session, allowing later resumption", HFILL }
2093 { &hf_dtls_handshake_comp_methods_len,
2094 { "Compression Methods Length", "dtls.handshake.comp_methods_length",
2095 FT_UINT8, BASE_DEC, NULL, 0x0,
2096 "Length of compression methods field", HFILL }
2098 { &hf_dtls_handshake_comp_methods,
2099 { "Compression Methods", "dtls.handshake.comp_methods",
2100 FT_NONE, BASE_NONE, NULL, 0x0,
2101 "List of compression methods supported by client", HFILL }
2103 { &hf_dtls_handshake_comp_method,
2104 { "Compression Method", "dtls.handshake.comp_method",
2105 FT_UINT8, BASE_DEC, VALS(ssl_31_compression_method), 0x0,
2106 "Compression Method", HFILL }
2108 { &hf_dtls_handshake_extensions_len,
2109 { "Extensions Length", "dtls.handshake.extensions_length",
2110 FT_UINT16, BASE_DEC, NULL, 0x0,
2111 "Length of hello extensions", HFILL }
2113 { &hf_dtls_handshake_extension_type,
2114 { "Type", "dtls.handshake.extension.type",
2115 FT_UINT16, BASE_HEX, VALS(tls_hello_extension_types), 0x0,
2116 "Hello extension type", HFILL }
2118 { &hf_dtls_handshake_extension_len,
2119 { "Length", "dtls.handshake.extension.len",
2120 FT_UINT16, BASE_DEC, NULL, 0x0,
2121 "Length of a hello extension", HFILL }
2123 { &hf_dtls_handshake_extension_data,
2124 { "Data", "dtls.handshake.extension.data",
2125 FT_BYTES, BASE_NONE, NULL, 0x0,
2126 "Hello Extension data", HFILL }
2128 { &hf_dtls_handshake_certificates_len,
2129 { "Certificates Length", "dtls.handshake.certificates_length",
2130 FT_UINT24, BASE_DEC, NULL, 0x0,
2131 "Length of certificates field", HFILL }
2133 { &hf_dtls_handshake_certificates,
2134 { "Certificates", "dtls.handshake.certificates",
2135 FT_NONE, BASE_NONE, NULL, 0x0,
2136 "List of certificates", HFILL }
2138 { &hf_dtls_handshake_certificate,
2139 { "Certificate", "dtls.handshake.certificate",
2140 FT_BYTES, BASE_NONE, NULL, 0x0,
2141 "Certificate", HFILL }
2143 { &hf_dtls_handshake_certificate_len,
2144 { "Certificate Length", "dtls.handshake.certificate_length",
2145 FT_UINT24, BASE_DEC, NULL, 0x0,
2146 "Length of certificate", HFILL }
2148 { &hf_dtls_handshake_cert_types_count,
2149 { "Certificate types count", "dtls.handshake.cert_types_count",
2150 FT_UINT8, BASE_DEC, NULL, 0x0,
2151 "Count of certificate types", HFILL }
2153 { &hf_dtls_handshake_cert_types,
2154 { "Certificate types", "dtls.handshake.cert_types",
2155 FT_NONE, BASE_NONE, NULL, 0x0,
2156 "List of certificate types", HFILL }
2158 { &hf_dtls_handshake_cert_type,
2159 { "Certificate type", "dtls.handshake.cert_type",
2160 FT_UINT8, BASE_DEC, VALS(ssl_31_client_certificate_type), 0x0,
2161 "Certificate type", HFILL }
2163 { &hf_dtls_handshake_finished,
2164 { "Verify Data", "dtls.handshake.verify_data",
2165 FT_NONE, BASE_NONE, NULL, 0x0,
2166 "Opaque verification data", HFILL }
2168 { &hf_dtls_handshake_md5_hash,
2169 { "MD5 Hash", "dtls.handshake.md5_hash",
2170 FT_NONE, BASE_NONE, NULL, 0x0,
2171 "Hash of messages, master_secret, etc.", HFILL }
2173 { &hf_dtls_handshake_sha_hash,
2174 { "SHA-1 Hash", "dtls.handshake.sha_hash",
2175 FT_NONE, BASE_NONE, NULL, 0x0,
2176 "Hash of messages, master_secret, etc.", HFILL }
2178 { &hf_dtls_handshake_session_id_len,
2179 { "Session ID Length", "dtls.handshake.session_id_length",
2180 FT_UINT8, BASE_DEC, NULL, 0x0,
2181 "Length of session ID field", HFILL }
2183 { &hf_dtls_handshake_dnames_len,
2184 { "Distinguished Names Length", "dtls.handshake.dnames_len",
2185 FT_UINT16, BASE_DEC, NULL, 0x0,
2186 "Length of list of CAs that server trusts", HFILL }
2188 { &hf_dtls_handshake_dnames,
2189 { "Distinguished Names", "dtls.handshake.dnames",
2190 FT_NONE, BASE_NONE, NULL, 0x0,
2191 "List of CAs that server trusts", HFILL }
2193 { &hf_dtls_handshake_dname_len,
2194 { "Distinguished Name Length", "dtls.handshake.dname_len",
2195 FT_UINT16, BASE_DEC, NULL, 0x0,
2196 "Length of distinguished name", HFILL }
2198 { &hf_dtls_handshake_dname,
2199 { "Distinguished Name", "dtls.handshake.dname",
2200 FT_BYTES, BASE_NONE, NULL, 0x0,
2201 "Distinguished name of a CA that server trusts", HFILL }
2203 { &hf_dtls_fragments,
2204 { "Message fragments", "dtls.fragments",
2205 FT_NONE, BASE_NONE, NULL, 0x00, NULL, HFILL }
2207 { &hf_dtls_fragment,
2208 { "Message fragment", "dtls.fragment",
2209 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2211 { &hf_dtls_fragment_overlap,
2212 { "Message fragment overlap", "dtls.fragment.overlap",
2213 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2215 { &hf_dtls_fragment_overlap_conflicts,
2216 { "Message fragment overlapping with conflicting data",
2217 "dtls.fragment.overlap.conflicts",
2218 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2220 { &hf_dtls_fragment_multiple_tails,
2221 { "Message has multiple tail fragments",
2222 "dtls.fragment.multiple_tails",
2223 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2225 { &hf_dtls_fragment_too_long_fragment,
2226 { "Message fragment too long", "dtls.fragment.too_long_fragment",
2227 FT_BOOLEAN, BASE_NONE, NULL, 0x00, NULL, HFILL }
2229 { &hf_dtls_fragment_error,
2230 { "Message defragmentation error", "dtls.fragment.error",
2231 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2233 { &hf_dtls_reassembled_in,
2234 { "Reassembled in", "dtls.reassembled.in",
2235 FT_FRAMENUM, BASE_NONE, NULL, 0x00, NULL, HFILL }
2239 /* Setup protocol subtree array */
2240 static gint *ett[] = {
2244 &ett_dtls_handshake,
2245 &ett_dtls_cipher_suites,
2246 &ett_dtls_comp_methods,
2247 &ett_dtls_extension,
2249 &ett_dtls_cert_types,
2252 &ett_dtls_fragments,
2255 /* Register the protocol name and description */
2256 proto_dtls = proto_register_protocol("Datagram Transport Layer Security",
2259 /* Required function calls to register the header fields and
2261 proto_register_field_array(proto_dtls, hf, array_length(hf));
2262 proto_register_subtree_array(ett, array_length(ett));
2264 #ifdef HAVE_LIBGNUTLS
2266 module_t *dtls_module = prefs_register_protocol(proto_dtls, dtls_parse);
2267 prefs_register_string_preference(dtls_module, "keys_list", "RSA keys list",
2268 "semicolon separated list of private RSA keys used for DTLS decryption; "
2269 "each list entry must be in the form of <ip>,<port>,<protocol>,<key_file_name>"
2270 "<key_file_name> is the local file name of the RSA private key used by the specified server\n",
2271 (const gchar **)&dtls_keys_list);
2272 prefs_register_string_preference(dtls_module, "debug_file", "DTLS debug file",
2273 "redirect dtls debug to file name; leave empty to disable debug, "
2274 "use \"" SSL_DEBUG_USE_STDERR "\" to redirect output to stderr\n",
2275 (const gchar **)&dtls_debug_file_name);
2279 register_dissector("dtls", dissect_dtls, proto_dtls);
2280 dtls_handle = find_dissector("dtls");
2282 dtls_associations = g_tree_new(ssl_association_cmp);
2284 register_init_routine(dtls_init);
2286 dtls_tap = register_tap("dtls");
2287 ssl_debug_printf("proto_register_dtls: registered tap %s:%d\n",
2291 /* If this dissector uses sub-dissector registration add a registration
2292 * routine. This format is required because a script is used to find
2293 * these routines and create the code that calls these routines.
2296 proto_reg_handoff_dtls(void)
2299 /* add now dissector to default ports.*/