random-csprng: fix compiler warnings on ARM
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Tue, 23 Dec 2014 11:33:12 +0000 (13:33 +0200)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Thu, 25 Dec 2014 09:16:50 +0000 (11:16 +0200)
* random/random-csprng.c (_gcry_rngcsprng_update_seed_file)
(read_pool): Cast keypool and rndpool to 'unsigned long *' through
'void *'.
--

Patch fixes 'cast increases required alignment' warnings seen on GCC:

random-csprng.c: In function '_gcry_rngcsprng_update_seed_file':
random-csprng.c:867:15: warning: cast increases required alignment of target type [-Wcast-align]
   for (i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
               ^
random-csprng.c:867:43: warning: cast increases required alignment of target type [-Wcast-align]
   for (i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
                                           ^
random-csprng.c: In function 'read_pool':
random-csprng.c:1023:14: warning: cast increases required alignment of target type [-Wcast-align]
   for(i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
              ^
random-csprng.c:1023:42: warning: cast increases required alignment of target type [-Wcast-align]
   for(i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
                                          ^

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
random/random-csprng.c

index 429c84f..332744b 100644 (file)
@@ -864,7 +864,7 @@ _gcry_rngcsprng_update_seed_file (void)
 
 
   /* Copy the entropy pool to a scratch pool and mix both of them. */
-  for (i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
+  for (i=0,dp=(unsigned long*)(void*)keypool, sp=(unsigned long*)(void*)rndpool;
        i < POOLWORDS; i++, dp++, sp++ )
     {
       *dp = *sp + ADD_VALUE;
@@ -1020,7 +1020,7 @@ read_pool (byte *buffer, size_t length, int level)
     }
 
   /* Create a new pool. */
-  for(i=0,dp=(unsigned long*)keypool, sp=(unsigned long*)rndpool;
+  for(i=0,dp=(unsigned long*)(void*)keypool, sp=(unsigned long*)(void*)rndpool;
       i < POOLWORDS; i++, dp++, sp++ )
     *dp = *sp + ADD_VALUE;