summaryrefslogtreecommitdiffstats
path: root/crypto/rand
diff options
context:
space:
mode:
authorganesh <ganeshbhambarkar@gmail.com>2016-11-10 16:46:43 +0530
committerRichard Levitte <levitte@openssl.org>2017-01-24 14:40:45 +0100
commit03f3575c39cfc81552ee05a93b856d3b69048114 (patch)
tree27157c6aff155872110b863a0753e5ae5cb4d689 /crypto/rand
parent73ff84721302f20c56090886fe1fad4cf5544da2 (diff)
Fixed the return code for RAND_egd_bytes.
According to the documentation, the return code should be -1 when RAND_status does not return 1. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1886) (cherry picked from commit 3ed93c863374125296954edcbc595599adbd07ea)
Diffstat (limited to 'crypto/rand')
-rw-r--r--crypto/rand/rand_egd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
index 5fb230fa95..f77af415c0 100644
--- a/crypto/rand/rand_egd.c
+++ b/crypto/rand/rand_egd.c
@@ -228,10 +228,10 @@ int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
int RAND_egd_bytes(const char *path, int bytes)
{
- int num, ret = 0;
+ int num, ret = -1;
num = RAND_query_egd_bytes(path, NULL, bytes);
- if (num < 1 || RAND_status() == 1)
+ if (RAND_status() == 1)
ret = num;
err:
return (ret);