bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alignment issue with sha1 code from gnulib


From: Simon Josefsson
Subject: Re: Alignment issue with sha1 code from gnulib
Date: Thu, 31 Jan 2008 10:49:25 +0100
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Jim Meyering wrote:
>> Thanks for the suggestion.  It looks like a good one.
>
> The suggestion also applies to the 'md5' module, after which the 'sha1' module
> is modeled.
>
> But if you apply the suggestion to both the sha1 and md5 modules, we get
> an additional difference to glibc code.
>
> OTOH, Simon himself fell into the pitfall at every usage of these functions:
>   - In lib/hmac-sha1.c, the arrays optkeybuf and innerhash are not aligned.
>   - Likewise for lib/hmac-md5.c.
>   - In lib/hmac.h, the documentation of both functions fails to mention the
>     alignment requirement for the RESBUF argument.
>   - In lib/gc.h, the declaration of gc_hash_buffer, gc_hmac_md5 and 
> gc_hmac_sha1
>     also fails to mention the alignment requirement.
> And gc_hash_buffer is a function to be used by applications. So there are
> surely more occurrences of the problem.
>
> All in all, I think it's worth fixing this, even at the cost of
> diverging from glibc.

I agree.  An API with subtle issues like this is bound to cause
problems.  I've never encountered the problem in practice though, which
seems strange given that this code has been tested on many platforms.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]