From c58cc09cf50a18058efb59e1b4fb73ab1e3a45a2 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 19 Feb 2024 16:05:59 +0100 Subject: lib: Fix CRC32 hashing I assumed that all hashes were stored in Big Endian, but apparently the CRC32 was still in machine endianness when calculated by the rhash implementation. Fixed and updated hash tests a bit. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- include/ouroboros/test.h | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'include/ouroboros') diff --git a/include/ouroboros/test.h b/include/ouroboros/test.h index a88b5548..096e145c 100644 --- a/include/ouroboros/test.h +++ b/include/ouroboros/test.h @@ -29,22 +29,25 @@ #include #include -#define TEST_START() \ - do { \ - printf("%s started.\n", __func__); \ - fflush(stdout); \ - } while(0) -#define TEST_SUCCESS() \ - do { \ - printf("%s succeeded.\n", __func__); \ - fflush(stdout); \ - } while(0) +#define TEST_START() \ + do { \ + printf("%s started.\n", __func__); \ + fflush(stdout); \ + } while (0) +#define TEST_SUCCESS() \ + do { \ + printf("%s succeeded.\n", __func__); \ + fflush(stdout); \ + } while (0) -#define TEST_FAIL() \ - do { \ - printf("%s failed.\n", __func__); \ - fflush(stdout); \ - } while(0) +#define TEST_FAIL() \ + do { \ + printf("%s failed.\n", __func__); \ + fflush(stdout); \ + } while (0) + +#define TEST_END(result) \ + do { if (result == 0) TEST_SUCCESS(); else TEST_FAIL(); } while (0) static int __attribute__((unused)) test_assert_fail(int(* testfunc)(void)) { -- cgit v1.2.3