aboutsummaryrefslogtreecommitdiffstats
path: root/util/random.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-02-22 18:44:43 +0100
committerKim Alvefur <zash@zash.se>2016-02-22 18:44:43 +0100
commit6ee4f6f618ee4a07f3b25f38c7da675d68fdceee (patch)
tree212768ff3b1d64b64c32583515751108b54d7b31 /util/random.lua
parentf22342b075c527df8e4225dbbf932fe08d1155e3 (diff)
downloadprosody-6ee4f6f618ee4a07f3b25f38c7da675d68fdceee.tar.gz
prosody-6ee4f6f618ee4a07f3b25f38c7da675d68fdceee.zip
util.crand: C binding to one of OpenSSL, Linux getrandom() or OpenBSD arc4random() CSPRNG
Diffstat (limited to 'util/random.lua')
-rw-r--r--util/random.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/util/random.lua b/util/random.lua
index e4b4a700..574e2e1c 100644
--- a/util/random.lua
+++ b/util/random.lua
@@ -6,6 +6,9 @@
-- COPYING file in the source package for more information.
--
+local ok, crand = pcall(require, "util.crand");
+if ok then return crand; end
+
local urandom, urandom_err = io.open("/dev/urandom", "r");
local function seed()