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) return 1; } +#elif defined RAND_GENODE +int RAND_poll(void) +{ + unsigned char buf[ENTROPY_NEEDED]; + + int fd = open("/dev/random", O_RDONLY); + if (fd == -1) { + perror("open"); + 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; +} #else /* !defined(__OpenBSD__) */ int RAND_poll(void) {