aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-03-22 21:56:28 +0000
committerGuilherme Andrade <[email protected]>2017-03-22 21:56:28 +0000
commitec1e5bc7ff8101b7db4fa5d67bbbed652a9238c8 (patch)
treecca4350b38e67a7dba87193740390ffa83cddb90
parent195edd9076c865f8af6a9aeeb02bc032b94c0fb3 (diff)
downloadotp-ec1e5bc7ff8101b7db4fa5d67bbbed652a9238c8.tar.gz
otp-ec1e5bc7ff8101b7db4fa5d67bbbed652a9238c8.tar.bz2
otp-ec1e5bc7ff8101b7db4fa5d67bbbed652a9238c8.zip
Allow for crypto upgrades when using rand plugin
-rw-r--r--lib/crypto/src/crypto.erl14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index ad9245f8f2..777b5cd1c6 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -32,6 +32,10 @@
-export([exor/2, strong_rand_bytes/1, mod_pow/3]).
-export([rand_seed/0]).
-export([rand_seed_s/0]).
+-export([rand_plugin_next/1]).
+-export([rand_plugin_uniform/1]).
+-export([rand_plugin_uniform/2]).
+-export([rand_plugin_jump/1]).
-export([rand_uniform/2]).
-export([block_encrypt/3, block_decrypt/3, block_encrypt/4, block_decrypt/4]).
-export([next_iv/2, next_iv/3]).
@@ -305,12 +309,12 @@ rand_seed() ->
rand:seed(rand_seed_s()).
rand_seed_s() ->
- {#{ type => crypto,
+ {#{ type => ?MODULE,
max => infinity,
- next => fun rand_plugin_next/1,
- uniform => fun rand_plugin_uniform/1,
- uniform_n => fun rand_plugin_uniform/2,
- jump => fun rand_plugin_jump/1},
+ next => fun ?MODULE:rand_plugin_next/1,
+ uniform => fun ?MODULE:rand_plugin_uniform/1,
+ uniform_n => fun ?MODULE:rand_plugin_uniform/2,
+ jump => fun ?MODULE:rand_plugin_jump/1},
no_seed}.
rand_plugin_next(Seed) ->