From 4d9eb4caab3be28864dc2b257e5d6f5ffe6c48dc Mon Sep 17 00:00:00 2001 From: Michal Labedzki Date: Wed, 26 Oct 2016 14:56:30 +0200 Subject: Bluetooth: SMP: Dissect remaining AuthReq bits Dissect SC, Keypress and Reserved bits. Up to Bluetooth Core 4 specification. Change-Id: Id7ac75bd917786abe9aada433a1343887a32234d Reviewed-on: https://code.wireshark.org/review/19079 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte Reviewed-by: Michael Mann --- epan/dissectors/packet-btsmp.c | 55 +++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 12 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-btsmp.c b/epan/dissectors/packet-btsmp.c index 441788c0dc..d17b87982b 100644 --- a/epan/dissectors/packet-btsmp.c +++ b/epan/dissectors/packet-btsmp.c @@ -46,7 +46,9 @@ static int hf_btsmp_id_resolving_key = -1; static int hf_btsmp_signature_key = -1; static int hf_btsmp_bonding_flags = -1; static int hf_btsmp_mitm_flag = -1; -static int hf_btsmp_sc_flag = -1; +static int hf_btsmp_secure_connection_flag = -1; +static int hf_btsmp_keypress_flag = -1; +static int hf_btsmp_reserved_flag = -1; static int hf_btsmp_max_enc_key_size = -1; static int hf_btsmp_key_dist_enc = -1; static int hf_btsmp_key_dist_id = -1; @@ -149,19 +151,38 @@ dissect_btsmp_auth_req(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree proto_item *ti_param; proto_tree *st_param; guint8 param; + const guint8 *ph; param = tvb_get_guint8(tvb, offset); + ti_param = proto_tree_add_item(tree, hf_btsmp_authreq, tvb, offset, 1, ENC_NA); st_param = proto_item_add_subtree(ti_param, ett_btsmp_auth_req); + proto_tree_add_item(st_param, hf_btsmp_bonding_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti_param, "%s, ", val_to_str_const(param & 0x03, bonding_flag_vals, "")); - proto_tree_add_item(st_param, hf_btsmp_mitm_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti_param, "%s, ", (param & 0x04) ? "MITM" : "No MITM"); - proto_tree_add_item(st_param, hf_btsmp_sc_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); - proto_item_append_text(ti_param, "%s", (param & 0x08) ? "SC" : "No SC"); + ph = val_to_str_const(param & 0x03, bonding_flag_vals, ""); + proto_item_append_text(ti_param, ": %s, ", ph); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, ", ph); - col_append_fstr(pinfo->cinfo, COL_INFO, "%s, %s, %s", val_to_str_const(param & 0x03, bonding_flag_vals, ""), - (param & 0x04) ? "MITM" : "No MITM", (param & 0x08) ? "SC" : "No SC"); + proto_tree_add_item(st_param, hf_btsmp_mitm_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); + ph = (param & 0x04) ? "MITM" : "No MITM"; + proto_item_append_text(ti_param, "%s, ", ph); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, ", ph); + + proto_tree_add_item(st_param, hf_btsmp_secure_connection_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); + ph = (param & 0x08) ? "SecureConnection" : "No SC"; + proto_item_append_text(ti_param, "%s, ", ph); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s, ", ph); + + proto_tree_add_item(st_param, hf_btsmp_keypress_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); + ph = (param & 0x10) ? "Keypress" : "No Keypress"; + proto_item_append_text(ti_param, "%s", ph); + col_append_fstr(pinfo->cinfo, COL_INFO, "%s", ph); + + proto_tree_add_item(st_param, hf_btsmp_reserved_flag, tvb, offset, 1, ENC_LITTLE_ENDIAN); + if (param & 0xE0) { + proto_item_append_text(ti_param, ", Reserved"); + col_append_fstr(pinfo->cinfo, COL_INFO, ", Reserved"); + } return offset + 1; } @@ -406,12 +427,22 @@ proto_register_btsmp(void) }, {&hf_btsmp_mitm_flag, {"MITM Flag", "btsmp.mitm_flag", - FT_UINT8, BASE_DEC, NULL, 0x04, + FT_BOOLEAN, 8, NULL, 0x04, + NULL, HFILL} + }, + {&hf_btsmp_secure_connection_flag, + {"Secure Connection Flag", "btsmp.sc_flag", + FT_BOOLEAN, 8, NULL, 0x08, + NULL, HFILL} + }, + {&hf_btsmp_keypress_flag, + {"Keypress Flag", "btsmp.keypress_flag", + FT_BOOLEAN, 8, NULL, 0x10, NULL, HFILL} }, - {&hf_btsmp_sc_flag, - {"SC Flag", "btsmp.sc_flag", - FT_UINT8, BASE_DEC, NULL, 0x08, + {&hf_btsmp_reserved_flag, + {"Reserved", "btsmp.reserved_flags", + FT_UINT8, BASE_HEX, NULL, 0xE0, NULL, HFILL} }, {&hf_btsmp_max_enc_key_size, -- cgit v1.2.3