2014-08-18 12:17:57 +02:00
|
|
|
--- a/crypto/rand/rand_unix.c
|
|
|
|
+++ b/crypto/rand/rand_unix.c
|
2018-10-16 22:22:19 +02:00
|
|
|
@@ -222,6 +222,26 @@
|
|
|
|
}
|
|
|
|
return 1;
|
2014-08-18 12:17:57 +02:00
|
|
|
}
|
2018-10-16 22:22:19 +02:00
|
|
|
+# elif defined RAND_GENODE
|
2014-08-18 12:17:57 +02:00
|
|
|
+int RAND_poll(void)
|
|
|
|
+{
|
|
|
|
+ unsigned char buf[ENTROPY_NEEDED];
|
2018-02-27 08:57:34 +01:00
|
|
|
+ char const *rand_file = "/dev/random";
|
2014-08-18 12:17:57 +02:00
|
|
|
+
|
2018-02-27 08:57:34 +01:00
|
|
|
+ int fd = open(rand_file, O_RDONLY);
|
2014-08-18 12:17:57 +02:00
|
|
|
+ if (fd == -1) {
|
2018-02-27 08:57:34 +01:00
|
|
|
+ fprintf(stderr, "libcrypto: open(%s) failed with '%s'\n",
|
2018-10-16 22:22:19 +02:00
|
|
|
+ rand_file, strerror(errno));
|
2014-08-18 12:17:57 +02:00
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ read(fd, buf, sizeof(buf)); /* XXX check read */
|
|
|
|
+
|
|
|
|
+ RAND_add(buf, sizeof(buf), ENTROPY_NEEDED);
|
|
|
|
+ memset(buf, 0, sizeof(buf)); /* XXX make explicit */
|
|
|
|
+
|
|
|
|
+ return 1;
|
|
|
|
+}
|
2018-10-16 22:22:19 +02:00
|
|
|
# elif defined __OpenBSD__
|
2014-08-18 12:17:57 +02:00
|
|
|
int RAND_poll(void)
|
|
|
|
{
|