summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rand/rand_egd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rand/rand_egd.c')
-rw-r--r--src/lib/libcrypto/rand/rand_egd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libcrypto/rand/rand_egd.c b/src/lib/libcrypto/rand/rand_egd.c
index 6f742900a0..cd666abfcb 100644
--- a/src/lib/libcrypto/rand/rand_egd.c
+++ b/src/lib/libcrypto/rand/rand_egd.c
@@ -95,7 +95,7 @@
95 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. 95 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
96 */ 96 */
97 97
98#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) 98#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_VOS)
99int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) 99int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
100 { 100 {
101 return(-1); 101 return(-1);
@@ -216,7 +216,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
216 while (numbytes != 1) 216 while (numbytes != 1)
217 { 217 {
218 num = read(fd, egdbuf, 1); 218 num = read(fd, egdbuf, 1);
219 if (num >= 0) 219 if (num == 0)
220 goto err; /* descriptor closed */
221 else if (num > 0)
220 numbytes += num; 222 numbytes += num;
221 else 223 else
222 { 224 {
@@ -246,7 +248,9 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
246 while (numbytes != egdbuf[0]) 248 while (numbytes != egdbuf[0])
247 { 249 {
248 num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes); 250 num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes);
249 if (num >= 0) 251 if (num == 0)
252 goto err; /* descriptor closed */
253 else if (num > 0)
250 numbytes += num; 254 numbytes += num;
251 else 255 else
252 { 256 {