Subject: Question about 32bit FCS calculation in RFC1662

From: Osamu YONEMURA <[email-masked]>
Date: Mon, 23 Oct 2000 20:52:54 +0900

Hi all.

I have a few questions about the 32bit FCS calculation in RFC1662.
Please tell me about following questions.

(1)I try to calculate a FCS value using sample C code in the Appendix
   and I checked the FCS results with the example values of the AAL5
   in ITU-T Recommendation I.363. 
   But the calculated FCS result is not the same with example value.

   Is the FCS calculate method of PPP is different from the one of AAL5 ?

(2)And also, I want to use the 32bit FCS calculation of PPP for the one
   of the Ethernet. 

   Is the FCS calculate method of PPP the same with the one of Ethernet ?
   And is it possible that I use the sample C code for the FCS calculation
   of Ethernet ?

Regards, 
Osamu Yonemura

----
Osamu Yonemura 
E-mail: [email-masked]
NEC Corporation.

---

From: James Carlson <[email-masked]>
Date: Mon, 23 Oct 2000 08:49:21 -0400 (EDT)

>    Is the FCS calculate method of PPP is different from the one of AAL5 ?

It's the same; the bits are just reversed.  You can pick up useful
examples here:

http://cell-relay.indiana.edu/cell-relay/publications/software/CRC/32bitCRC.html

If you calculate AAL-5 CRC-32 over 40 octets of 0xff plus AAL-5
framing (00 00 00 28), it comes up with a CRC-32 of 0xc55e457a.  To
run the same data through PPP FCS, reverse all of the bits in each
byte of the input (the final 28 changes to 14), and calculate 0xa3
0x7a 0xa2 0x5e.  Reverse each byte to produce 0xc5 0x5e 0x45 0x7a.

>    And is it possible that I use the sample C code for the FCS calculation

The PPP 32 bit FCS is the same as the Ethernet FCS.  It's also the
same as the AAL-5 CRC-32.

-- 
James Carlson, Internet Engineering       <[email-masked]>
SUN Microsystems / 1 Network Drive         71.234W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.497N   Fax +1 781 442 1677
Second Edition now available - http://people.ne.mediaone.net/carlson/ppp

---

From: Osamu YONEMURA <[email-masked]>
Date: Mon, 23 Oct 2000 23:13:52 +0900

Dear James,
Thank you for your reply.

On Mon, 23 Oct 2000 08:49:21 -0400 (EDT)

> 0x7a 0xa2 0x5e.  Reverse each byte to produce 0xc5 0x5e 0x45 0x7a.

I got the correct result using this method.

I want to confirm the data input and output methods.
Please check the following methods.

In AAL5 CRC-32 Calculation using the PPP FCS code, 
I need to reverse all of the bits in each byte of the input and the result.

> same as the AAL-5 CRC-32.

In the PPP and Ethernet FCS calculation using the PPP FCS code,
I don't need to reverse all bit of the input and the output.
Is this correct?

Thanks and regards,
Osamu Yonemura
----
Osamu Yonemura

---

From: James Carlson <[email-masked]>
Date: Mon, 23 Oct 2000 10:23:40 -0400 (EDT)

> I need to reverse all of the bits in each byte of the input and the result.

Yes, assuming you're using the PPP FCS code.  The reverse is true if
you're using the AAL-5 code.  They're equivalent.

> I don't need to reverse all bit of the input and the output.

Yes.  AAL-5 uses big-endian format; the others use little-endian.
This is because of the way the bits are sent on the wire.  ATM sends
bits in big-endian (MSB first) format.  Ethernet always sends the bits
little-endian (LSB first).  PPP normally runs on media (most async and
sync links) that also send bytes in little-endian mode.

As a side issue, when PPP runs over SONET/SDH, the CRC is
unfortunately still calculated as though the octets were sent with
LSB-first order, even though SONET/SDH defines transmission so that
the bytes are in MSB-first order.  This is a bug in the spec.