patch for cipher/sha512.c (u64 numbers)

David Shaw dshaw at jabberwocky.com
Fri May 9 18:07:01 CEST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, May 09, 2003 at 09:05:43AM -0400, David Shaw wrote:
> On Thu, May 08, 2003 at 05:01:12PM +0200, Werner Koch wrote:
> > On Tue, 6 May 2003 16:50:52 +0200, Christoph Moench-Tegeder said:
> > 
> > > In cipher/sha512.c u64 (long long int on most platforms) constants
> > > are without modifier 'LL' in assignments. At least HP's cc in ANSI
> > 
> > To my knowledge the LL suffix is not C-89 and thus we can't use it.
> > The simple solution is to fix HP's compiler or write an autoconf test
> > to detect such a broken compiler.
> 
> Yes, LL is C99.  I think I can make an autoconf test without too much
> trouble.

Okay, here's what I'm thinking:

1) c89 does not guarantee that 64-bit ints are available, and does not
support LL.

2) c99 does guarantee 64-bit ints, and does support LL.

3) Some/many supposedly "c89" compilers support 64-bit ints and LL
anyway as an extension.

So the answer is to always use LL in the code, and try and weed out
any compilers that don't support LL in autoconf.  This will work on
all c99 compilers, and any c89 compilers that support 64-bit ints.  If
it is a pure c89 compiler (and therefore doesn't support 64-bit ints),
it doesn't matter if it supports LL or not.  The only thing this test
won't handle is a c89 compiler that does support 64-bit ints, but does
not support LL.  I can live with that, especially since the digest
code in question is optional anyway.

David
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: http://www.jabberwocky.com/david/keys.asc

iD8DBQE+u8RQ4mZch0nhy8kRAgFbAKDkHDaSrlr4Qpflc9Nr7xiQNmTCGACePLVf
jVc7Aqed74i3uBy8J5P1u1E=
=y1TH
-----END PGP SIGNATURE-----




More information about the Gnupg-devel mailing list