*
* Routines to dissect WTLS component of WAP traffic.
*
- * $Id: packet-wtls.c,v 1.5 2001/04/17 23:26:51 guy Exp $
+ * $Id: packet-wtls.c,v 1.18 2002/01/24 09:20:52 guy Exp $
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
- * Copyright 1998 Didier Jorand
+ * By Gerald Combs <gerald@ethereal.com>
+ * Copyright 1998 Gerald Combs
*
* WAP dissector based on original work by Ben Fowler
* Updated by Neil Hunter <neil.hunter@energis-squared.com>
#include <string.h>
#include <glib.h>
-#include "packet.h"
+#include <epan/packet.h>
#include "packet-wap.h"
#include "packet-wtls.h"
static int hf_wtls_hands_cli_hello_gmt = HF_EMPTY;
static int hf_wtls_hands_cli_hello_random = HF_EMPTY;
static int hf_wtls_hands_cli_hello_session = HF_EMPTY;
+static int hf_wtls_hands_cli_hello_session_str = HF_EMPTY;
static int hf_wtls_hands_cli_hello_cli_key_id = HF_EMPTY;
+static int hf_wtls_hands_cli_hello_cli_key_len = HF_EMPTY;
static int hf_wtls_hands_cli_hello_trust_key_id = HF_EMPTY;
static int hf_wtls_hands_cli_hello_key_exchange =HF_EMPTY;
static int hf_wtls_hands_cli_hello_key_exchange_suite =HF_EMPTY;
static int hf_wtls_hands_cli_hello_key_identifier_charset =HF_EMPTY;
static int hf_wtls_hands_cli_hello_key_identifier_size =HF_EMPTY;
static int hf_wtls_hands_cli_hello_key_identifier =HF_EMPTY;
+static int hf_wtls_hands_cli_hello_key_identifier_str =HF_EMPTY;
static int hf_wtls_hands_cli_hello_cipher_suite =HF_EMPTY;
static int hf_wtls_hands_cli_hello_cipher_suite_item =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_bulk =HF_EMPTY;
-static int hf_wtls_hands_cli_hello_cipher_mac =HF_EMPTY;
static int hf_wtls_hands_cli_hello_compression_methods =HF_EMPTY;
static int hf_wtls_hands_cli_hello_compression =HF_EMPTY;
static int hf_wtls_hands_cli_hello_sequence_mode =HF_EMPTY;
static int hf_wtls_hands_serv_hello_gmt = HF_EMPTY;
static int hf_wtls_hands_serv_hello_random = HF_EMPTY;
static int hf_wtls_hands_serv_hello_session = HF_EMPTY;
+static int hf_wtls_hands_serv_hello_session_str = HF_EMPTY;
static int hf_wtls_hands_serv_hello_cli_key_id =HF_EMPTY;
static int hf_wtls_hands_serv_hello_cipher_suite_item =HF_EMPTY;
static int hf_wtls_hands_serv_hello_cipher_bulk =HF_EMPTY;
{ 0, "No identifier" },
{ 1, "Textual Name" },
{ 2, "Binary Name" },
- { 254, "SHA-1 Hash Publie Key" },
+ { 254, "SHA-1 Hash of Public Key" },
{ 255, "x509 Distinguished Name" },
{ 0x00, NULL }
};
static void
dissect_wtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- frame_data *fdata = pinfo->fd;
int offset = 0;
char pdut;
proto_tree *wtls_rec_tree;
proto_tree *wtls_msg_type_tree;
- if (check_col(fdata, COL_PROTOCOL))
+ if (check_col(pinfo->cinfo, COL_PROTOCOL))
{
switch ( pinfo->match_port )
{
case UDP_PORT_WTLS_WSP:
- col_set_str(fdata, COL_PROTOCOL, "WTLS+WSP" );
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WSP" );
break;
case UDP_PORT_WTLS_WTP_WSP:
- col_set_str(fdata, COL_PROTOCOL, "WTLS+WTP+WSP" );
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "WTLS+WTP+WSP" );
break;
}
}
/* Develop the string to put in the Info column */
- if (check_col(fdata, COL_INFO)) {
- col_set_str(fdata, COL_INFO, "WTLS" );
+ if (check_col(pinfo->cinfo, COL_INFO)) {
+ col_set_str(pinfo->cinfo, COL_INFO, "WTLS" );
};
/* In the interest of speed, if "tree" is NULL, don't do any work not
if (tree) {
ti = proto_tree_add_item(tree, proto_wtls, tvb, offset_wtls,
- tvb_length(tvb), bo_little_endian);
+ -1, bo_little_endian);
wtls_tree = proto_item_add_subtree(ti, ett_wtls);
- for (offset_wtls=0; offset_wtls < (tvb_length(tvb)-1);) {
+ for (offset_wtls=0; offset_wtls < (tvb_reported_length(tvb)-1);) {
pdut = tvb_get_guint8 (tvb, offset_wtls);
offset = offset_wtls+1;
count += offset-offset_wtls;
}
else {
- count = tvb_length (tvb)-offset_wtls;
+ count = tvb_length_remaining (tvb, offset_wtls);
}
ti = proto_tree_add_uint(wtls_tree, hf_wtls_record, tvb, offset_wtls,
count, pdut);
offset+=2;
}
else {
- count = tvb_length (tvb)-offset;
+ count = tvb_length_remaining (tvb, offset);
}
if (pdut & WTLS_RECORD_TYPE_CIPHER_CUR) {
dissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count)
{
char pdu_msg_type;
- struct timeval timeValue;
+ nstime_t timeValue;
int client_size = 0;
guint value = 0;
int size = 0;
- int charset = 0;
guint public_key = 0;
guint signature = 0;
char valStr[1024];
+ char *valBulk = NULL;
+ char *valMac = NULL;
proto_item *ti;
proto_item *cli_key_item;
ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version,
tvb,offset,1,bo_big_endian);
offset++;
- timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
- timeValue.tv_usec = 0;
+ timeValue.secs = tvb_get_ntohl (tvb, offset);
+ timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb,
offset, 4, &timeValue);
offset+=4;
tvb,offset,12,bo_big_endian);
offset+=12;
count = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
- tvb,offset,count+1,bo_big_endian);
+ switch(count) {
+ case 0:
+ ti = proto_tree_add_string (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session_str,
+ tvb,offset,count+1,"NULL");
+ break;
+ case 1 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
+ tvb,offset,count+1,tvb_get_guint8(tvb,offset+1));
+ break;
+ case 2 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
+ tvb,offset,count+1,tvb_get_ntohs(tvb,offset+1));
+ break;
+ case 3 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
+ tvb,offset,count+1,tvb_get_ntoh24(tvb,offset+1));
+ break;
+ case 4 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session,
+ tvb,offset,count+1,tvb_get_ntohl(tvb,offset+1));
+ break;
+ default:
+ ti = proto_tree_add_string (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session_str,
+ tvb,offset,count+1,"Too big");
+ break;
+ }
offset+=1+count;
/* process client_key_ids structure */
hf_wtls_hands_cli_hello_cli_key_id, tvb, offset,
count+2, bo_little_endian);
wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
+
+ /* display length of client_key_ids structure */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
+ hf_wtls_hands_cli_hello_cli_key_len,
+ tvb,offset,2,bo_big_endian);
offset+=2;
+
+ /* cycle through client_key_ids entries */
for (;count > 0;count-=client_size) {
/* get encryption suite id (one byte) */
value = tvb_get_guint8 (tvb, offset);
/* identifier present in next field */
/* note: value 0x0 means no identifier */
- if (value == 0x01) { /* text identifier */
- /* not tested */
- charset = tvb_get_ntohs (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_charset,
- tvb,offset,1,bo_big_endian);
- offset+=2;
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+3;
+ switch(value) {
+ case 0x01 : /* text identifier */
+ /* not teste */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_charset,
+ tvb,offset,2,bo_big_endian);
+ offset+=2;
+ size = tvb_get_guint8 (tvb, offset);
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ strncpy(valStr,tvb_get_ptr (tvb, offset, size),size);
+ valStr[size]=0;
+ ti = proto_tree_add_string(
+ wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_str,
+ tvb, offset,size,valStr);
+ offset+=size;
+ client_size+=size+3;
#ifdef DEBUG
- fprintf(stderr, "text id size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "text id size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
- }
- else if (value == 0x02) { /* binary identifier */
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0x02 : /* binary identifier */
+ size = tvb_get_guint8 (tvb, offset);
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,size,bo_big_endian);
+ offset+=size;
+ client_size+=size+1;
#ifdef DEBUG
- fprintf(stderr, "binary id size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "binary id size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
- }
- else if (value == 0xfe) { /* SHA-1 hash of the public key */
- /* not tested */
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0xfe : /* SHA-1 hash of the public key */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,20,bo_big_endian);
+ offset+=20;
+ client_size+=20;
#ifdef DEBUG
- fprintf(stderr, "SHA-1 hash size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "SHA-1 hash size = 20, client_size = %d\n",
+ client_size);
#endif /* DEBUG */
- }
- else if (value == 0xff) { /* X.509 distinguished name */
- /* not tested */
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0xff : /* X.509 distinguished name */
+ /* not tested */
+ size = tvb_get_guint8 (tvb, offset);
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,size,bo_big_endian);
+ offset+=size;
+ client_size+=size+1;
#ifdef DEBUG
- fprintf(stderr, "X.509 name size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "X.509 name size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
+ break;
}
proto_item_set_len(cli_key_item, client_size);
hf_wtls_hands_cli_hello_trust_key_id, tvb, offset,
count+2, bo_little_endian);
wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
+
+ /* display length of trusted_keys structure */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_tree,
+ hf_wtls_hands_cli_hello_cli_key_len,
+ tvb,offset,2,bo_big_endian);
+
offset+=2;
for (;count > 0;count-=client_size) {
/* get encryption suite id (one byte) */
/* identifier present in next field */
/* note: value 0x0 means no identifier */
- if (value == 0x01) { /* text identifier */
- /* not tested */
- charset = tvb_get_ntohs (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_charset,
- tvb,offset,1,bo_big_endian);
- offset+=2;
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+3;
+ switch (value) {
+ case 0x01 : /* text identifier */
+ /* not temasted */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_charset,
+ tvb,offset,2,bo_big_endian);
+ offset+=2;
+ size = tvb_get_guint8 (tvb, offset);
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ strncpy(valStr,tvb_get_ptr (tvb, offset, size),size);
+ valStr[size]=0;
+ ti = proto_tree_add_string(
+ wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_str,
+ tvb, offset,size,valStr);
+ offset+=size;
+ client_size+=size+3;
#ifdef DEBUG
- fprintf(stderr, "text id size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "text id size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
- }
- else if (value == 0x02) { /* binary identifier */
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0x02 : /* binary identifier */
+ size = tvb_get_guint8 (tvb, offset);
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,size,bo_big_endian);
+ offset+=size;
+ client_size+=size+1;
#ifdef DEBUG
- fprintf(stderr, "binary id size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "binary id size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
- }
- else if (value == 0xfe) { /* SHA-1 hash of the public key */
- /* not tested */
- size = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0xfe : /* SHA-1 hash of the public key */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,20,bo_big_endian);
+ offset+=20;
+ client_size+=20;
#ifdef DEBUG
- fprintf(stderr, "SHA-1 hash size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "SHA-1 hash size = 20, client_size = %d\n",
+ client_size);
#endif /* DEBUG */
- }
- else if (value == 0xff) { /* X.509 distinguished name */
- /* not tested */
- size = tvb_get_guint8 (tvb, offset);
- /* need to fetch identifier and display it */
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier_size,
- tvb,offset,1,bo_big_endian);
- offset++;
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_key_identifier,
- tvb,offset,size,bo_big_endian);
- offset+=size;
- client_size+=size+1;
+ break;
+ case 0xff : /* X.509 distinguished name */
+ /* not testet */
+ size = tvb_get_guint8 (tvb, offset);
+ /* need to fetch identifier and display it */
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier_size,
+ tvb,offset,1,bo_big_endian);
+ offset++;
+ ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
+ hf_wtls_hands_cli_hello_key_identifier,
+ tvb,offset,size,bo_big_endian);
+ offset+=size;
+ client_size+=size+1;
#ifdef DEBUG
- fprintf(stderr, "X.509 name size = %d, client_size = %d\n",
- size, client_size);
+ fprintf(stderr, "X.509 name size = %d, client_size = %d\n",
+ size, client_size);
#endif /* DEBUG */
+ break;
}
proto_item_set_len(cli_key_item, client_size);
}
wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub);
offset+=1;
for (;count > 0;count-=client_size) {
- cli_key_item = proto_tree_add_item(wtls_msg_type_item_sub_tree,
- hf_wtls_hands_cli_hello_cipher_suite_item, tvb, offset,1,
- bo_little_endian);
- client_size=1;
- wtls_msg_type_item_sub_sub_tree = proto_item_add_subtree(cli_key_item,
- ett_wtls_msg_type_item_sub_sub);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_cipher_bulk,
- tvb,offset,1,bo_big_endian);
- offset++;
- value = tvb_get_guint8 (tvb, offset);
- ti = proto_tree_add_item(wtls_msg_type_item_sub_sub_tree,
- hf_wtls_hands_cli_hello_cipher_mac,
- tvb,offset,1,bo_big_endian);
+ value = tvb_get_guint8 (tvb, offset);
+ valBulk = match_strval(value, wtls_vals_cipher_bulk);
+ offset++;
+ client_size=1;
+ valMac = match_strval(tvb_get_guint8 (tvb, offset), wtls_vals_cipher_mac);
+ if (valBulk != NULL)
+ {
+ if (valMac != NULL)
+ {
+ snprintf(valStr,1024,"%s, %s",valBulk,valMac);
+ }
+ else
+ {
+ snprintf(valStr,1024,"%s, Unknow MAC (0x%02x)",valBulk,tvb_get_guint8 (tvb, offset));
+ }
+ }
+ else
+ {
+ if (valMac != NULL)
+ {
+ snprintf(valStr,1024,"Unknow Bulk (0x%02x), %s",value,valMac);
+ }
+ else
+ {
+ snprintf(valStr,1024,"Unknow Bulk (0x%02x), Unknow MAC (0x%02x)",value,
+ tvb_get_guint8 (tvb, offset));
+ }
+ }
offset++;
client_size++;
- proto_item_set_len(cli_key_item, client_size);
+ cli_key_item = proto_tree_add_string(wtls_msg_type_item_sub_tree,
+ hf_wtls_hands_cli_hello_cipher_suite_item, tvb, offset-2,2,
+ valStr);
}
count = tvb_get_guint8 (tvb, offset);
ti = proto_tree_add_item(wtls_msg_type_item_tree,
ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_version,
tvb,offset,1,bo_big_endian);
offset++;
- timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
- timeValue.tv_usec = 0;
+ timeValue.secs = tvb_get_ntohl (tvb, offset);
+ timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_gmt, tvb,
offset, 4, &timeValue);
offset+=4;
tvb,offset,12,bo_big_endian);
offset+=12;
count = tvb_get_guint8(tvb, offset);
- ti = proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
- tvb,offset,count+1,bo_big_endian);
+ switch(count) {
+ case 0:
+ ti = proto_tree_add_string (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session_str,
+ tvb,offset,count+1,"NULL");
+ break;
+ case 1 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
+ tvb,offset,count+1,tvb_get_guint8(tvb,offset+1));
+ break;
+ case 2 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
+ tvb,offset,count+1,tvb_get_ntohs(tvb,offset+1));
+ break;
+ case 3 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
+ tvb,offset,count+1,tvb_get_ntoh24(tvb,offset+1));
+ break;
+ case 4 :
+ ti = proto_tree_add_uint (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session,
+ tvb,offset,count+1,tvb_get_ntohl(tvb,offset+1));
+ break;
+ default:
+ ti = proto_tree_add_string (wtls_msg_type_item_tree, hf_wtls_hands_serv_hello_session_str,
+ tvb,offset,count+1,"Too big");
+ break;
+ }
offset+=1+count;
ti = proto_tree_add_item(wtls_msg_type_item_tree,
hf_wtls_hands_serv_hello_cli_key_id,
case IDENTIFIER_X509 :
break;
}
- timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
- timeValue.tv_usec = 0;
+ timeValue.secs = tvb_get_ntohl (tvb, offset);
+ timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_before,
tvb, offset, 4, &timeValue);
offset+=4;
client_size+=4;
- timeValue.tv_sec = tvb_get_ntohl (tvb, offset);
- timeValue.tv_usec = 0;
+ timeValue.secs = tvb_get_ntohl (tvb, offset);
+ timeValue.nsecs = 0;
ti = proto_tree_add_time (wtls_msg_type_item_sub_tree,
hf_wtls_hands_certificate_wtls_valid_not_after,
tvb, offset, 4, &timeValue);
{ &hf_wtls_record,
{ "Record",
"wsp.wtls.record",
- FT_UINT8, BASE_NONE, VALS ( wtls_vals_record_type ), 0x0f,
- "Record"
+ FT_UINT8, BASE_DEC, VALS ( wtls_vals_record_type ), 0x0f,
+ "Record", HFILL
}
},
{ &hf_wtls_record_type,
{ "Record Type",
"wsp.wtls.rec_type",
- FT_UINT8, BASE_NONE, VALS ( wtls_vals_record_type ), 0x0f,
- "Record Type"
+ FT_UINT8, BASE_DEC, VALS ( wtls_vals_record_type ), 0x0f,
+ "Record Type", HFILL
}
},
{ &hf_wtls_record_length,
{ "Record Length",
"wsp.wtls.rec_length",
FT_UINT16, BASE_DEC, NULL, 0x00,
- "Record Length"
+ "Record Length", HFILL
}
},
{ &hf_wtls_record_sequence,
{ "Record Sequence",
"wsp.wtls.rec_seq",
FT_UINT16, BASE_DEC, NULL, 0x00,
- "Record Sequence"
+ "Record Sequence", HFILL
}
},
{ &hf_wtls_record_ciphered,
{ "Record Ciphered",
"wsp.wtls.rec_cipher",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Record Ciphered"
+ "Record Ciphered", HFILL
}
},
{ &hf_wtls_hands,
{ "Handshake",
"wsp.wtls.handshake",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
- "Handshake"
+ "Handshake", HFILL
}
},
{ &hf_wtls_hands_type,
{ "Type",
"wsp.wtls.handshake.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_handshake_type ), 0x00,
- "Type"
+ "Type", HFILL
}
},
{ &hf_wtls_hands_length,
{ "Length",
"wsp.wtls.handshake.length",
FT_UINT16, BASE_DEC, NULL, 0x00,
- "Length"
+ "Length", HFILL
}
},
{ &hf_wtls_hands_cli_hello,
{ "Client Hello",
"wsp.wtls.handshake.client_hello",
FT_NONE, BASE_NONE,NULL, 0x00,
- "Client Hello"
+ "Client Hello", HFILL
}
},
{ &hf_wtls_hands_cli_hello_version,
{ "Version",
"wsp.wtls.handshake.client_hello.version",
FT_UINT8, BASE_DEC, NULL, 0x00,
- "Version"
+ "Version", HFILL
}
},
{ &hf_wtls_hands_cli_hello_gmt,
{ "Time GMT",
"wsp.wtls.handshake.client_hello.gmt",
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
- "Time GMT"
+ "Time GMT", HFILL
}
},
{ &hf_wtls_hands_cli_hello_random,
{ "Random",
"wsp.wtls.handshake.client_hello.random",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Random"
+ "Random", HFILL
}
},
{ &hf_wtls_hands_cli_hello_session,
{ "Session ID",
"wsp.wtls.handshake.client_hello.sessionid",
- FT_NONE, BASE_DEC, NULL, 0x00,
- "Session ID"
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "Session ID", HFILL
+ }
+ },
+ { &hf_wtls_hands_cli_hello_session_str,
+ { "Session ID",
+ "wsp.wtls.handshake.client_hello.session.str",
+ FT_STRING, BASE_DEC, NULL, 0x00,
+ "Session ID", HFILL
}
},
{ &hf_wtls_hands_cli_hello_cli_key_id,
{ "Client Keys",
"wsp.wtls.handshake.client_hello.client_keys_id",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Client Keys"
+ "Client Keys" , HFILL
+ }
+ },
+ { &hf_wtls_hands_cli_hello_cli_key_len,
+ { "Length",
+ "wsp.wtls.handshake.client_hello.client_keys_len",
+ FT_UINT16, BASE_DEC, NULL, 0x00,
+ "Length" , HFILL
}
},
{ &hf_wtls_hands_cli_hello_trust_key_id,
{ "Trusted Keys",
"wsp.wtls.handshake.client_hello.trusted_keys_id",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Trusted Keys"
+ "Trusted Keys" , HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_exchange,
{ "Key Exchange",
"wsp.wtls.handshake.client_hello.key.key_exchange",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_key_exchange_suite ), 0x00,
- "Key Exchange"
+ "Key Exchange", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_exchange_suite,
{ "Suite",
"wsp.wtls.handshake.client_hello.key.key_exchange.suite",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_key_exchange_suite ), 0x00,
- "Suite"
+ "Suite", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_parameter_index,
{ "Parameter Index",
"wsp.wtls.handshake.client_hello.parameter_index",
FT_UINT8, BASE_DEC, NULL, 0x00,
- "Parameter Index"
+ "Parameter Index", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_parameter_set,
{ "Parameter Set",
"wsp.wtls.handshake.client_hello.parameter",
FT_STRING, BASE_NONE, NULL, 0x00,
- "Parameter Set"
+ "Parameter Set", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_identifier_type,
{ "Identifier Type",
"wsp.wtls.handshake.client_hello.ident_type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
- "Identifier Type"
+ "Identifier Type", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_identifier_charset,
{ "Identifier CharSet",
"wsp.wtls.handshake.client_hello.ident_charset",
- FT_NONE, BASE_DEC, NULL, 0x00,
- "Identifier CharSet"
+ FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
+ "Identifier CharSet", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_identifier_size,
{ "Identifier Size",
"wsp.wtls.handshake.client_hello.ident_size",
FT_UINT8, BASE_DEC, NULL, 0x00,
- "Identifier Size"
+ "Identifier Size", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_identifier,
{ "Identifier",
"wsp.wtls.handshake.client_hello.identifier",
- FT_UINT8, BASE_HEX, NULL, 0x00,
- "Identifier"
+ FT_NONE, BASE_HEX, NULL, 0x00,
+ "Identifier", HFILL
+ }
+ },
+ { &hf_wtls_hands_cli_hello_key_identifier_str,
+ { "Identifier Name",
+ "wsp.wtls.handshake.client_hello.ident_name",
+ FT_STRING, BASE_HEX, NULL, 0x00,
+ "Identifier Name", HFILL
}
},
{ &hf_wtls_hands_cli_hello_cipher_suite,
{ "Cipher Suites",
"wsp.wtls.handshake.client_hello.ciphers",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Cipher Suite"
+ "Cipher Suite", HFILL
}
},
{ &hf_wtls_hands_cli_hello_cipher_suite_item,
{ "Cipher",
"wsp.wtls.handshake.client_hello.cipher",
- FT_NONE, BASE_DEC, NULL, 0x00,
- "Cipher"
- }
- },
- { &hf_wtls_hands_cli_hello_cipher_bulk,
- { "Cipher Bulk",
- "wsp.wtls.handshake.client_hello.cipher.bulk",
- FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_bulk ), 0x00,
- "Cipher Bulk"
- }
- },
- { &hf_wtls_hands_cli_hello_cipher_mac,
- { "Cipher MAC",
- "wsp.wtls.handshake.client_hello.cipher.mac",
- FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_mac ), 0x00,
- "Cipher MAC"
+ FT_STRING, BASE_DEC, NULL, 0x00,
+ "Cipher", HFILL
}
},
{ &hf_wtls_hands_cli_hello_compression_methods,
{ "Compression Methods",
"wsp.wtls.handshake.client_hello.comp_methods",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Compression Methods"
+ "Compression Methods", HFILL
}
},
{ &hf_wtls_hands_cli_hello_compression,
{ "Compression",
"wsp.wtls.handshake.client_hello.compression",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_compression ), 0x00,
- "Compression"
+ "Compression", HFILL
}
},
{ &hf_wtls_hands_cli_hello_sequence_mode,
{ "Sequence Mode",
"wsp.wtls.handshake.client_hello.sequence_mode",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_sequence_mode ), 0x00,
- "Sequence Mode"
+ "Sequence Mode", HFILL
}
},
{ &hf_wtls_hands_cli_hello_key_refresh,
{ "Refresh",
"wsp.wtls.handshake.client_hello.refresh",
FT_UINT8, BASE_DEC,NULL, 0x00,
- "Refresh"
+ "Refresh", HFILL
}
},
{ &hf_wtls_hands_serv_hello,
{ "Server Hello",
"wsp.wtls.handshake.server_hello",
FT_NONE, BASE_NONE,NULL, 0x00,
- "Server Hello"
+ "Server Hello", HFILL
}
},
{ &hf_wtls_hands_serv_hello_version,
{ "Version",
"wsp.wtls.handshake.server_hello.version",
FT_UINT8, BASE_DEC, NULL, 0x00,
- "Version"
+ "Version", HFILL
}
},
{ &hf_wtls_hands_serv_hello_gmt,
{ "Time GMT",
"wsp.wtls.handshake.server_hello.gmt",
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
- "Time GMT"
+ "Time GMT", HFILL
}
},
{ &hf_wtls_hands_serv_hello_random,
{ "Random",
"wsp.wtls.handshake.server_hello.random",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Random"
+ "Random", HFILL
}
},
{ &hf_wtls_hands_serv_hello_session,
{ "Session ID",
"wsp.wtls.handshake.server_hello.sessionid",
- FT_NONE, BASE_DEC, NULL, 0x00,
- "Session ID"
+ FT_UINT32, BASE_DEC, NULL, 0x00,
+ "Session ID", HFILL
+ }
+ },
+ { &hf_wtls_hands_serv_hello_session_str,
+ { "Session ID",
+ "wsp.wtls.handshake.server_hello.session.str",
+ FT_STRING, BASE_DEC, NULL, 0x00,
+ "Session ID", HFILL
}
},
{ &hf_wtls_hands_serv_hello_cli_key_id,
{ "Client Key ID",
"wsp.wtls.handshake.server_hello.key",
FT_UINT8, BASE_HEX, NULL, 0x00,
- "Client Key ID"
+ "Client Key ID", HFILL
}
},
{ &hf_wtls_hands_serv_hello_cipher_suite_item,
{ "Cipher",
"wsp.wtls.handshake.server_hello.cipher",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Cipher"
+ "Cipher", HFILL
}
},
{ &hf_wtls_hands_serv_hello_cipher_bulk,
{ "Cipher Bulk",
"wsp.wtls.handshake.server_hello.cipher.bulk",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_bulk ), 0x00,
- "Cipher Bulk"
+ "Cipher Bulk", HFILL
}
},
{ &hf_wtls_hands_serv_hello_cipher_mac,
{ "Cipher MAC",
"wsp.wtls.handshake.server_hello.cipher.mac",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_cipher_mac ), 0x00,
- "Cipher MAC"
+ "Cipher MAC", HFILL
}
},
{ &hf_wtls_hands_serv_hello_compression,
{ "Compression",
"wsp.wtls.handshake.server_hello.compression",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_compression ), 0x00,
- "Compression"
+ "Compression", HFILL
}
},
{ &hf_wtls_hands_serv_hello_sequence_mode,
{ "Sequence Mode",
"wsp.wtls.handshake.server_hello.sequence_mode",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_sequence_mode ), 0x00,
- "Sequence Mode"
+ "Sequence Mode", HFILL
}
},
{ &hf_wtls_hands_serv_hello_key_refresh,
{ "Refresh",
"wsp.wtls.handshake.server_hello.refresh",
FT_UINT8, BASE_DEC,NULL, 0x00,
- "Refresh"
+ "Refresh", HFILL
}
},
{ &hf_wtls_hands_certificates,
{ "Certificates",
"wsp.wtls.handshake.certificates",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Certificates"
+ "Certificates", HFILL
}
},
{ &hf_wtls_hands_certificate,
{ "Certificate",
"wsp.wtls.handshake.certificate",
FT_NONE, BASE_DEC, NULL, 0x00,
- "Certificate"
+ "Certificate", HFILL
}
},
{ &hf_wtls_hands_certificate_type,
{ "Type",
"wsp.wtls.handshake.certificate.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_certificate_type ), 0x00,
- "Type"
+ "Type", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_version,
{ "Version",
"wsp.wtls.handshake.certificate.version",
FT_UINT8, BASE_HEX, NULL, 0x00,
- "Version"
+ "Version", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_signature_type,
{ "Signature Type",
"wsp.wtls.handshake.certificate.signature.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_certificate_signature ), 0x00,
- "Signature Type"
+ "Signature Type", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_signature,
{ "Signature Size",
"wsp.wtls.handshake.certificate.signature.signature",
FT_UINT32, BASE_DEC, NULL, 0x00,
- "Signature Size"
+ "Signature Size", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_issuer_type,
{ "Issuer",
"wsp.wtls.handshake.certificate.issuer.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
- "Issuer"
+ "Issuer", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_issuer_charset,
{ "Charset",
"wsp.wtls.handshake.certificate.issuer.charset",
FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
- "Charset"
+ "Charset", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_issuer_name,
{ "Name",
"wsp.wtls.handshake.certificate.issuer.name",
FT_STRING, BASE_NONE, NULL, 0x00,
- "Name"
+ "Name", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_valid_not_before,
{ "Valid not before",
"wsp.wtls.handshake.certificate.before",
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
- "Valid not before"
+ "Valid not before", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_valid_not_after,
{ "Valid not after",
"wsp.wtls.handshake.certificate.after",
FT_ABSOLUTE_TIME, BASE_NONE, NULL, 0x00,
- "Valid not after"
+ "Valid not after", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_subject_type,
{ "Subject",
"wsp.wtls.handshake.certificate.subject.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_identifier_type ), 0x00,
- "Subject"
+ "Subject", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_subject_charset,
{ "Charset",
"wsp.wtls.handshake.certificate.subject.charset",
FT_UINT16, BASE_HEX, VALS ( vals_character_sets ), 0x00,
- "Charset"
+ "Charset", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_subject_name,
{ "Name",
"wsp.wtls.handshake.certificate.subject.name",
FT_STRING, BASE_NONE, NULL, 0x00,
- "Name"
+ "Name", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_public_key_type,
{ "Public Key Type",
"wsp.wtls.handshake.certificate.public.type",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_public_key_type ), 0x00,
- "Public Key Type"
+ "Public Key Type", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_key_parameter_index,
{ "Parameter Index",
"wsp.wtls.handshake.certificate.parameter_index",
FT_UINT8, BASE_DEC, NULL, 0x00,
- "Parameter Index"
+ "Parameter Index", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_key_parameter_set,
{ "Parameter Set",
"wsp.wtls.handshake.certificate.parameter",
FT_STRING, BASE_NONE, NULL, 0x00,
- "Parameter Set"
+ "Parameter Set", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_rsa_exponent,
{ "RSA Exponent Size",
"wsp.wtls.handshake.certificate.rsa.exponent",
FT_UINT32, BASE_DEC, NULL, 0x00,
- "RSA Exponent Size"
+ "RSA Exponent Size", HFILL
}
},
{ &hf_wtls_hands_certificate_wtls_rsa_modules,
{ "RSA Modulus Size",
- "wsp.wtls.handshake.certificate.rsa.modulus",
+ "wsp.wtls.handshake.certificate.rsa.modules",
FT_UINT32, BASE_DEC, NULL, 0x00,
- "RSA Modulus Size"
+ "RSA Modulus Size", HFILL
}
},
{ &hf_wtls_alert,
{ "Alert",
"wsp.wtls.alert",
FT_NONE, BASE_HEX, NULL, 0x00,
- "Alert"
+ "Alert", HFILL
}
},
{ &hf_wtls_alert_level,
{ "Level",
"wsp.wtls.alert.level",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_alert_level ), 0x00,
- "Level"
+ "Level", HFILL
}
},
{ &hf_wtls_alert_description,
{ "Description",
"wsp.wtls.alert.description",
FT_UINT8, BASE_HEX, VALS ( wtls_vals_alert_description ), 0x00,
- "Description"
+ "Description", HFILL
}
},
};
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_wtls, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
-
- register_dissector("wtls", dissect_wtls, proto_wtls);
}
void
proto_reg_handoff_wtls(void)
{
+ dissector_handle_t wtls_handle;
+
/*
- * Get handles for the IP WTP and WSP dissectors
+ * Get handles for the WTP and connectionless WSP dissectors.
*/
wtp_handle = find_dissector("wtp");
- wsp_handle = find_dissector("wsp");
+ wsp_handle = find_dissector("wsp-cl");
- dissector_add("udp.port", UDP_PORT_WTLS_WSP, dissect_wtls, proto_wtls);
- dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, dissect_wtls, proto_wtls);
+ wtls_handle = create_dissector_handle(dissect_wtls, proto_wtls);
+ dissector_add("udp.port", UDP_PORT_WTLS_WSP, wtls_handle);
+ dissector_add("udp.port", UDP_PORT_WTLS_WTP_WSP, wtls_handle);
+ dissector_add("udp.port", UDP_PORT_WTLS_WSP_PUSH,wtls_handle);
}