From: Lennart Poettering Date: Mon, 18 Dec 2023 13:52:53 +0000 (+0100) Subject: siphash: make sure siphash24_compress_usec_t() works the same on LE/BE archs X-Git-Tag: v256-rc1~1461 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8722c7e7bc0a680b734da37e9a08b671d1f141ce;p=thirdparty%2Fsystemd.git siphash: make sure siphash24_compress_usec_t() works the same on LE/BE archs Let's be systematic here, and always hash LE values. It doesn't matter in our current codebase, but it might one day. --- diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h index 0b3e845bf46..72147a99040 100644 --- a/src/basic/siphash24.h +++ b/src/basic/siphash24.h @@ -25,12 +25,12 @@ void siphash24_compress(const void *in, size_t inlen, struct siphash *state); static inline void siphash24_compress_boolean(bool in, struct siphash *state) { uint8_t i = in; - siphash24_compress(&i, sizeof i, state); } static inline void siphash24_compress_usec_t(usec_t in, struct siphash *state) { - siphash24_compress(&in, sizeof in, state); + uint64_t u = htole64(in); + siphash24_compress(&u, sizeof u, state); } static inline void siphash24_compress_safe(const void *in, size_t inlen, struct siphash *state) {