openssl: clarify error message on missing /dev/random

This commit is contained in:
Christian Helmuth 2018-02-27 08:57:34 +01:00
parent d72517e673
commit e3d1b8b044
2 changed files with 6 additions and 6 deletions

View File

@ -1 +1 @@
473ec42d97b8880c2f88ea9bb439eb114e096fd5
951ddf41bbf07a2dbf682bbe22934de498f82d4d

View File

@ -1,8 +1,6 @@
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
index e3a6557..27b26e4 100644
--- a/crypto/rand/rand_unix.c
+++ b/crypto/rand/rand_unix.c
@@ -233,6 +233,24 @@ int RAND_poll(void)
@@ -233,6 +233,26 @@
return 1;
}
@ -10,10 +8,12 @@ index e3a6557..27b26e4 100644
+int RAND_poll(void)
+{
+ unsigned char buf[ENTROPY_NEEDED];
+ char const *rand_file = "/dev/random";
+
+ int fd = open("/dev/random", O_RDONLY);
+ int fd = open(rand_file, O_RDONLY);
+ if (fd == -1) {
+ perror("open");
+ fprintf(stderr, "libcrypto: open(%s) failed with '%s'\n",
+ rand_file, strerror(errno));
+ return 0;
+ }
+