]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: md5: Fix strict aliasing violation
authorSam James <sam@gentoo.org>
Mon, 27 Mar 2023 01:25:12 +0000 (02:25 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 27 Mar 2023 09:36:12 +0000 (09:36 +0000)
Followup to f0c1cf42ea78d22e2674b03fe65f0ee6545c5b99. It's exactly the
same code as in md4, so let's rip it out here too.

src/lib/md5.c

index 46cffb6d123e53b0680bb956d1b7e926d0b2b9f8..ee946ea8057bd72b9c1ccfb5c347466820ccd878 100644 (file)
        (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
        (a) += (b);
 
-/*
- * 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__)
-#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] | \
@@ -60,7 +46,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