From ca6e94702cfbe29b279cf18f39a0fe492fae6f83 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Thu, 28 Sep 2023 11:20:53 +1000 Subject: siphash: Make siphash functions consistently return 64-bit results Some of the siphas_*b() functions return 64-bit results, others 32-bit results, with no obvious pattern. siphash_32b() also appears to do this incorrectly - taking the 64-bit hash value and simply returning it truncated, rather than folding the two halves together. Since SipHash proper is defined to give a 64-bit hash, make all of them return 64-bit results. In the one caller which needs a 32-bit value, tcp_seq_init() do the fold down to 32-bits ourselves. Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- siphash.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'siphash.h') diff --git a/siphash.h b/siphash.h index 5b0d0c3..de04c56 100644 --- a/siphash.h +++ b/siphash.h @@ -7,9 +7,9 @@ #define SIPHASH_H uint64_t siphash_8b(const uint8_t *in, const uint64_t *k); -uint32_t siphash_12b(const uint8_t *in, const uint64_t *k); +uint64_t siphash_12b(const uint8_t *in, const uint64_t *k); uint64_t siphash_20b(const uint8_t *in, const uint64_t *k); -uint32_t siphash_32b(const uint8_t *in, const uint64_t *k); -uint32_t siphash_36b(const uint8_t *in, const uint64_t *k); +uint64_t siphash_32b(const uint8_t *in, const uint64_t *k); +uint64_t siphash_36b(const uint8_t *in, const uint64_t *k); #endif /* SIPHASH_H */ -- cgit v1.2.3