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
Unknown Object (File)
Tue, Oct 29, 5:10 PM
Unknown Object (File)
Sep 24 2024, 12:06 PM
Unknown Object (File)
Sep 23 2024, 5:18 PM
Unknown Object (File)
Sep 22 2024, 7:14 PM
Unknown Object (File)
Sep 18 2024, 6:37 PM
Unknown Object (File)
Sep 18 2024, 5:33 AM
Unknown Object (File)
Sep 17 2024, 5:51 PM
Unknown Object (File)
Sep 17 2024, 9:43 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 Not Applicable
Unit
Tests Not Applicable