Does hastd work on Big Endian? Fw: git: 6998572a74a9 - main - hastd: use zlib's crc32 implementation.
Pedro Giffuni <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.ppc |
|---|---|
| Message-ID | <[email protected]> |
Hi; Not really concerned about the commit here .. but about the last comment. Checksums may need adjustments for endianness. Cheers, Pedro. ----- Forwarded Message ----- From: Xin LI <[email protected]>To: "[email protected]" <[email protected]>; "[email protected]" <[email protected]>; "[email protected]" <[email protected]>Sent: Friday, February 3, 2023 at 02:14:34 AM GMT-5Subject: git: 6998572a74a9 - main - hastd: use zlib's crc32 implementation. The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6998572a74a98721781ecd5b6829435259f9825a commit 6998572a74a98721781ecd5b6829435259f9825a Author: Xin LI <[email protected]> AuthorDate: 2023-02-03 07:14:21 +0000 Commit: Xin LI <[email protected]> CommitDate: 2023-02-03 07:14:21 +0000 hastd: use zlib's crc32 implementation. Reviewed by: pjd MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35767 --- ...<snip>...diff --git a/sbin/hastd/hast_checksum.c b/sbin/hastd/hast_checksum.c index f7ef6a64b4e1..dccba3752cb1 100644 --- a/sbin/hastd/hast_checksum.c +++ b/sbin/hastd/hast_checksum.c @@ -33,10 +33,10 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <strings.h> -#include <crc32.h> #include <hast.h> #include <nv.h> #include <sha256.h> +#include <zlib.h> #include <pjdlog.h> #include "hast_checksum.h" @@ -49,7 +49,9 @@ hast_crc32_checksum(const unsigned char *data, size_t size, { uint32_t crc; - crc = crc32(data, size); + crc = crc32(0L, Z_NULL, 0); + crc = crc32(crc, data, size); + /* XXXPJD: Do we have to use htole32() on crc first? */ bcopy(&crc, hash, sizeof(crc)); *hsizep = sizeof(crc);