]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix Keccak undefined behavior on exotic platforms.
authorGeorge Kadianakis <desnacked@riseup.net>
Thu, 17 Dec 2020 11:49:17 +0000 (13:49 +0200)
committerGeorge Kadianakis <desnacked@riseup.net>
Thu, 17 Dec 2020 11:49:17 +0000 (13:49 +0200)
Bug reported and diagnosed in:
    https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975977

Fixes bug #40210.

changes/bug40210 [new file with mode: 0644]
src/ext/keccak-tiny/keccak-tiny.h

diff --git a/changes/bug40210 b/changes/bug40210
new file mode 100644 (file)
index 0000000..f492262
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor features (crypto):
+    - Fix undefined behavior on our Keccak library. The bug only appears on
+      platforms with 32-byte CPU cache lines (e.g. armv5tel) and would result
+      in wrong digests. Fixes bug 40210; bugfix on 0.2.8.1-alpha. Thanks to
+      Bernhard Übelacker, Arnd Bergmann and weasel for diagnosing this.
index a9c8ed64205d677f073025889f495b3fd479d263..dd26386a9a8c472736ecf2b926d2f133f4bd52cf 100644 (file)
@@ -21,7 +21,7 @@ typedef struct keccak_state {
   size_t offset;
 
   uint8_t finalized : 1;
-} keccak_state;
+} __attribute__((aligned(8))) keccak_state;
 
 /* Initialize a Keccak instance suitable for SHA-3 hash functions. */
 int keccak_digest_init(keccak_state *s, size_t bits);