Reserve for unaligned buffer. The problem was "pointed out" be HPUX64
authorAndy Polyakov <appro@openssl.org>
Sat, 24 Jan 2004 15:04:38 +0000 (15:04 +0000)
committerAndy Polyakov <appro@openssl.org>
Sat, 24 Jan 2004 15:04:38 +0000 (15:04 +0000)
gcc, which failed to compile it with "not aligned" at higher optimization
levels.

fips/rand/fips_rand.c

index 6e1fed07ccb3822433809fba32ca19abf94376ff..0ddbff6b100284f6fd86a6552c9538c407378aa9 100644 (file)
@@ -127,8 +127,8 @@ static void fips_gettime(unsigned char buf[8])
        }
     gettimeofday(&tv,NULL);
     assert(sizeof(long) == 4);
-    *(long *)&buf[0]=tv.tv_sec;
-    *(long *)&buf[4]=tv.tv_usec;
+    memcpy (&buf[0],&tv.tv_sec,4);
+    memcpy (&buf[4],&tv.tv_usec,4);
 
 #ifndef GETPID_IS_MEANINGLESS
     /* we mix in the PID to ensure that after a fork the children don't give