projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add continuous RNG test to entropy source. Entropy callbacks now need
[oweals/openssl.git]
/
crypto
/
rand
/
rand_egd.c
diff --git
a/crypto/rand/rand_egd.c
b/crypto/rand/rand_egd.c
index e34f07c5e8307a8123ec646f77a167f0f85eebfa..9674219769e1f1c7228adc92acfce1fc491d776f 100644
(file)
--- a/
crypto/rand/rand_egd.c
+++ b/
crypto/rand/rand_egd.c
@@
-54,6
+54,7
@@
*
*/
*
*/
+#include <openssl/crypto.h>
#include <openssl/e_os2.h>
#include <openssl/rand.h>
#include <openssl/buffer.h>
#include <openssl/e_os2.h>
#include <openssl/rand.h>
#include <openssl/buffer.h>
@@
-95,7
+96,7
@@
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
*/
* RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
*/
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS)
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS)
|| defined(OPENSSL_SYS_BEOS)
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
return(-1);
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
{
return(-1);
@@
-216,7
+217,9
@@
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
while (numbytes != 1)
{
num = read(fd, egdbuf, 1);
while (numbytes != 1)
{
num = read(fd, egdbuf, 1);
- if (num >= 0)
+ if (num == 0)
+ goto err; /* descriptor closed */
+ else if (num > 0)
numbytes += num;
else
{
numbytes += num;
else
{
@@
-246,7
+249,9
@@
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
while (numbytes != egdbuf[0])
{
num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes);
while (numbytes != egdbuf[0])
{
num = read(fd, retrievebuf + numbytes, egdbuf[0] - numbytes);
- if (num >= 0)
+ if (num == 0)
+ goto err; /* descriptor closed */
+ else if (num > 0)
numbytes += num;
else
{
numbytes += num;
else
{