aboutsummaryrefslogtreecommitdiffstats
path: root/cipher/rndegd.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1999-03-20 10:53:39 +0000
committerWerner Koch <[email protected]>1999-03-20 10:53:39 +0000
commitfb8dbdbd95ecad16676ae717df38e06e0a1e40ec (patch)
treee2cdda28c57d62deef9fb87981cc1b49f064a4c3 /cipher/rndegd.c
parentSee ChangeLog: Wed Mar 17 13:09:03 CET 1999 Werner Koch (diff)
downloadgnupg-fb8dbdbd95ecad16676ae717df38e06e0a1e40ec.tar.gz
gnupg-fb8dbdbd95ecad16676ae717df38e06e0a1e40ec.zip
See ChangeLog: Sat Mar 20 11:53:40 CET 1999 Werner Koch
Diffstat (limited to 'cipher/rndegd.c')
-rw-r--r--cipher/rndegd.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/cipher/rndegd.c b/cipher/rndegd.c
index 0777ff859..7fc1f494c 100644
--- a/cipher/rndegd.c
+++ b/cipher/rndegd.c
@@ -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;
}