From ec1e5bc7ff8101b7db4fa5d67bbbed652a9238c8 Mon Sep 17 00:00:00 2001 From: Guilherme Andrade Date: Wed, 22 Mar 2017 21:56:28 +0000 Subject: Allow for crypto upgrades when using rand plugin --- lib/crypto/src/crypto.erl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'lib/crypto/src') 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) -> -- cgit v1.2.3