Hello Peter,

Am 16.12.20 um 11:08 schrieb Peter Palfrader:
Hi Bernhard!

Can you try to rebuild tor with __attribute__((aligned(8))) for the
keccak_state as suggested in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975977#44
and then let us know if the issue is still there?


I rebuilt the tor package with this change [1] below (I hope I
placed it correctly).

With this I found "disassemble /r keccak_finalize" produces the
exact same instructions, but now the pointer given to keccak_finalize
seems to be aligned at a 8 byte boundary.

Now the strd placed at armv5tel the same sequence as
on armv7 to the "a" member [3].

And I guess hostname contains now the expected value:

    $ cat hs/hostname
    upxkcswnvepfls7vcy5vuixy54hlugfjnzhvl5ygfbjtm7znkyahcvad.onion

Kind regards,
Bernhard





[1]
diff --git a/src/ext/keccak-tiny/keccak-tiny.h 
b/src/ext/keccak-tiny/keccak-tiny.h
index a9c8ed6..dd26386 100644
--- a/src/ext/keccak-tiny/keccak-tiny.h
+++ b/src/ext/keccak-tiny/keccak-tiny.h
@@ -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);



[2]
(gdb) bt
#0  0x005c4ac4 in xorin8 (len=136, src=<optimized out>, dst=<optimized out>) at 
../src/ext/keccak-tiny/keccak-tiny-unrolled.c:21
#1  keccak_finalize (s=s@entry=0xbeffef98) at 
../src/ext/keccak-tiny/keccak-tiny-unrolled.c:189



[3]
(gdb) stepi
0x005c4ac0      21        return _le64toh(r);
1: x/i $pc
=> 0x5c4ac0 <keccak_finalize+192>:      strd    r2, [r4]
(gdb) x/8xb &((keccak_state *) 0xbeffef98)->a
0xbeffef98:     0x00    0x00    0x00    0x00    0x00    0x00    0x00    0x00
(gdb) stepi
0x005c4ac4      21        return _le64toh(r);
1: x/i $pc
=> 0x5c4ac4 <keccak_finalize+196>:      bhi     0x5c4a90 <keccak_finalize+144>
(gdb) x/8xb &((keccak_state *) 0xbeffef98)->a
0xbeffef98:     0x2e    0x6f    0x6e    0x69    0x6f    0x6e    0x20    0x63
(gdb) display/x $r2
2: /x $r2 = 0x696e6f2e
(gdb) display/x $r4
3: /x $r4 = 0xbeffef98

Reply via email to