diff options
author | Richard Levitte <levitte@openssl.org> | 2001-01-08 10:59:26 +0000 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2001-01-08 10:59:26 +0000 |
commit | 0c61e299b35a0789d5de7c1972b15a82dff2f122 (patch) | |
tree | 548e4119f07dea7f70436003d196dbaca8f7830a /crypto/rand/rand_win.c | |
parent | 0b33bc65cd1bde346eae5b25d6f2d693c115b901 (diff) |
Change RAND_poll for Unix to try a number of devices and only read
them for a short period of time (actually, poll them with select(),
then read() whatever is there), which is about 10ms (hard-coded value)
each.
Separate Windows and Unixly code, and start on a VMS variant that
currently just returns 0.
Diffstat (limited to 'crypto/rand/rand_win.c')
-rw-r--r-- | crypto/rand/rand_win.c | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/crypto/rand/rand_win.c b/crypto/rand/rand_win.c index eed64e62a2..e1beef622e 100644 --- a/crypto/rand/rand_win.c +++ b/crypto/rand/rand_win.c @@ -684,53 +684,4 @@ static void readscreen(void) DeleteDC(hScrDC); } -#else /* Unix version */ - -#include <time.h> - -#ifdef NO_FP_API -# undef DEVRANDOM -#endif - -int RAND_poll(void) -{ - unsigned long l; - pid_t curr_pid = getpid(); -#ifdef DEVRANDOM - FILE *fh; -#endif - -#ifdef DEVRANDOM - /* Use a random entropy pool device. Linux, FreeBSD and OpenBSD - * have this. Use /dev/urandom if you can as /dev/random may block - * if it runs out of random entries. */ - - if ((fh = fopen(DEVRANDOM, "r")) != NULL) - { - unsigned char tmpbuf[ENTROPY_NEEDED]; - int n; - - setvbuf(fh, NULL, _IONBF, 0); - n=fread((unsigned char *)tmpbuf,1,ENTROPY_NEEDED,fh); - fclose(fh); - RAND_add(tmpbuf,sizeof tmpbuf,n); - memset(tmpbuf,0,n); - } -#endif - - /* put in some default random data, we need more than just this */ - l=curr_pid; - RAND_add(&l,sizeof(l),0); - l=getuid(); - RAND_add(&l,sizeof(l),0); - - l=time(NULL); - RAND_add(&l,sizeof(l),0); - -#ifdef DEVRANDOM - return 1; -#endif - return 0; -} - #endif |