On Sun, 13 Jan 2008, David Shaw wrote:

> > 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.

By all means.

> Until gnulib fixes the alignment issue, how about this patch for
> paperkey?  It mallocs the buffer, which should ensure that it is
> correctly aligned.

>    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);
>      }

I don't think that'd fix it - the sha struct was aligned properly, the
fingerprint wasn't.

Peter
-- 
                           |  .''`.  ** Debian GNU/Linux **
      Peter Palfrader      | : :' :      The  universal
 http://www.palfrader.org/ | `. `'      Operating System
                           |   `-    http://www.debian.org/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to