summaryrefslogtreecommitdiff
path: root/packet-sctp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-03-02 07:29:10 +0000
committerGuy Harris <guy@alum.mit.edu>2002-03-02 07:29:10 +0000
commitceb7646a7940b6082ef4c351a20e260c8ed906ac (patch)
tree3144caf1b7de8d246e630972c8b191866188dab1 /packet-sctp.c
parent6dacf7e132389b4f042b79498a064f06a480d942 (diff)
downloadwireshark-ceb7646a7940b6082ef4c351a20e260c8ed906ac.tar.gz
From Michael Tuexen: update the CRC32 checksum code to match
draft-ietf-tsvwg-sctpcsum-03. svn path=/trunk/; revision=4844
Diffstat (limited to 'packet-sctp.c')
-rw-r--r--packet-sctp.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/packet-sctp.c b/packet-sctp.c
index a739baae27..a75401208f 100644
--- a/packet-sctp.c
+++ b/packet-sctp.c
@@ -4,13 +4,13 @@
* - RFC 2960, for basic SCTP support
* - http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-addip-sctp-03.txt for the add-IP extension
* - http://www.sctp.org/draft-ietf-tsvwg-usctp-01.txt for the 'Limited Retransmission' extension
- * - http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpcsum-01.txt
+ * - http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpcsum-03.txt
* Copyright 2000, 2001, 2002, Michael Tuexen <Michael.Tuexen@icn.siemens.de>
* Still to do (so stay tuned)
* - support for reassembly
* - code cleanup
*
- * $Id: packet-sctp.c,v 1.31 2002/02/02 21:17:10 guy Exp $
+ * $Id: packet-sctp.c,v 1.32 2002/03/02 07:29:10 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -604,7 +604,9 @@ sctp_crc32c(const unsigned char* buf, unsigned int len)
{
unsigned int i;
unsigned long crc32 = ~0L;
-
+ unsigned long result;
+ unsigned char byte0,byte1,byte2,byte3;
+
for (i = 0; i < SOURCE_PORT_LENGTH + DESTINATION_PORT_LENGTH + VERIFICATION_TAG_LENGTH; i++)
{
CRC32C(crc32, buf[i]);
@@ -617,7 +619,14 @@ sctp_crc32c(const unsigned char* buf, unsigned int len)
{
CRC32C(crc32, buf[i]);
}
- return crc32;
+ result = ~crc32;
+
+ byte0 = result & 0xff;
+ byte1 = (result>>8) & 0xff;
+ byte2 = (result>>16) & 0xff;
+ byte3 = (result>>24) & 0xff;
+ crc32 = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3);
+ return ( crc32 );
}
static guint