aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorMartin Kaiser <wireshark@kaiser.cx>2016-02-06 13:57:56 +0100
committerAnders Broman <a.broman58@gmail.com>2016-02-08 06:01:05 +0000
commit40331511ed9c117703c3097f23e3a2f17b17e993 (patch)
tree8cf742e5d33f1c747f6476698396871c3d2d7bb6 /epan
parent0fbc8f80dae3fa7f47d121b25655ac86268681b8 (diff)
add functions to calculate the CRC of an ISO14443-A message
Change-Id: I1ccd9885746a6044f298d7d531a9bc009a70288e Reviewed-on: https://code.wireshark.org/review/13802 Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/crc16-tvb.c10
-rw-r--r--epan/crc16-tvb.h7
2 files changed, 17 insertions, 0 deletions
diff --git a/epan/crc16-tvb.c b/epan/crc16-tvb.c
index b20d759c50..bea77bdff2 100644
--- a/epan/crc16-tvb.c
+++ b/epan/crc16-tvb.c
@@ -98,6 +98,16 @@ guint16 crc16_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset, guint len, guin
return crc16_ccitt_seed(buf, len, seed);
}
+guint16 crc16_iso14443a_tvb_offset(tvbuff_t *tvb, guint offset, guint len)
+{
+ const guint8 *buf;
+
+ tvb_ensure_bytes_exist(tvb, offset, len); /* len == -1 not allowed */
+ buf = tvb_get_ptr(tvb, offset, len);
+
+ return crc16_iso14443a(buf, len);
+}
+
guint16 crc16_plain_tvb_offset(tvbuff_t *tvb, guint offset, guint len)
{
guint16 crc = crc16_plain_init();
diff --git a/epan/crc16-tvb.h b/epan/crc16-tvb.h
index c8a699f98a..1a18f1fba3 100644
--- a/epan/crc16-tvb.h
+++ b/epan/crc16-tvb.h
@@ -77,6 +77,13 @@ WS_DLL_PUBLIC guint16 crc16_ccitt_tvb_seed(tvbuff_t *tvb, guint len, guint16 see
WS_DLL_PUBLIC guint16 crc16_ccitt_tvb_offset_seed(tvbuff_t *tvb, guint offset,
guint len, guint16 seed);
+/** Compute the 16bit CRC_A value of a tv buffer as defined in ISO14443-3.
+ @param tvb The tv buffer containing the data.
+ @param offset The offset into the tv buffer.
+ @param len The number of bytes to include in the computation.
+ @return The calculated CRC_A. */
+WS_DLL_PUBLIC guint16 crc16_iso14443a_tvb_offset(tvbuff_t *tvb, guint offset, guint len);
+
/** Compute the "plain" CRC16 checksum of a tv buffer using the following
* parameters:
* Width = 16