RFC Errata
RFC 1624, "Computation of the Internet Checksum via Incremental Update", May 1994
Source of RFC: LegacyArea Assignment: art
Errata ID: 5864
Status: Reported
Type: Technical
Publication Format(s) : TEXT
Reported By: J.A. Bezemer
Date Reported: 2019-09-25
Section 3 says:
(end of section 3 Discussion)
It should say:
(Add text at end of section 3 Discussion:) Where "+" denotes 1's complement addition, in which carry bits are added to the low-order bits of the sum. For machines employing e.g. 32-bit arithmetic, the 1's complement addition of three 16-bit words A and B and C is accomplished as follows: sum = A + B + C while (sum > 0xFFFF) { sum = (sum & 0xFFFF) + (sum >> 16) }
Notes:
The existing Errata ID: 4782 does not appear to correctly implement 1's complement addition.
Its example should read as follows:
~(~HC + ~m + m')
~(~0x0000 + ~0x5555 + 0x5555)
~(0xFFFF + 0xAAAA + 0x5555)
~(0x1FFFE) -- 32bit
~(0xFFFE + 0x1) -- carry foldaround
~(0xFFFF)
0x0000
A different example showing multiple carry foldaround is replacing a 0x5555 value by 0x5556 where the original header checksum was 0x0000:
~(~HC + ~m + m')
~(~0x0000 + ~0x5555 + 0x5556)
~(0xFFFF + 0xAAAA + 0x5556)
~(0x1FFFF) -- 32bit
~(0xFFFF + 0x1) -- carry foldaround
~(0x10000) -- 32bit
~(0x0000 + 0x1) -- carry foldaround
~(0x0001)
0xFFFE