1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

See ChangeLog: Sat Mar 20 11:53:40 CET 1999 Werner Koch

This commit is contained in:
Werner Koch 1999-03-20 10:53:39 +00:00
parent 8d255ff264
commit fb8dbdbd95
14 changed files with 118 additions and 29 deletions

View file

@ -1,3 +1,9 @@
Sat Mar 20 11:44:21 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* rndlinux.c (tty_printf) [IS_MODULE]: Removed.
* rndegd.c (gather_random): Some fixes.
Wed Mar 17 13:09:03 CET 1999 Werner Koch <wk@isil.d.shuttle.de>
* rndegd.c (do_read): New.

View file

@ -82,6 +82,7 @@ do_read( int fd, void *buf, size_t nbytes )
}
/* fixme: level 1 is not yet handled */
static int
gather_random( void (*add)(const void*, size_t, int), int requester,
@ -138,14 +139,15 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
do_restart = 1;
goto restart;
}
if( !n ) {
g10_log_error("bad EGD reply: too short\n");
do_restart = 1;
goto restart;
}
if( n > 1 ) {
n--;
(*add)( buffer+1, n, requester );
n = buffer[0];
if( n ) {
n = do_read( fd, buffer, n );
if( n == -1 ) {
g10_log_error("read error on EGD: %s\n", strerror(errno));
do_restart = 1;
goto restart;
}
(*add)( buffer, n, requester );
length -= n;
}
@ -172,11 +174,6 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
do_restart = 1;
goto restart;
}
if( n != nbytes ) {
g10_log_error("bad EGD reply: too short %d/%d\n", nbytes, n );
do_restart = 1;
goto restart;
}
(*add)( buffer, n, requester );
length -= n;
}

View file

@ -48,14 +48,6 @@ static int open_device( const char *name, int minor );
static int gather_random( void (*add)(const void*, size_t, int), int requester,
size_t length, int level );
#ifdef IS_MODULE
static void tty_printf(const char *fmt, ... )
{
g10_log_info("tty_printf not available (%s)\n", fmt );
}
#endif
/****************
* Used to open the Linux and xBSD /dev/random devices
@ -110,15 +102,24 @@ gather_random( void (*add)(const void*, size_t, int), int requester,
tv.tv_usec = 0;
if( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) {
if( !warn )
tty_printf( _(
"\n"
#ifdef IS_MODULE
fprintf(stderr,
#else
tty_printf(
#endif
_("\n"
"Not enough random bytes available. Please do some other work to give\n"
"the OS a chance to collect more entropy! (Need %d more bytes)\n"), length );
warn = 1;
continue;
}
else if( rc == -1 ) {
tty_printf("select() error: %s\n", strerror(errno));
#ifdef IS_MODULE
fprintf(stderr,
#else
tty_printf(
#endif
"select() error: %s\n", strerror(errno));
continue;
}