Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 27748: /trunk/plugins/profinet/ /tru
From: Ulf Lamping <[email protected]>
Date: Tue, 17 Mar 2009 01:16:31 +0100
Guy Harris schrieb:
On Mar 16, 2009, at 3:45 PM, Joerg Mayer wrote:

On Mon, Mar 16, 2009 at 09:40:03PM +0000, [email protected] wrote:
http://anonsvn.wireshark.org/viewvc/viewvc.cgi? view=rev&revision=27748
crc16 algorithm copied from Linux sources (GPL V2 only!)
So far the wireshark sources are v2 or later - so adding a gplv2 only file is not something that should be done without asking *first*, because it has effects for all of Wireshark. Or maybe there already were files that
are v2 only and I missed that?
Is the only difference between the CRC16 in PROFINET and the ITU-T  
CRC16 implemented in epan/crc16.c the polynomial?  It looks as if the  
algorithm is the same in the PROFINET CRC16 and the "reflected" ITU-T  
CRC16:
	crc = initial value;
	for (all bytes in the buffer)
		crc = (crc >> 8) ^ table[(crc ^ byte from buffer) & 0xff];
	return crc;

so it might just be the table. If so, could we just generate the appropriate table for the PROFINET polynomial, have epan/crc16.c export crc16_reflected(), and have the PROFINET CRC16 routine use crc16_reflected() and the appropriate table?
To be honest I just don't have a clue.

I did some experiments to use the existing CRC algorithms (trial and error based), but this is really no indication if it's possible or not ;-)
If you would like to do some "more educated" experiments on this I could 
send you a capture file with some valid CRCs in PM.
Regards, ULFL