-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(const char *path, const char **args, char *hash);
-
-typedef struct
-{
- /* Proportion of data that is entropy */
- double rate;
- /* Path to executable */
- const char *path;
- /* argv to pass to executable */
- const char *args[5];
-} entropy_source_t;
-
-entropy_source_t entropy_sources[] = {
-#ifdef PROG_LS
- { 0.002, PROG_LS, { "ls", "-alni", "/var/log", NULL } },
- { 0.002, PROG_LS, { "ls", "-alni", "/var/adm", NULL } },
- { 0.002, PROG_LS, { "ls", "-alni", "/var/mail", NULL } },
- { 0.002, PROG_LS, { "ls", "-alni", "/var/spool/mail", NULL } },
- { 0.002, PROG_LS, { "ls", "-alni", "/proc", NULL } },
- { 0.002, PROG_LS, { "ls", "-alni", "/tmp", NULL } },
-#endif
-#ifdef PROG_NETSTAT
- { 0.005, PROG_NETSTAT, { "netstat","-an", NULL, NULL } },
- { 0.010, PROG_NETSTAT, { "netstat","-in", NULL, NULL } },
- { 0.002, PROG_NETSTAT, { "netstat","-rn", NULL, NULL } },
- { 0.002, PROG_NETSTAT, { "netstat","-s", NULL, NULL } },
-#endif
-#ifdef PROG_ARP
- { 0.002, PROG_ARP, { "arp","-a","-n", NULL } },
-#endif
-#ifdef PROG_IFCONFIG
- { 0.002, PROG_IFCONFIG, { "ifconfig", "-a", NULL, NULL } },
-#endif
-#ifdef PROG_PS
- { 0.003, PROG_PS, { "ps", "laxww", NULL, NULL } },
- { 0.003, PROG_PS, { "ps", "-al", NULL, NULL } },
- { 0.003, PROG_PS, { "ps", "-efl", NULL, NULL } },
-#endif
-#ifdef PROG_W
- { 0.005, PROG_W, { "w", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_WHO
- { 0.001, PROG_WHO, { "who","-i", NULL, NULL } },
-#endif
-#ifdef PROG_LAST
- { 0.001, PROG_LAST, { "last", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_LASTLOG
- { 0.001, PROG_LASTLOG, { "lastlog", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_DF
- { 0.010, PROG_DF, { "df", NULL, NULL, NULL } },
- { 0.010, PROG_DF, { "df", "-i", NULL, NULL } },
-#endif
-#ifdef PROG_VMSTAT
- { 0.010, PROG_VMSTAT, { "vmstat", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_UPTIME
- { 0.001, PROG_UPTIME, { "uptime", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_IPCS
- { 0.001, PROG_IPCS, { "-a", NULL, NULL, NULL } },
-#endif
-#ifdef PROG_TAIL
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/log/messages", NULL, NULL } },
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/log/syslog", NULL, NULL } },
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/adm/messages", NULL, NULL } },
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/adm/syslog", NULL, NULL } },
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/log/maillog", NULL, NULL } },
- { 0.001, PROG_TAIL, { "tail", "-200", "/var/adm/maillog", NULL, NULL } },
-#endif
- { 0.000, NULL, { NULL, NULL, NULL, NULL, 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.1);
- total_entropy_estimate += 0.1;
-
- i = getppid();
- RAND_add(&i, sizeof(i), 0.1);
- 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.2);
- total_entropy_estimate += stir_rusage(RUSAGE_SELF, 2.0);
-
- return(total_entropy_estimate);
-}
-
-double
-stir_from_programs(void)