summaryrefslogtreecommitdiffstats
path: root/crypto/rand/rand_egd.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/rand/rand_egd.c')
-rw-r--r--crypto/rand/rand_egd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index 657a3bc5aa..5eb3225b1f 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -28,12 +28,12 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
int RAND_egd(const char *path)
{
- return (-1);
+ return -1;
}
int RAND_egd_bytes(const char *path, int bytes)
{
- return (-1);
+ return -1;
}
# else
@@ -72,12 +72,13 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
if (strlen(path) >= sizeof(addr.sun_path))
- return (-1);
+ return -1;
strcpy(addr.sun_path, path);
i = offsetof(struct sockaddr_un, sun_path) + strlen(path);
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1 || (fp = fdopen(fd, "r+")) == NULL)
- return (-1);
+ return -1;
+ setbuf(fp, NULL);
/* Try to connect */
for ( ; ; ) {
@@ -128,7 +129,7 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
goto err;
ret = numbytes;
if (mybuffer)
- RAND_seed(tempbuf, i);
+ RAND_add(tempbuf, i, i);
err:
if (fp != NULL)
@@ -150,7 +151,7 @@ int RAND_egd_bytes(const char *path, int bytes)
int RAND_egd(const char *path)
{
- return (RAND_egd_bytes(path, 255));
+ return RAND_egd_bytes(path, 255);
}
# endif