[openssl-dev] [openssl.org #4422] OS X 32-bit PowerPC: blake2b.c:27: warning: integer constant is too large for 'unsigned long' type

Jeffrey Walton noloader at gmail.com
Sun Mar 13 11:23:54 UTC 2016


> static const uint64_t blake2b_IV[8] =
> {
>     0x6a09e667f3bcc908U, 0xbb67ae8584caa73bU,
>     0x3c6ef372fe94f82bU, 0xa54ff53a5f1d36f1U,
>     0x510e527fade682d1U, 0x9b05688c2b3e6c1fU,
>     0x1f83d9abfb41bd6bU, 0x5be0cd19137e2179U
> };
>
> I've run into this before, but in C++. I think you need ULL, and not
> U. But I don't know if it will adversely affect other compilers and
> platforms.
>
> $ diff --git a/crypto/blake2/blake2b.c b/crypto/blake2/blake2b.c
> index 6219490..aa0e814 100644
> --- a/crypto/blake2/blake2b.c
> +++ b/crypto/blake2/blake2b.c
> @@ -24,10 +24,10 @@
>
>  static const uint64_t blake2b_IV[8] =
>  {
> -    0x6a09e667f3bcc908U, 0xbb67ae8584caa73bU,
> -    0x3c6ef372fe94f82bU, 0xa54ff53a5f1d36f1U,
> -    0x510e527fade682d1U, 0x9b05688c2b3e6c1fU,
> -    0x1f83d9abfb41bd6bU, 0x5be0cd19137e2179U
> +    0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL,
> +    0x3c6ef372fe94f82bULL, 0xa54ff53a5f1d36f1ULL,
> +    0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
> +    0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
>  };

It looks like the ULL suffix should be safe today; cf,
http://stackoverflow.com/q/9606455.

It looks like its safe in c89 mode, too:

$ KERNEL_BITS=32 ./config -std=c89 && make crypto/blake2/blake2b.o
Operating system: ppc-apple-darwinDarwin Kernel Version 9.8.0: Wed Jul
15 16:57:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_PPC
Configuring for darwin-ppc-cc
...
cc -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_THREADS
-DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT
-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DVPAES_ASM
-DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\""
-DENGINESDIR="\"/usr/local/lib/engines\"" -O3 -D_REENTRANT -arch ppc
-DB_ENDIAN -Wa,-force_cpusubtype_ALL  -std=c89 -fPIC -Iinclude -I.
-Icrypto/include -MMD -MF crypto/blake2/blake2b.d.tmp -MT
crypto/blake2/blake2b.o -c -o crypto/blake2/blake2b.o
crypto/blake2/blake2b.c
$


More information about the openssl-dev mailing list