diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-08-29 19:33:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-08-29 19:33:00 +0000 |
commit | 19216e7292c495fbaa82e5395bfe3c7658dcac86 (patch) | |
tree | 2eae22d67816aa6fe941eeeb434e77130d51ceb6 /packet-iscsi.c | |
parent | 3f4397bbb054b20791c237afac01f431d8d20f04 (diff) |
From Mark Burton: fix the byte order in the CRC calculation.
svn path=/trunk/; revision=6130
Diffstat (limited to 'packet-iscsi.c')
-rw-r--r-- | packet-iscsi.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packet-iscsi.c b/packet-iscsi.c index 50e5e59a29..c204acadf5 100644 --- a/packet-iscsi.c +++ b/packet-iscsi.c @@ -2,7 +2,7 @@ * Routines for iSCSI dissection * Copyright 2001, Eurologic and Mark Burton <markb@ordern.com> * - * $Id: packet-iscsi.c,v 1.38 2002/08/28 21:00:18 jmayer Exp $ + * $Id: packet-iscsi.c,v 1.39 2002/08/29 19:33:00 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -568,12 +568,22 @@ static guint32 crc32Table[256] = { #define CRC32C_PRELOAD 0xffffffff +/* + * Byte swap fix contributed by Dave Wysochanski <davidw@netapp.com> + */ +#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); } /* |