size_t len;
#ifdef OPENSSL_SYS_UNIX
pid_t pid;
- struct timespec ts;
+ struct timeval tv;
#elif defined(OPENSSL_SYS_WIN32)
DWORD pid;
FILETIME ft;
LARGE_INTEGER pc;
#endif
+#ifdef OPENSSL_CPUID_OBJ
uint32_t tsc = 0;
+#endif
pool = RAND_POOL_new(0, 0, max_len);
if (pool == NULL)
#endif
#ifdef OPENSSL_SYS_UNIX
- if (tsc == 0 && clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
- RAND_POOL_add(pool, (unsigned char *)&ts, sizeof(ts), 0);
- if (clock_gettime(CLOCK_REALTIME, &ts) == 0)
- RAND_POOL_add(pool, (unsigned char *)&ts, sizeof(ts), 0);
+ if (gettimeofday(&tv, NULL) == 0)
+ RAND_POOL_add(pool, (unsigned char *)&tv, sizeof(tv), 0);
#elif defined(OPENSSL_SYS_WIN32)
- if (tsc == 0 && QueryPerformanceCounter(&pc) != 0)
+ if (QueryPerformanceCounter(&pc) != 0)
RAND_POOL_add(pool, (unsigned char *)&pc, sizeof(pc), 0);
GetSystemTimeAsFileTime(&ft);
RAND_POOL_add(pool, (unsigned char *)&ft, sizeof(ft), 0);