This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Bug in crc32 routine?
- From: Roland Caßebohm <roland dot cassebohm at visionsystems dot de>
- To: ecos-patches at sources dot redhat dot com
- Date: Thu, 10 Oct 2002 16:54:28 +0200
- Subject: Bug in crc32 routine?
I think in the crc23 routine in the crc package is a bug.
If I use under linux the crc32 routine of the zlib I get not the same result
as the one of eCos.
I have seen, that in the Samsung KS32C5000 ethernet driver is a crc32 routin
too and it differs from the one off the crc package. After changing this
routine like the one off the ethernet driver, I get the same result right.
As an attachment I send the patch.
Best regards
Roland Caßebohm
? crc32.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/crc/current/ChangeLog,v
retrieving revision 1.1
diff -u -5 -p -r1.1 ChangeLog
--- ChangeLog 9 Aug 2002 10:27:03 -0000 1.1
+++ ChangeLog 10 Oct 2002 14:53:59 -0000
@@ -1,5 +1,9 @@
+2002-10-10 Roland Caßebohm <roland.cassebohm@visionsystems.de>
+
+ * Fix cyg_crc32() routine
+
2002-08-07 Andrew Lunn <andrew.lunn@ascom.ch>
* Created a new package from the CRC routines
embedded in RedBoot.
Index: src/crc32.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/services/crc/current/src/crc32.c,v
retrieving revision 1.1
diff -u -5 -p -r1.1 crc32.c
--- src/crc32.c 9 Aug 2002 10:27:04 -0000 1.1
+++ src/crc32.c 10 Oct 2002 14:53:59 -0000
@@ -126,11 +126,11 @@ unsigned long
cyg_crc32(unsigned char *s, int len)
{
int i;
unsigned long crc32val;
- crc32val = 0;
+ crc32val = 0xffffffff;
for (i = 0; i < len; i++) {
crc32val = crc32_tab[(crc32val ^ s[i]) & 0xff] ^ (crc32val >> 8);
}
- return crc32val;
+ return crc32val ^ 0xffffffff;
}