hash mismatch problem on ARM system

Aras Vaichas arasv at magtech.com.au
Mon Jul 21 14:49:58 WST 2008


Aras Vaichas wrote:
> Hi,
>
> I'm getting "hash mismatch" problems in my embedded ARM system when
> using gcc-4.2.3-glibc-2.7 and Scratchbox to compile the code. I also
> get  "differ in signedness" warnings during compilation.
>
> If I try to ssh to the remote server:
>
> $ ssh root at 169.254.0.252
> hash mismatch
> key_verify failed for server_host_key
>
>
> If I try to ssh on the remote server:
>
> /root # ssh root at localhost
> ssh: connection to root at localhost:22 exited: Bad hostkey signature
>
>
> This sounds very similar to the problem outlined in this older posting:
>
> http://www.mail-archive.com/[email protected]/msg00083.html
>
> The solution to this version of the problem was:
>
> "The avr32-linux-gcc compiler had a wrong implementation of the ror and
> rol functions. And the uClibc library had a bug in memcmp function."
>
> I'm using arm-linux-gcc, could it have the same problem?
>
>
> I tested against Dropbear 0.46 and Dropbear 0.51 and the results are the
> same, the problem is with my compiler/build environment.
>
> My old (working) version of Dropbear was built with
> gcc-3.4.4-glibc-2.3.5 and was compiled in a cross-compilation style.
>
> My new (broken) version of Dropbear was built with gcc-4.2.3-glibc-2.7
> and uses the Scratchbox environment.
>
>
> Can someone give me some pointers as to the root source of the problem?
>
> As another test, I'm going to build and test OpenSSH to confirm if this
> problem is Dropbear build specific or is a real problem with my build
> environment.
>   
evilness ...

I cross-compiled Dropbear using the Scratchbox binaries from x86 land,
and it worked OK.
I cross-compiled Dropbear from within Scratchbox (semi-virtual ARM
land), and it worked OK.

This proves it isn't the compiler's fault..

I cross-compiled by passing the makefile options as arguments to the
Scratchbox command line, and it breaks.
e.g.
$ scratchbox make PROGRAMS="dropbear dbclient dropbearkey
dropbearconvert scp" MULTI=1

I logged the output of each compile and noticed that there was one
obvious difference between the methods:

e.g.:

Doing a Scratchbox cross-compile from outside of Scratchbox
gcc -I. -I. -I./libtomcrypt/src/headers/  -Os -W -Wall -DDROPBEAR_CLIENT
-DDBMULTI_dbclient -DDROPBEAR_MULTI   -c -o listener.o listener.c

Doing a Scratchbox cross-compile from inside of Scratchbox
gcc -I. -I. -I./libtomcrypt/src/headers/  -Os -W -Wall -DDROPBEAR_SERVER
-DDROPBEAR_CLIENT -DDBMULTI_dropbear -DDBMULTI_dbclient
-DDBMULTI_dropbearkey -DDBMULTI_dropbearconvert -DDBMULTI_scp
-DDROPBEAR_MULTI   -c -o listener.o listener.c

For some reason, passing those makefile arguments over the Scratchbox
barrier just didn't work too well, and the Makefile created different
results.

I fixed this by encoding the Makefile arguments into the Makefile itself.

PROGRAMS=dropbear dbclient dropbearkey dropbearconvert scp
MULTI=1

Aras


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________



More information about the Dropbear mailing list