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

noloader@gmail.com via RT rt at openssl.org
Sun Mar 13 11:16:02 UTC 2016


On Sun, Mar 13, 2016 at 6:57 AM, Kurt Roeckx via RT <rt at openssl.org> wrote:
> On Sun, Mar 13, 2016 at 10:30:54AM +0000, noloader at gmail.com via RT wrote:
>> crypto/blake2/blake2b.c:27: warning: integer constant is too large for
>> 'unsigned long' type
>
> That's a uint64_t.  Why do you have an "unsigned long" as 64 bit
> uint64_t?
>

Hmmm... Not sure.

Looking at the declaration:

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

$ make crypto/blake2/blake2b.o
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  -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
$

**********

For completeness...

I configured with 'KERNEL_BITS=32 ./config', but that should not
affect uint64_t. Maybe its a GCC 4.0.1 issue?

$ find /usr/include -name stdint.h
/usr/include/gcc/darwin/4.0/stdint.h
/usr/include/gcc/darwin/4.2/stdint.h
/usr/include/stdint.h

Then:

$ grep -B 2 -A2 uint64_t /usr/include/gcc/darwin/4.0/stdint.h
#ifndef _UINT64_T
#define _UINT64_T
typedef unsigned long long   uint64_t;
#endif /* _UINT64_T */
...

$ grep -B 2 -A2 uint64_t /usr/include/gcc/darwin/4.2/stdint.h
#ifndef _UINT64_T
#define _UINT64_T
typedef unsigned long long   uint64_t;
#endif /* _UINT64_T */

$ grep -B 2 -A2 uint64_t /usr/include/stdint.h
#ifndef _UINT64_T
#define _UINT64_T
typedef unsigned long long   uint64_t;
#endif /* _UINT64_T */


-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4422
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list