diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2019-06-20 19:42:18 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2019-06-20 20:02:22 +0000 |
commit | 0c45cefab20006d4092a13286b31e39bdff31546 (patch) | |
tree | 9991e6cc52585383619ae2c0d00bd83fa0f3c433 /epan | |
parent | 40b538f48a593b53de3db00bebd5b7badffb1b1f (diff) |
iso14443: add unverified crc to the proto tree
If an iso14443 message contains crc bytes but we do not know the
card type, we cannot verify if the crc is correct or not.
Add the crc bytes to the proto tree in this case and mark them
as unverified.
Change-Id: I2d95f2e4e5edc20095df58930b3176376a8786aa
Reviewed-on: https://code.wireshark.org/review/33686
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Petri-Dish: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-iso14443.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/epan/dissectors/packet-iso14443.c b/epan/dissectors/packet-iso14443.c index f6889e32b3..ef1312c2c4 100644 --- a/epan/dissectors/packet-iso14443.c +++ b/epan/dissectors/packet-iso14443.c @@ -91,6 +91,7 @@ typedef struct _iso14443_transaction_t { typedef enum _iso14443_type_t { ISO14443_A, ISO14443_B, + ISO14443_UNKNOWN } iso14443_type_t; static const value_string iso14443_short_frame[] = { @@ -1111,21 +1112,29 @@ dissect_iso14443_cmd_type_block(tvbuff_t *tvb, packet_info *pinfo, } if (!crc_dropped) { - iso14443_type_t t; + iso14443_type_t t = ISO14443_UNKNOWN; conversation_t *conv; + guint32 computed_checksum = 0; + guint flags = PROTO_CHECKSUM_NO_FLAGS; conv = find_conversation_by_id(pinfo->num, ENDPOINT_ISO14443, ISO14443_CIRCUIT_ID, 0); - if (conv) { + if (conv) t = (iso14443_type_t)GPOINTER_TO_UINT(conversation_get_proto_data(conv, proto_iso14443)); - proto_tree_add_checksum(tree, tvb, offset, - hf_iso14443_crc, hf_iso14443_crc_status, &ei_iso14443_wrong_crc, pinfo, - (t == ISO14443_A) ? - crc16_iso14443a_tvb_offset(tvb, 0, offset) : - crc16_ccitt_tvb_offset(tvb, 0, offset), - ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); - offset += CRC_LEN; + if (t == ISO14443_A) { + computed_checksum = crc16_iso14443a_tvb_offset(tvb, 0, offset); + flags |= PROTO_CHECKSUM_VERIFY; + } + else if (t == ISO14443_B) { + computed_checksum = crc16_ccitt_tvb_offset(tvb, 0, offset); + flags |= PROTO_CHECKSUM_VERIFY; } + + proto_tree_add_checksum(tree, tvb, offset, + hf_iso14443_crc, hf_iso14443_crc_status, + &ei_iso14443_wrong_crc, pinfo, computed_checksum, + ENC_LITTLE_ENDIAN, flags); + offset += CRC_LEN; } return offset; |