Different zlib CRC Algorithms

Phil Thompson phil at river-bank.demon.co.uk
Tue Feb 4 12:34:24 EST 2003


On Tuesday 04 February 2003 5:06 pm, Joakim Tjernlund wrote:
> > > > 	crc = (crc32(crc ^ 0xffffffff),buf,len) ^ 0xffffffff);
> > > >
> > > > ...otherwise all the CRC checks fail.
> > >
> > > What bootloader? If ppcboot/uboot I think you will find that
> > > ppcboot/uboot has 2 versions of crc32 and you are using the
> > > wrong one?
> >
> > As I said above, at the moment I'm implementing it as a Linux application
> > and so using the crc32() in userspace zlib which (I am suggesting) is
> > different to the one in the kernel.
>
> OK, then I am lost.
>
> > Why does ppcboot/uboot have two versions of crc32()? What's the
> > difference between them?
>
> The difference is the ^0xffffffff part you decribed above. One is used by
> uboot for crc'ing images, environment etc. The other for JFFS2 support in
> uboot.

So that would confirm my original observation that the kernel does use a 
slightly different CRC algorithm than userspace zlib.

It's not a problem - I was just curious to know why.

Phil




More information about the linux-mtd mailing list