Does hastd work on Big Endian? Fw: git: 6998572a74a9 - main - hastd: use zlib's crc32 implementation.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 04 Feb 2023 15:55:48 UTC
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 <delphij@freebsd.org>To: "src-committers@freebsd.org" <src-committers@freebsd.org>; "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>; "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>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 <delphij@FreeBSD.org> AuthorDate: 2023-02-03 07:14:21 +0000 Commit: Xin LI <delphij@FreeBSD.org> 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);