Permalink
Browse files

better crypto on user/id key

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@1247 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 4bead70 commit 3c751604cac64d387bbd9bb0ec6f5c8045aaf8df @klacke committed May 17, 2008
Showing with 12 additions and 4 deletions.
  1. +12 −4 src/yaws_ctl.erl
View
16 src/yaws_ctl.erl
@@ -54,6 +54,17 @@ run(GC) ->
run_listen(GC)
end.
+rand() ->
+ try
+ crypto:start(),
+ crypto:rand_uniform(0, 1 bsl 64)
+ catch
+ _ ->
+ {A1, A2, A3}=now(),
+ random:seed(A1, A2, A3),
+ random:uniform(1 bsl 64)
+ end.
+
ctl_args() ->
[{packet, 2},
@@ -67,10 +78,7 @@ run_listen(GC) ->
{ok, L} ->
case inet:sockname(L) of
{ok, {_, Port}} ->
- %% Need better crypto here
- {A1, A2, A3}=now(),
- random:seed(A1, A2, A3),
- Key = random:uniform(1 bsl 64),
+ Key = rand(),
case w_ctl_file(GC#gconf.id, Port, Key) of
ok ->
proc_lib:init_ack(ok),

0 comments on commit 3c75160

Please sign in to comment.