On Sat, Jan 12, 2008 at 05:21:39PM +0100, Peter Palfrader wrote: > Package: paperkey > Version: 0.7-1 > Severity: serious > > Hi David, > > As can be seen at [0] paperkey fails to build from source on sparc[1]. > The testsuite fails due to unaligned memory access in sha1_read_ctx.
Interesting. I actually tested on Solaris running sparc, too. Your patch seems fine, but the sha1 code actually comes from gnulib, so the alignment fix should be sent there. With your permission, I'll forward it. Until gnulib fixes the alignment issue, how about this patch for paperkey? It mallocs the buffer, which should ensure that it is correctly aligned. David
Index: parse.c =================================================================== --- parse.c (revision 349) +++ parse.c (working copy) @@ -205,18 +205,22 @@ } else if(packet->buf[0]==4) { - struct sha1_ctx sha; + struct sha1_ctx *sha; unsigned char head[3]; - sha1_init_ctx(&sha); + sha=xmalloc(sizeof(*sha)); + sha1_init_ctx(sha); + head[0]=0x99; head[1]=public_len>>8; head[2]=public_len&0xFF; - sha1_process_bytes(head,3,&sha); - sha1_process_bytes(packet->buf,public_len,&sha); - sha1_finish_ctx(&sha,fingerprint); + sha1_process_bytes(head,3,sha); + sha1_process_bytes(packet->buf,public_len,sha); + sha1_finish_ctx(sha,fingerprint); + + free(sha); } return 0;