Mercurial > dropbear
diff random.c @ 345:959c66ccf1b5 debug-unrandom
Remove actual randomness, to (hopefully) allow comparison between hosts
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 04 Aug 2006 17:15:05 +0000 |
parents | 36d21680a9d3 |
children | 381834084475 |
line wrap: on
line diff
--- a/random.c Thu Jul 27 01:24:39 2006 +0000 +++ b/random.c Fri Aug 04 17:15:05 2006 +0000 @@ -93,35 +93,6 @@ #endif /* read the actual random data */ - readpos = 0; - do { - if (!already_blocked) - { - int ret; - struct timeval timeout; - fd_set read_fds; - - timeout.tv_sec = 2; /* two seconds should be enough */ - timeout.tv_usec = 0; - - FD_ZERO(&read_fds); - FD_SET(readfd, &read_fds); - ret = select(readfd + 1, &read_fds, NULL, NULL, &timeout); - if (ret == 0) - { - dropbear_log(LOG_INFO, "Warning: Reading the random source seems to have blocked.\nIf you experience problems, you probably need to find a better entropy source."); - already_blocked = 1; - } - } - readlen = read(readfd, &buf[readpos], buflen - readpos); - if (readlen <= 0) { - if (readlen < 0 && errno == EINTR) { - continue; - } - dropbear_exit("error reading random source"); - } - readpos += readlen; - } while (readpos < buflen); close (readfd); } @@ -157,21 +128,14 @@ * the random pools for fork()ed processes. */ void reseedrandom() { - pid_t pid; hash_state hs; - struct timeval tv; if (!donerandinit) { dropbear_exit("seedrandom not done"); } - pid = getpid(); - gettimeofday(&tv, NULL); - sha1_init(&hs); sha1_process(&hs, (void*)hashpool, sizeof(hashpool)); - sha1_process(&hs, (void*)&pid, sizeof(pid)); - sha1_process(&hs, (void*)&tv, sizeof(tv)); sha1_done(&hs, hashpool); }