Page MenuHomeFreeBSD

powerpc_nvram: Fix a bug in the adler32 checksum.
ClosedPublic

Authored by jhb on Sep 29 2022, 4:59 PM.
Tags
None
Referenced Files
F152743448: D36798.id111198.diff
Thu, Apr 16, 8:34 PM
F152670040: D36798.id111379.diff
Thu, Apr 16, 10:21 AM
Unknown Object (File)
Wed, Apr 15, 4:53 PM
Unknown Object (File)
Tue, Apr 14, 9:26 AM
Unknown Object (File)
Thu, Apr 9, 8:49 PM
Unknown Object (File)
Thu, Apr 9, 10:03 AM
Unknown Object (File)
Wed, Apr 8, 10:40 PM
Unknown Object (File)
Wed, Apr 8, 1:32 AM
Subscribers

Details

Summary

The Adler32 digest consists of two 16-bit words whose values are
calculated modulo 65521 (largest prime < 2^16). To avoid two division
instructions per byte, this version copies an optimization found in
zlib which defers the modulus until close to the point that the
intermediate sums can overflow 2^32. (zlib uses NMAX == 5552 for
this, this version uses 5000)

The bug is that in the deferred modulus case, the modulus was
only applied to the high word (and twice at that) but not to
the low word. The fix is to apply it to both words.

Reported by: Miod Vallat <miod@openbsd.org>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 47611
Build 44498: arc lint + arc unit