aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Mathieson <martin.r.mathieson@googlemail.com>2018-03-03 22:31:13 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2018-03-04 00:20:56 +0000
commit7b7e53e6bd7e7610b71ba3a5f9ddc87f5c583004 (patch)
tree0161d618c1e57c92bb9b512fe6d5c19368cf5ddd
parenteccbc4bade52bdd557a5c416693536ca08a293b5 (diff)
PDCP: show wrong calculated digest on MAC item, and add some comments about calculation
Change-Id: I97445f87abd59761fb14b05dad2df98d2b127f7a Reviewed-on: https://code.wireshark.org/review/26250 Petri-Dish: Martin Mathieson <martin.r.mathieson@googlemail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
-rw-r--r--epan/dissectors/packet-pdcp-lte.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c
index 0c06665645..2a22ea3299 100644
--- a/epan/dissectors/packet-pdcp-lte.c
+++ b/epan/dissectors/packet-pdcp-lte.c
@@ -1656,7 +1656,9 @@ static guint32 calculate_digest(pdu_security_settings_t *pdu_security_settings,
guint8 *mac;
gint message_length = tvb_captured_length_remaining(tvb, offset) - 4;
guint8 *message_data = (guint8 *)wmem_alloc0(wmem_packet_scope(), message_length+5);
+ /* Data is header byte */
message_data[0] = header;
+ /* Followed by the decrypted message (but not the digest bytes) */
tvb_memcpy(tvb, message_data+1, offset, message_length);
mac = (u8*)snow3g_f9(pdu_security_settings->integrityKey,
@@ -1704,7 +1706,9 @@ static guint32 calculate_digest(pdu_security_settings_t *pdu_security_settings,
message_data[3] = (pdu_security_settings->count & 0x000000ff);
message_data[4] = (pdu_security_settings->bearer << 3) + (pdu_security_settings->direction << 2);
/* rest of first 8 bytes are left as zeroes... */
+ /* Now the header byte */
message_data[8] = header;
+ /* Followed by the decrypted message (but not the digest bytes) */
tvb_memcpy(tvb, message_data+9, offset, message_length);
/* Pass in the message */
@@ -2391,8 +2395,9 @@ static int dissect_pdcp_lte(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Compare what was found with calculated value! */
if (mac != calculated_digest) {
expert_add_info_format(pinfo, mac_ti, &ei_pdcp_lte_digest_wrong,
- "MAC-I Digest wrong expected %08x but found %08x",
+ "MAC-I Digest wrong - calculated %08x but found %08x",
calculated_digest, mac);
+ proto_item_append_text(mac_ti, " (but calculated %08x !)", calculated_digest);
}
else {
proto_item_append_text(mac_ti, " [Matches calculated result]");