-static void
-seed_openssl_rng(void)
-{
- unsigned char buf[RANDOM_SEED_SIZE];
-
- if (!get_random_bytes(buf, sizeof(buf)))
- fatal("Entropy collection failed");
-
- RAND_add(buf, sizeof(buf), sizeof(buf));
- memset(buf, '\0', sizeof(buf));
-}
-
-#else /* USE_PRNGD */
-
-/*
- * FIXME: proper entropy estimations. All current values are guesses
- * FIXME: (ATL) do estimates at compile time?
- * FIXME: More entropy sources
- */
-
-/* slow command timeouts (all in milliseconds) */
-/* static int entropy_timeout_default = ENTROPY_TIMEOUT_MSEC; */
-static int entropy_timeout_current = ENTROPY_TIMEOUT_MSEC;
-
-typedef struct
-{
- /* Proportion of data that is entropy */
- double rate;
- /* Counter goes positive if this command times out */
- unsigned int badness;
- /* Increases by factor of two each timeout */
- unsigned int sticky_badness;
- /* Path to executable */
- char *path;
- /* argv to pass to executable */
- char *args[5];
- /* full command string (debug) */
- char *cmdstring;
-} entropy_source_t;
-
-double stir_from_system(void);
-double stir_from_programs(void);
-double stir_gettimeofday(double entropy_estimate);
-double stir_clock(double entropy_estimate);
-double stir_rusage(int who, double entropy_estimate);
-double hash_output_from_command(entropy_source_t *src, char *hash);
-
-/* this is initialised from a file, by prng_read_commands() */
-entropy_source_t *entropy_sources = NULL;
-
-double
-stir_from_system(void)
-{
- double total_entropy_estimate;
- long int i;
-
- total_entropy_estimate = 0;
-
- i = getpid();
- RAND_add(&i, sizeof(i), 0.5);
- total_entropy_estimate += 0.1;
-
- i = getppid();
- RAND_add(&i, sizeof(i), 0.5);
- total_entropy_estimate += 0.1;
-
- i = getuid();
- RAND_add(&i, sizeof(i), 0.0);
- i = getgid();
- RAND_add(&i, sizeof(i), 0.0);
-
- total_entropy_estimate += stir_gettimeofday(1.0);
- total_entropy_estimate += stir_clock(0.5);
- total_entropy_estimate += stir_rusage(RUSAGE_SELF, 2.0);
-
- return(total_entropy_estimate);
-}
-
-double
-stir_from_programs(void)