summaryrefslogtreecommitdiff
path: root/lib/crypto
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-10-07 11:37:10 -0700
committerOri Bernstein <ori@eigenstate.org>2018-10-07 11:37:44 -0700
commit954b2fd7a8a0a65a077b61a5932ed54d3e3ef6a5 (patch)
treea7b5c03808d36c6370543cf40bdb0a481e4abc71 /lib/crypto
parentf6eb57283f625cbd20d5bb423331e88ddc82c8f1 (diff)
downloadmc-954b2fd7a8a0a65a077b61a5932ed54d3e3ef6a5.tar.gz
Try /dev/urandom before /dev/random.
Speeds things up on Linux.
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/entropy.myr5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/crypto/entropy.myr b/lib/crypto/entropy.myr
index 8120791..b2e8ea9 100644
--- a/lib/crypto/entropy.myr
+++ b/lib/crypto/entropy.myr
@@ -7,7 +7,10 @@ pkg crypto =
var randfd
const __init__ = {
- randfd = std.try(std.open("/dev/random", std.Oread))
+ match std.open("/dev/urandom", std.Oread)
+ | `std.Ok fd: randfd = fd
+ | `std.Err e: randfd = std.try(std.open("/dev/random", std.Oread))
+ ;;
}
const getentropy = {buf