aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/random.c
diff options
context:
space:
mode:
authorDavid Shaw <[email protected]>2003-05-15 05:29:05 +0000
committerDavid Shaw <[email protected]>2003-05-15 05:29:05 +0000
commit0048ebcbaeb754a3920cfe6ee01f16e96a54b328 (patch)
tree3c8699061e8549cf8efdf2b2be789ec072d2679f /cipher/random.c
parent* types.h: Add initializer macros for 64-bit unsigned type. (diff)
downloadgnupg-0048ebcbaeb754a3920cfe6ee01f16e96a54b328.tar.gz
gnupg-0048ebcbaeb754a3920cfe6ee01f16e96a54b328.zip
* cipher.c (setup_cipher_table): #ifdef IDEA.
* random.c (fast_random_poll): Only use times() if we HAVE_TIMES. * sha512.c, tiger.c: Use the U64_C() macro to specify 64-bit constants. U64_C is defined in include/types.h and uses the correct suffix depending on the underlying type of u64. * idea-stub.c (load_module): Catch an error if the idea module file is unloadable for some reason (unreadable, bad permissions, etc.) * md.c (string_to_digest_algo): Give a warning about TIGER192 not being part of OpenPGP.
Diffstat (limited to 'cipher/random.c')
-rw-r--r--cipher/random.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cipher/random.c b/cipher/random.c
index 8b750a7ff..95d30a77d 100644
--- a/cipher/random.c
+++ b/cipher/random.c
@@ -38,12 +38,15 @@
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
-#ifdef HAVE_GETHRTIME
+#ifdef HAVE_GETHRTIME
#include <sys/times.h>
#endif
#ifdef HAVE_GETTIMEOFDAY
#include <sys/times.h>
#endif
+#ifdef HAVE_TIMES
+ #include <sys/times.h>
+#endif
#ifdef HAVE_GETRUSAGE
#include <sys/resource.h>
#endif
@@ -650,13 +653,12 @@ fast_random_poll()
add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), 1 );
add_randomness( &tv.tv_nsec, sizeof(tv.tv_nsec), 1 );
}
- #else /* use times */
- #ifndef HAVE_DOSISH_SYSTEM
+ #elif defined (HAVE_TIMES)
{ struct tms buf;
- times( &buf );
+ if( times( &buf ) == -1 )
+ BUG();
add_randomness( &buf, sizeof buf, 1 );
}
- #endif
#endif
#ifdef HAVE_GETRUSAGE
#ifndef RUSAGE_SELF