md4/md5: disable optimization causing unaligned access
authorChristian Göttsche <cgzones@googlemail.com>
Tue, 7 Dec 2021 12:01:10 +0000 (13:01 +0100)
committerNoah Meyerhans <noahm@debian.org>
Sun, 10 Mar 2024 06:31:22 +0000 (22:31 -0800)
This restores unit tests with GCC 11 and LTO.

    md5.c:92:23: warning: cast from 'const unsigned char *' to 'const uint32_t *' (aka 'const unsigned int *') increases required alignment from 1 to 4 [-Wcast-align]
                    STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
                    ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
    md5.c:51:4: note: expanded from macro 'SET'
            (*(const uint32_t *)&ptr[(n) * 4])
              ^
    md5.c:37:29: note: expanded from macro 'STEP'
            (a) += f((b), (c), (d)) + (x) + (t); \
                                       ^

    md5.c:92:3: runtime error: load of misaligned address 0x61900000008b for type 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment
    0x61900000008b: note: pointer points here
     41  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41 41  41 41 41 41 41 41 41
                  ^

Gbp-Pq: Name md4-md5-disable-optimization-causing-unaligned-access.patch

src/lib/md4.c
src/lib/md5.c

index 06e3231bde091aae8831d06f6a619da056835c34..798292a16f1b5a2d3796a88920c9d2d3d5c3e844 100644 (file)
@@ -42,7 +42,7 @@
  * memory accesses is just an optimization.  Nothing will break if it
  * doesn't work.
  */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
+#if 0 //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
  */
index 6b5da6c307df32b9db28f0ee19405a7daa69481e..c605639aa161e98e482830d7bf2e3954673a152a 100644 (file)
@@ -46,7 +46,7 @@
  * memory accesses is just an optimization.  Nothing will break if it
  * doesn't work.
  */
-#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
+#if 0 //defined(__i386__) || defined(__x86_64__) || defined(__vax__)
 #define SET(n) \
        (*(const uint32_t *)&ptr[(n) * 4])
 #define GET(n) \