]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: md4 - Fix violation of strict aliasing.
authorMartin Liska <mliska@suse.cz>
Fri, 24 Mar 2023 12:33:13 +0000 (13:33 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 24 Mar 2023 15:27:43 +0000 (15:27 +0000)
Fix miscompilation when LTO is enabled.

src/lib/md4.c

index 06082f53c7484b4fdb198d7954698ac7e03ca813..60413bd9570356a4b7612b582c173d9924b53e14 100644 (file)
        (a) = ((a) << (s)) | ((a) >> (32 - (s)))
 
 
-/*
- * SET reads 4 input bytes in little-endian byte order and stores them
- * in a properly aligned word in host byte order.
- *
- * The check for little-endian architectures which tolerate unaligned
- * memory accesses is just an optimization.  Nothing will break if it
- * doesn't work.
- */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
-/* uint_fast32_t might be 64 bit, and thus may read 4 more bytes
- * beyond the end of the buffer. So only read precisely 32 bits
- */
-#define SET(n)                         \
-       (*(const uint32_t *)&ptr[(n) * 4])
-#define GET(n) \
-       SET(n)
-#else
 #define SET(n) \
        (ctx->block[(n)] = \
        (uint_fast32_t)ptr[(n) * 4] | \
@@ -59,7 +42,6 @@
        ((uint_fast32_t)ptr[(n) * 4 + 3] << 24))
 #define GET(n) \
        (ctx->block[(n)])
-#endif
 
 /*
  * This processes one or more 64-byte data blocks, but does NOT update