Hello,
The attached patch reverses the byte ordering of the result of the
CRC32C calculation. Apparently, it was incorrect. Thanks to Dave
Wysochanski <[EMAIL PROTECTED]> for pointing this out to me.
Cheers,
Mark
Index: packet-iscsi.c
===================================================================
RCS file: /cvsroot/ethereal/packet-iscsi.c,v
retrieving revision 1.37
diff -u -3 -p -r1.37 packet-iscsi.c
--- packet-iscsi.c 2002/08/20 22:33:16 1.37
+++ packet-iscsi.c 2002/08/29 19:09:37
@@ -568,12 +568,22 @@ static guint32 crc32Table[256] = {
#define CRC32C_PRELOAD 0xffffffff
+/*
+ * Byte swap fix contributed by Dave Wysochanski <[EMAIL PROTECTED]>
+ */
+#define CRC32C_SWAP(crc32c_value) \
+ (((crc32c_value & 0xff000000) >> 24) | \
+ ((crc32c_value & 0x00ff0000) >> 8) | \
+ ((crc32c_value & 0x0000ff00) << 8) | \
+ ((crc32c_value & 0x000000ff) << 24))
+
static guint32
calculateCRC32(const void *buf, int len, guint32 crc) {
guint8 *p = (guint8 *)buf;
+ crc = CRC32C_SWAP(crc);
while(len-- > 0)
crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8);
- return crc;
+ return CRC32C_SWAP(crc);
}
/*