cp = (const char * const *)environ; while (*cp) { RNG_RandomUpdate(*cp, strlen(*cp)); cp++;
if (environ != NULL) { cp = environ; while (*cp) { RNG_RandomUpdate(*cp, strlen(*cp)); cp++; } RNG_RandomUpdate(environ, (char*)cp - (char*)environ);
void RNG_SystemInfoForRNG(void){    FILE *fp;    char buf[BUFSIZ];    size_t bytes;    const char * const *cp;    char *randfile;#ifdef DARWIN    char **environ = *_NSGetEnviron();#else    extern char **environ;#endif#ifdef BEOS    static const char * const files[] = {	"/boot/var/swap",	"/boot/var/log/syslog",	"/boot/var/tmp",	"/boot/home/config/settings",	"/boot/home",	0    };#else    static const char * const files[] = {	"/etc/passwd",	"/etc/utmp",	"/tmp",	"/var/tmp",	"/usr/tmp",	0    };#endif#ifdef DO_PSFor now it is considered that it is too expensive to run the ps commandfor the small amount of entropy it provides.#if defined(__sun) && (!defined(__svr4) && !defined(SVR4)) || defined(bsdi) || defined(LINUX)    static char ps_cmd[] = "ps aux";#else    static char ps_cmd[] = "ps -el";#endif#endif /* DO_PS */#if defined(BSDI)    static char netstat_ni_cmd[] = "netstat -nis";#else    static char netstat_ni_cmd[] = "netstat -ni";#endif    GiveSystemInfo();    bytes = RNG_GetNoise(buf, sizeof(buf));    RNG_RandomUpdate(buf, bytes);    /*     * Pass the C environment and the addresses of the pointers to the     * hash function. This makes the random number function depend on the     * execution environment of the user and on the platform the program     * is running on.     */    cp = (const char * const *)environ;    while (*cp) {	RNG_RandomUpdate(*cp, strlen(*cp));	cp++;    }    RNG_RandomUpdate(environ, (char*)cp - (char*)environ);    /* Give in system information */    if (gethostname(buf, sizeof(buf)) > 0) {	RNG_RandomUpdate(buf, strlen(buf));    }    GiveSystemInfo();    /* grab some data from system's PRNG before any other files. */    bytes = RNG_FileUpdate("/dev/urandom", 1024);    /* If the user points us to a random file, pass it through the rng */    randfile = getenv("NSRANDFILE");    if ( ( randfile != NULL ) && ( randfile[0] != '\0') ) {	RNG_FileForRNG(randfile);    }    /* pass other files through */    for (cp = files; *cp; cp++)	RNG_FileForRNG(*cp);/* * Bug 100447: On BSD/OS 4.2 and 4.3, we have problem calling safe_popen * in a pthreads environment.  Therefore, we call safe_popen last and on * BSD/OS we do not call safe_popen when we succeeded in getting data * from /dev/urandom. */#ifdef BSDI    if (bytes)        return;#endif#ifdef DO_PS    fp = safe_popen(ps_cmd);    if (fp != NULL) {	while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)	    RNG_RandomUpdate(buf, bytes);	safe_pclose(fp);    }#endif    fp = safe_popen(netstat_ni_cmd);    if (fp != NULL) {	while ((bytes = fread(buf, 1, sizeof(buf), fp)) > 0)	    RNG_RandomUpdate(buf, bytes);	safe_pclose(fp);    }}