summaryrefslogtreecommitdiff
path: root/wsutil
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-03-13 15:20:49 -0400
committerAnders Broman <a.broman58@gmail.com>2017-03-16 05:51:04 +0000
commit618ca466aae3637d641a6e3101b62f1e552a7ee1 (patch)
treea44c0e785a74b93af75e9a5763c40d5701d60cbe /wsutil
parent05b61a21a209f43de2926b808ed3bc151aa1991e (diff)
downloadwireshark-618ca466aae3637d641a6e3101b62f1e552a7ee1.tar.gz
Add support for verifying CIP Safety CRC values.
Change-Id: I44f7ff6980f27b1a0d4199a91f9b217aec7e4652 Reviewed-on: https://code.wireshark.org/review/20557 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/crc16.c53
-rw-r--r--wsutil/crc16.h9
-rw-r--r--wsutil/crc32.c86
-rw-r--r--wsutil/crc32.h9
-rw-r--r--wsutil/crc8.c106
-rw-r--r--wsutil/crc8.h18
6 files changed, 281 insertions, 0 deletions
diff --git a/wsutil/crc16.c b/wsutil/crc16.c
index 2ff576c200..3fc09f52ea 100644
--- a/wsutil/crc16.c
+++ b/wsutil/crc16.c
@@ -293,6 +293,43 @@ static const guint crc16_precompiled_3D65_reverse[] =
0x91AF, 0xA7F1, 0xFD13, 0xCB4D, 0x48D7, 0x7E89, 0x246B, 0x1235
};
+/* This table was compiled using the polynom: 0x080F */
+static const guint crc16_precompiled_080F[] =
+{
+ 0x0000, 0x080F, 0x101E, 0x1811, 0x203C, 0x2833, 0x3022, 0x382D,
+ 0x4078, 0x4877, 0x5066, 0x5869, 0x6044, 0x684B, 0x705A, 0x7855,
+ 0x80F0, 0x88FF, 0x90EE, 0x98E1, 0xA0CC, 0xA8C3, 0xB0D2, 0xB8DD,
+ 0xC088, 0xC887, 0xD096, 0xD899, 0xE0B4, 0xE8BB, 0xF0AA, 0xF8A5,
+ 0x09EF, 0x01E0, 0x19F1, 0x11FE, 0x29D3, 0x21DC, 0x39CD, 0x31C2,
+ 0x4997, 0x4198, 0x5989, 0x5186, 0x69AB, 0x61A4, 0x79B5, 0x71BA,
+ 0x891F, 0x8110, 0x9901, 0x910E, 0xA923, 0xA12C, 0xB93D, 0xB132,
+ 0xC967, 0xC168, 0xD979, 0xD176, 0xE95B, 0xE154, 0xF945, 0xF14A,
+ 0x13DE, 0x1BD1, 0x03C0, 0x0BCF, 0x33E2, 0x3BED, 0x23FC, 0x2BF3,
+ 0x53A6, 0x5BA9, 0x43B8, 0x4BB7, 0x739A, 0x7B95, 0x6384, 0x6B8B,
+ 0x932E, 0x9B21, 0x8330, 0x8B3F, 0xB312, 0xBB1D, 0xA30C, 0xAB03,
+ 0xD356, 0xDB59, 0xC348, 0xCB47, 0xF36A, 0xFB65, 0xE374, 0xEB7B,
+ 0x1A31, 0x123E, 0x0A2F, 0x0220, 0x3A0D, 0x3202, 0x2A13, 0x221C,
+ 0x5A49, 0x5246, 0x4A57, 0x4258, 0x7A75, 0x727A, 0x6A6B, 0x6264,
+ 0x9AC1, 0x92CE, 0x8ADF, 0x82D0, 0xBAFD, 0xB2F2, 0xAAE3, 0xA2EC,
+ 0xDAB9, 0xD2B6, 0xCAA7, 0xC2A8, 0xFA85, 0xF28A, 0xEA9B, 0xE294,
+ 0x27BC, 0x2FB3, 0x37A2, 0x3FAD, 0x0780, 0x0F8F, 0x179E, 0x1F91,
+ 0x67C4, 0x6FCB, 0x77DA, 0x7FD5, 0x47F8, 0x4FF7, 0x57E6, 0x5FE9,
+ 0xA74C, 0xAF43, 0xB752, 0xBF5D, 0x8770, 0x8F7F, 0x976E, 0x9F61,
+ 0xE734, 0xEF3B, 0xF72A, 0xFF25, 0xC708, 0xCF07, 0xD716, 0xDF19,
+ 0x2E53, 0x265C, 0x3E4D, 0x3642, 0x0E6F, 0x0660, 0x1E71, 0x167E,
+ 0x6E2B, 0x6624, 0x7E35, 0x763A, 0x4E17, 0x4618, 0x5E09, 0x5606,
+ 0xAEA3, 0xA6AC, 0xBEBD, 0xB6B2, 0x8E9F, 0x8690, 0x9E81, 0x968E,
+ 0xEEDB, 0xE6D4, 0xFEC5, 0xF6CA, 0xCEE7, 0xC6E8, 0xDEF9, 0xD6F6,
+ 0x3462, 0x3C6D, 0x247C, 0x2C73, 0x145E, 0x1C51, 0x0440, 0x0C4F,
+ 0x741A, 0x7C15, 0x6404, 0x6C0B, 0x5426, 0x5C29, 0x4438, 0x4C37,
+ 0xB492, 0xBC9D, 0xA48C, 0xAC83, 0x94AE, 0x9CA1, 0x84B0, 0x8CBF,
+ 0xF4EA, 0xFCE5, 0xE4F4, 0xECFB, 0xD4D6, 0xDCD9, 0xC4C8, 0xCCC7,
+ 0x3D8D, 0x3582, 0x2D93, 0x259C, 0x1DB1, 0x15BE, 0x0DAF, 0x05A0,
+ 0x7DF5, 0x75FA, 0x6DEB, 0x65E4, 0x5DC9, 0x55C6, 0x4DD7, 0x45D8,
+ 0xBD7D, 0xB572, 0xAD63, 0xA56C, 0x9D41, 0x954E, 0x8D5F, 0x8550,
+ 0xFD05, 0xF50A, 0xED1B, 0xE514, 0xDD39, 0xD536, 0xCD27, 0xC528
+};
+
static const guint16 crc16_ccitt_start = 0xFFFF;
static const guint16 crc16_ccitt_xorout = 0xFFFF;
@@ -374,6 +411,22 @@ guint16 crc16_0x3D65_seed(const guint8 *buf, guint len, guint16 seed)
return crc16_reflected(buf, len, seed, crc16_precompiled_3D65_reverse);
}
+guint16 crc16_0x080F_seed(const guint8 *buf, guint len, guint16 seed)
+{
+ guint16 crc = seed;
+
+ if (len > 0)
+ {
+ while (len-- > 0)
+ {
+ guint8 data = *buf++;
+ crc = crc16_precompiled_080F[((crc >> 8) ^ data)] ^ (crc << 8);
+ }
+ }
+
+ return crc;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/wsutil/crc16.h b/wsutil/crc16.h
index 11616089cc..b80c012d83 100644
--- a/wsutil/crc16.h
+++ b/wsutil/crc16.h
@@ -103,6 +103,15 @@ WS_DLL_PUBLIC guint16 crc16_0x9949_seed(const guint8 *buf, guint len, guint16 se
*/
WS_DLL_PUBLIC guint16 crc16_0x3D65_seed(const guint8 *buf, guint len, guint16 seed);
+/** Computes CRC16 checksum for the given data with the polynom 0x080F using
+ * precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC16 checksum for the buffer
+ */
+WS_DLL_PUBLIC guint16 crc16_0x080F_seed(const guint8 *buf, guint len, guint16 seed);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/wsutil/crc32.c b/wsutil/crc32.c
index 142a457f44..1ce43eb9c1 100644
--- a/wsutil/crc32.c
+++ b/wsutil/crc32.c
@@ -296,6 +296,75 @@ static const guint32 crc32_0AA725CF_reverse[] = {
0x53E8BE29U, 0x9D422BE7U, 0x29F45F14U, 0xE75ECADAU
};
+/* This table was compiled using the polynom: 0x5D6DCB */
+static const guint32 crc32_5D6DCB[] =
+{
+ 0x00000000, 0x005d6dcb, 0x00badb96, 0x00e7b65d,
+ 0x0028dae7, 0x0075b72c, 0x00920171, 0x00cf6cba,
+ 0x0051b5ce, 0x000cd805, 0x00eb6e58, 0x00b60393,
+ 0x00796f29, 0x002402e2, 0x00c3b4bf, 0x009ed974,
+ 0x00a36b9c, 0x00fe0657, 0x0019b00a, 0x0044ddc1,
+ 0x008bb17b, 0x00d6dcb0, 0x00316aed, 0x006c0726,
+ 0x00f2de52, 0x00afb399, 0x004805c4, 0x0015680f,
+ 0x00da04b5, 0x0087697e, 0x0060df23, 0x003db2e8,
+ 0x001bbaf3, 0x0046d738, 0x00a16165, 0x00fc0cae,
+ 0x00336014, 0x006e0ddf, 0x0089bb82, 0x00d4d649,
+ 0x004a0f3d, 0x001762f6, 0x00f0d4ab, 0x00adb960,
+ 0x0062d5da, 0x003fb811, 0x00d80e4c, 0x00856387,
+ 0x00b8d16f, 0x00e5bca4, 0x00020af9, 0x005f6732,
+ 0x00900b88, 0x00cd6643, 0x002ad01e, 0x0077bdd5,
+ 0x00e964a1, 0x00b4096a, 0x0053bf37, 0x000ed2fc,
+ 0x00c1be46, 0x009cd38d, 0x007b65d0, 0x0026081b,
+ 0x003775e6, 0x006a182d, 0x008dae70, 0x00d0c3bb,
+ 0x001faf01, 0x0042c2ca, 0x00a57497, 0x00f8195c,
+ 0x0066c028, 0x003bade3, 0x00dc1bbe, 0x00817675,
+ 0x004e1acf, 0x00137704, 0x00f4c159, 0x00a9ac92,
+ 0x00941e7a, 0x00c973b1, 0x002ec5ec, 0x0073a827,
+ 0x00bcc49d, 0x00e1a956, 0x00061f0b, 0x005b72c0,
+ 0x00c5abb4, 0x0098c67f, 0x007f7022, 0x00221de9,
+ 0x00ed7153, 0x00b01c98, 0x0057aac5, 0x000ac70e,
+ 0x002ccf15, 0x0071a2de, 0x00961483, 0x00cb7948,
+ 0x000415f2, 0x00597839, 0x00bece64, 0x00e3a3af,
+ 0x007d7adb, 0x00201710, 0x00c7a14d, 0x009acc86,
+ 0x0055a03c, 0x0008cdf7, 0x00ef7baa, 0x00b21661,
+ 0x008fa489, 0x00d2c942, 0x00357f1f, 0x006812d4,
+ 0x00a77e6e, 0x00fa13a5, 0x001da5f8, 0x0040c833,
+ 0x00de1147, 0x00837c8c, 0x0064cad1, 0x0039a71a,
+ 0x00f6cba0, 0x00aba66b, 0x004c1036, 0x00117dfd,
+ 0x006eebcc, 0x00338607, 0x00d4305a, 0x00895d91,
+ 0x0046312b, 0x001b5ce0, 0x00fceabd, 0x00a18776,
+ 0x003f5e02, 0x006233c9, 0x00858594, 0x00d8e85f,
+ 0x001784e5, 0x004ae92e, 0x00ad5f73, 0x00f032b8,
+ 0x00cd8050, 0x0090ed9b, 0x00775bc6, 0x002a360d,
+ 0x00e55ab7, 0x00b8377c, 0x005f8121, 0x0002ecea,
+ 0x009c359e, 0x00c15855, 0x0026ee08, 0x007b83c3,
+ 0x00b4ef79, 0x00e982b2, 0x000e34ef, 0x00535924,
+ 0x0075513f, 0x00283cf4, 0x00cf8aa9, 0x0092e762,
+ 0x005d8bd8, 0x0000e613, 0x00e7504e, 0x00ba3d85,
+ 0x0024e4f1, 0x0079893a, 0x009e3f67, 0x00c352ac,
+ 0x000c3e16, 0x005153dd, 0x00b6e580, 0x00eb884b,
+ 0x00d63aa3, 0x008b5768, 0x006ce135, 0x00318cfe,
+ 0x00fee044, 0x00a38d8f, 0x00443bd2, 0x00195619,
+ 0x00878f6d, 0x00dae2a6, 0x003d54fb, 0x00603930,
+ 0x00af558a, 0x00f23841, 0x00158e1c, 0x0048e3d7,
+ 0x00599e2a, 0x0004f3e1, 0x00e345bc, 0x00be2877,
+ 0x007144cd, 0x002c2906, 0x00cb9f5b, 0x0096f290,
+ 0x00082be4, 0x0055462f, 0x00b2f072, 0x00ef9db9,
+ 0x0020f103, 0x007d9cc8, 0x009a2a95, 0x00c7475e,
+ 0x00faf5b6, 0x00a7987d, 0x00402e20, 0x001d43eb,
+ 0x00d22f51, 0x008f429a, 0x0068f4c7, 0x0035990c,
+ 0x00ab4078, 0x00f62db3, 0x00119bee, 0x004cf625,
+ 0x00839a9f, 0x00def754, 0x00394109, 0x00642cc2,
+ 0x004224d9, 0x001f4912, 0x00f8ff4f, 0x00a59284,
+ 0x006afe3e, 0x003793f5, 0x00d025a8, 0x008d4863,
+ 0x00139117, 0x004efcdc, 0x00a94a81, 0x00f4274a,
+ 0x003b4bf0, 0x0066263b, 0x00819066, 0x00dcfdad,
+ 0x00e14f45, 0x00bc228e, 0x005b94d3, 0x0006f918,
+ 0x00c995a2, 0x0094f869, 0x00734e34, 0x002e23ff,
+ 0x00b0fa8b, 0x00ed9740, 0x000a211d, 0x00574cd6,
+ 0x0098206c, 0x00c54da7, 0x0022fbfa, 0x007f9631
+};
+
guint32
crc32c_table_lookup (guchar pos)
{
@@ -374,6 +443,23 @@ crc32_0x0AA725CF_seed(const guint8 *buf, guint len, guint32 seed)
return (guint32)crc32;
}
+guint32
+crc32_0x5D6DCB_seed(const guint8 *buf, guint len, guint32 seed)
+{
+ guint32 crc = seed;
+ if (len > 0)
+ {
+ while (len-- > 0)
+ {
+ guint8 data = *buf++;
+ /* XOR data with CRC2, look up result, then XOR that with CRC; */
+ crc = crc32_5D6DCB[((crc >> 16) ^ data) & 0xff] ^ (crc << 8);
+ }
+ }
+ return (crc & 0x00ffffff);
+}
+
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/wsutil/crc32.h b/wsutil/crc32.h
index 39cf17798a..02a990206c 100644
--- a/wsutil/crc32.h
+++ b/wsutil/crc32.h
@@ -96,6 +96,15 @@ WS_DLL_PUBLIC guint32 crc32_mpeg2_seed(const guint8 *buf, guint len, guint32 see
*/
WS_DLL_PUBLIC guint32 crc32_0x0AA725CF_seed(const guint8 *buf, guint len, guint32 seed);
+/** Computes CRC32 checksum for the given data with the polynom 0x5D6DCB using
+ * precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC32 checksum for the buffer
+ */
+WS_DLL_PUBLIC guint32 crc32_0x5D6DCB_seed(const guint8 *buf, guint len, guint32 seed);
+
WS_DLL_PUBLIC int AirPDcapWepDecrypt(
const guchar *seed,
const size_t seed_len,
diff --git a/wsutil/crc8.c b/wsutil/crc8.c
index 1fbf045c70..d667f57e90 100644
--- a/wsutil/crc8.c
+++ b/wsutil/crc8.c
@@ -65,7 +65,79 @@ static const guint8 crc8_precompiled_2F[256] =
0x8F, 0xA0, 0xD1, 0xFE, 0x33, 0x1C, 0x6D, 0x42
};
+/* @brief Precompiled table for CRC8 values for the polynom 0x37 */
+static const unsigned char crc8_precompiled_37[256] =
+{
+ 0x00, 0x37, 0x6e, 0x59, 0xdc, 0xeb, 0xb2, 0x85,
+ 0x8f, 0xb8, 0xe1, 0xd6, 0x53, 0x64, 0x3d, 0x0a,
+ 0x29, 0x1e, 0x47, 0x70, 0xf5, 0xc2, 0x9b, 0xac,
+ 0xa6, 0x91, 0xc8, 0xff, 0x7a, 0x4d, 0x14, 0x23,
+ 0x52, 0x65, 0x3c, 0x0b, 0x8e, 0xb9, 0xe0, 0xd7,
+ 0xdd, 0xea, 0xb3, 0x84, 0x01, 0x36, 0x6f, 0x58,
+ 0x7b, 0x4c, 0x15, 0x22, 0xa7, 0x90, 0xc9, 0xfe,
+ 0xf4, 0xc3, 0x9a, 0xad, 0x28, 0x1f, 0x46, 0x71,
+ 0xa4, 0x93, 0xca, 0xfd, 0x78, 0x4f, 0x16, 0x21,
+ 0x2b, 0x1c, 0x45, 0x72, 0xf7, 0xc0, 0x99, 0xae,
+ 0x8d, 0xba, 0xe3, 0xd4, 0x51, 0x66, 0x3f, 0x08,
+ 0x02, 0x35, 0x6c, 0x5b, 0xde, 0xe9, 0xb0, 0x87,
+ 0xf6, 0xc1, 0x98, 0xaf, 0x2a, 0x1d, 0x44, 0x73,
+ 0x79, 0x4e, 0x17, 0x20, 0xa5, 0x92, 0xcb, 0xfc,
+ 0xdf, 0xe8, 0xb1, 0x86, 0x03, 0x34, 0x6d, 0x5a,
+ 0x50, 0x67, 0x3e, 0x09, 0x8c, 0xbb, 0xe2, 0xd5,
+ 0x7f, 0x48, 0x11, 0x26, 0xa3, 0x94, 0xcd, 0xfa,
+ 0xf0, 0xc7, 0x9e, 0xa9, 0x2c, 0x1b, 0x42, 0x75,
+ 0x56, 0x61, 0x38, 0x0f, 0x8a, 0xbd, 0xe4, 0xd3,
+ 0xd9, 0xee, 0xb7, 0x80, 0x05, 0x32, 0x6b, 0x5c,
+ 0x2d, 0x1a, 0x43, 0x74, 0xf1, 0xc6, 0x9f, 0xa8,
+ 0xa2, 0x95, 0xcc, 0xfb, 0x7e, 0x49, 0x10, 0x27,
+ 0x04, 0x33, 0x6a, 0x5d, 0xd8, 0xef, 0xb6, 0x81,
+ 0x8b, 0xbc, 0xe5, 0xd2, 0x57, 0x60, 0x39, 0x0e,
+ 0xdb, 0xec, 0xb5, 0x82, 0x07, 0x30, 0x69, 0x5e,
+ 0x54, 0x63, 0x3a, 0x0d, 0x88, 0xbf, 0xe6, 0xd1,
+ 0xf2, 0xc5, 0x9c, 0xab, 0x2e, 0x19, 0x40, 0x77,
+ 0x7d, 0x4a, 0x13, 0x24, 0xa1, 0x96, 0xcf, 0xf8,
+ 0x89, 0xbe, 0xe7, 0xd0, 0x55, 0x62, 0x3b, 0x0c,
+ 0x06, 0x31, 0x68, 0x5f, 0xda, 0xed, 0xb4, 0x83,
+ 0xa0, 0x97, 0xce, 0xf9, 0x7c, 0x4b, 0x12, 0x25,
+ 0x2f, 0x18, 0x41, 0x76, 0xf3, 0xc4, 0x9d, 0xaa,
+};
+/* @brief Precompiled table for CRC8 values for the polynom 0x3B */
+static const unsigned char crc8_precompiled_3b[256] =
+{
+ 0x00, 0x3b, 0x76, 0x4d, 0xec, 0xd7, 0x9a, 0xa1,
+ 0xe3, 0xd8, 0x95, 0xae, 0x0f, 0x34, 0x79, 0x42,
+ 0xfd, 0xc6, 0x8b, 0xb0, 0x11, 0x2a, 0x67, 0x5c,
+ 0x1e, 0x25, 0x68, 0x53, 0xf2, 0xc9, 0x84, 0xbf,
+ 0xc1, 0xfa, 0xb7, 0x8c, 0x2d, 0x16, 0x5b, 0x60,
+ 0x22, 0x19, 0x54, 0x6f, 0xce, 0xf5, 0xb8, 0x83,
+ 0x3c, 0x07, 0x4a, 0x71, 0xd0, 0xeb, 0xa6, 0x9d,
+ 0xdf, 0xe4, 0xa9, 0x92, 0x33, 0x08, 0x45, 0x7e,
+ 0xb9, 0x82, 0xcf, 0xf4, 0x55, 0x6e, 0x23, 0x18,
+ 0x5a, 0x61, 0x2c, 0x17, 0xb6, 0x8d, 0xc0, 0xfb,
+ 0x44, 0x7f, 0x32, 0x09, 0xa8, 0x93, 0xde, 0xe5,
+ 0xa7, 0x9c, 0xd1, 0xea, 0x4b, 0x70, 0x3d, 0x06,
+ 0x78, 0x43, 0x0e, 0x35, 0x94, 0xaf, 0xe2, 0xd9,
+ 0x9b, 0xa0, 0xed, 0xd6, 0x77, 0x4c, 0x01, 0x3a,
+ 0x85, 0xbe, 0xf3, 0xc8, 0x69, 0x52, 0x1f, 0x24,
+ 0x66, 0x5d, 0x10, 0x2b, 0x8a, 0xb1, 0xfc, 0xc7,
+ 0x49, 0x72, 0x3f, 0x04, 0xa5, 0x9e, 0xd3, 0xe8,
+ 0xaa, 0x91, 0xdc, 0xe7, 0x46, 0x7d, 0x30, 0x0b,
+ 0xb4, 0x8f, 0xc2, 0xf9, 0x58, 0x63, 0x2e, 0x15,
+ 0x57, 0x6c, 0x21, 0x1a, 0xbb, 0x80, 0xcd, 0xf6,
+ 0x88, 0xb3, 0xfe, 0xc5, 0x64, 0x5f, 0x12, 0x29,
+ 0x6b, 0x50, 0x1d, 0x26, 0x87, 0xbc, 0xf1, 0xca,
+ 0x75, 0x4e, 0x03, 0x38, 0x99, 0xa2, 0xef, 0xd4,
+ 0x96, 0xad, 0xe0, 0xdb, 0x7a, 0x41, 0x0c, 0x37,
+ 0xf0, 0xcb, 0x86, 0xbd, 0x1c, 0x27, 0x6a, 0x51,
+ 0x13, 0x28, 0x65, 0x5e, 0xff, 0xc4, 0x89, 0xb2,
+ 0x0d, 0x36, 0x7b, 0x40, 0xe1, 0xda, 0x97, 0xac,
+ 0xee, 0xd5, 0x98, 0xa3, 0x02, 0x39, 0x74, 0x4f,
+ 0x31, 0x0a, 0x47, 0x7c, 0xdd, 0xe6, 0xab, 0x90,
+ 0xd2, 0xe9, 0xa4, 0x9f, 0x3e, 0x05, 0x48, 0x73,
+ 0xcc, 0xf7, 0xba, 0x81, 0x20, 0x1b, 0x56, 0x6d,
+ 0x2f, 0x14, 0x59, 0x62, 0xc3, 0xf8, 0xb5, 0x8e,
+};
/** Calculates a CRC8 checksum for the given buffer with the polynom
* stored in the crc_table
* @param buf a pointer to a buffer of the given length
@@ -97,6 +169,40 @@ guint8 crc8_0x2F(guint8 *buf, guint32 len, guint8 seed)
return crc8_precompiled(buf, len, seed, crc8_precompiled_2F);
}
+/** Calculates a CRC8 checksum for the given buffer with the polynom
+ * 0x37 using the precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC8 checksum for the buffer
+ */
+guint8 crc8_0x37(guint8 *buf, guint32 len, guint8 seed)
+{
+ guint8 crc = seed;
+ while (len-- > 0)
+ {
+ crc = crc8_precompiled_37[(crc ^ *buf++)];
+ }
+ return (crc);
+}
+
+/** Calculates a CRC8 checksum for the given buffer with the polynom
+ * 0x3B using the precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC8 checksum for the buffer
+ */
+guint8 crc8_0x3B(guint8 *buf, guint32 len, guint8 seed)
+{
+ guint8 crc = seed;
+ while (len-- > 0)
+ {
+ crc = crc8_precompiled_3b[(crc ^ *buf++)];
+ }
+ return (crc);
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*
diff --git a/wsutil/crc8.h b/wsutil/crc8.h
index 52db4fd64b..0aaf78e2ae 100644
--- a/wsutil/crc8.h
+++ b/wsutil/crc8.h
@@ -41,6 +41,24 @@ extern "C" {
*/
WS_DLL_PUBLIC guint8 crc8_0x2F(guint8 *buf, guint32 len, guint8 seed);
+/** Calculates a CRC8 checksum for the given buffer with the polynom
+ * 0x37 using the precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC8 checksum for the buffer
+ */
+WS_DLL_PUBLIC guint8 crc8_0x37(guint8 *buf, guint32 len, guint8 seed);
+
+/** Calculates a CRC8 checksum for the given buffer with the polynom
+ * 0x3B using the precompiled CRC table
+ * @param buf a pointer to a buffer of the given length
+ * @param len the length of the given buffer
+ * @param seed The seed to use.
+ * @return the CRC8 checksum for the buffer
+ */
+WS_DLL_PUBLIC guint8 crc8_0x3B(guint8 *buf, guint32 len, guint8 seed);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */