From f96e737ef540665ff8df0e5d46a3ad0e2d7f67f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Vejpustek?= Date: Mon, 8 Nov 2021 17:12:43 +0100 Subject: [PATCH] fix(crypto): fix undefined behaviour of IS_ALIGNED_64 macro --- crypto/sha3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/sha3.c b/crypto/sha3.c index 24708ee59..55fbef335 100644 --- a/crypto/sha3.c +++ b/crypto/sha3.c @@ -27,7 +27,7 @@ #define I64(x) x##LL #define ROTL64(qword, n) ((qword) << (n) ^ ((qword) >> (64 - (n)))) #define le2me_64(x) (x) -#define IS_ALIGNED_64(p) (0 == (7 & ((const char*)(p) - (const char*)0))) +#define IS_ALIGNED_64(p) (0 == (((uintptr_t)(const void *)(p) & 0x7))) # define me64_to_le_str(to, from, length) memcpy((to), (from), (length)) /* constants */