2.2.2.3 Packet Checksum

The Checksum for the packet is computed after the packet has been fully constructed and before the SecurityData field is updated. The Checksum MUST be computed using the Session Header, Packet-specific Section and Extended Options. The computation for the Checksum of the packet MUST NOT include the Security Header.

The Checksum is computed by initializing the unsigned 32-bit PacketChecksum variable to zero and adding each byte of the packet to the PacketChecksum variable starting from the Session Header of the fully constructed packet.

Once all bytes have been added to the variable PacketChecksum, all bits of the value are inverted.

Finally, the value of PacketChecksum is transformed to network byte order and added to the Security Header.