From fea217f96f1396ee83341f596ecc083f6a91dfbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ulf=20M=C3=B6ller?= Date: Fri, 25 Feb 2000 14:16:43 +0000 Subject: [PATCH] EGD bugfix. Submitted by: Lutz Jaenicke --- apps/app_rand.c | 6 ++++-- crypto/rand/rand_egd.c | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/app_rand.c b/apps/app_rand.c index ea35bf9b1d..f7f133831d 100644 --- a/apps/app_rand.c +++ b/apps/app_rand.c @@ -162,7 +162,8 @@ long app_RAND_load_files(char *name) char *p,*n; int last; long tot=0; - + int egd; + for (;;) { last=0; @@ -173,7 +174,8 @@ long app_RAND_load_files(char *name) name=p+1; if (*n == '\0') break; - tot+=RAND_egd(n); + egd=RAND_egd(n); + if (egd > 0) tot+=egd; tot+=RAND_load_file(n,1024L*1024L); if (last) break; } diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c index 3a081d4f62..b640469faf 100644 --- a/crypto/rand/rand_egd.c +++ b/crypto/rand/rand_egd.c @@ -96,6 +96,7 @@ int RAND_egd(const char *path) buf[1] = 255; write(fd, buf, 2); if (read(fd, buf, 1) != 1) goto err; + if (buf[0] == 0) goto err; num = read(fd, buf, 255); if (num < 1) goto err; RAND_seed(buf, num); -- 2.25.1