aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmpa_usm.erl
diff options
context:
space:
mode:
authorErland Schönbeck <[email protected]>2015-04-24 12:56:39 +0200
committerErland Schönbeck <[email protected]>2015-04-24 12:56:39 +0200
commite5228853fd16f9817bc26a82730c697fc0ecdf34 (patch)
tree401a385a01f6bdec013d6a167caaef216467309e /lib/snmp/src/agent/snmpa_usm.erl
parentc46ae84ffd858c8fa8ddb3bfbfb3607276173fb4 (diff)
downloadotp-e5228853fd16f9817bc26a82730c697fc0ecdf34.tar.gz
otp-e5228853fd16f9817bc26a82730c697fc0ecdf34.tar.bz2
otp-e5228853fd16f9817bc26a82730c697fc0ecdf34.zip
snmp: Change to random use crypto. Remove use of erlang:now
Diffstat (limited to 'lib/snmp/src/agent/snmpa_usm.erl')
-rw-r--r--lib/snmp/src/agent/snmpa_usm.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/snmp/src/agent/snmpa_usm.erl b/lib/snmp/src/agent/snmpa_usm.erl
index 719ea4e356..c571e50517 100644
--- a/lib/snmp/src/agent/snmpa_usm.erl
+++ b/lib/snmp/src/agent/snmpa_usm.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -645,8 +645,9 @@ get_des_salt() ->
ets:insert(snmp_agent_table, {usm_des_salt, 0}),
0;
_ -> % it doesn't exist, initialize
- {A1,A2,A3} = erlang:now(),
- random:seed(A1,A2,A3),
+ random:seed(erlang:phash2([node()]),
+ erlang:monotonic_time(),
+ erlang:unique_integer()),
R = random:uniform(4294967295),
ets:insert(snmp_agent_table, {usm_des_salt, R}),
R
@@ -677,8 +678,9 @@ get_aes_salt() ->
ets:insert(snmp_agent_table, {usm_aes_salt, 0}),
0;
_ -> % it doesn't exist, initialize
- {A1,A2,A3} = erlang:now(),
- random:seed(A1,A2,A3),
+ random:seed(erlang:phash2([node()]),
+ erlang:monotonic_time(),
+ erlang:unique_integer()),
R = random:uniform(36893488147419103231),
ets:insert(snmp_agent_table, {usm_aes_salt, R}),
R