summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-08-08 18:51:17 -0400
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2018-08-08 18:51:17 -0400
commitc076dcdfcf8e69b26e44c8a71297769743eb0f4e (patch)
tree7ad6d687091592da573048d0340eace5fee84371
parentefe17de3a254ed932cd2c8f2d79fca42ec375ba6 (diff)
downloadrandom-seed-c076dcdfcf8e69b26e44c8a71297769743eb0f4e.tar.xz
random-seed-c076dcdfcf8e69b26e44c8a71297769743eb0f4e.zip
Use /dev/random instead of /dev/urandom
-rw-r--r--random-seed.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/random-seed.c b/random-seed.c
index defcd5f..385d4f5 100644
--- a/random-seed.c
+++ b/random-seed.c
@@ -240,14 +240,14 @@ static bool load(FILE *seed_file) {
credit_entropy = false;
}
- int urandom_fd = open("/dev/urandom", O_RDWR, 0);
- if (urandom_fd == -1) {
- perror("error opening /dev/urandom");
+ int random_fd = open("/dev/random", O_RDWR, 0);
+ if (random_fd == -1) {
+ perror("error opening /dev/random");
exit(5);
}
if (credit_entropy) {
- if (ioctl(urandom_fd, RNDADDENTROPY, &rpi) == -1) {
+ if (ioctl(random_fd, RNDADDENTROPY, &rpi) == -1) {
perror("ioctl(RNDADDENTROPY)");
if (errno == EPERM) {
fputs("Continuing without crediting entropy.\n", stderr);
@@ -257,8 +257,8 @@ static bool load(FILE *seed_file) {
}
if (!credit_entropy) {
- if (write(urandom_fd, &rpi.buf, RAND_POOL_SIZE) != RAND_POOL_SIZE) {
- fputs("error writing entropy to /dev/urandom\n", stderr);
+ if (write(random_fd, &rpi.buf, RAND_POOL_SIZE) != RAND_POOL_SIZE) {
+ fputs("error writing entropy to /dev/random\n", stderr);
exit(5);
}
}