aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-04-12 19:56:12 +0200
committerHans Nilsson <[email protected]>2017-04-12 19:56:12 +0200
commit24cce98e38f1c8d36abb67bc7aca0668cf64c1ad (patch)
treeebba2d3e3d905d90058ea2be68e1c3df3f341bf2
parent19e9249d960a5b15b4e222efdcb96efbe122853e (diff)
downloadotp-24cce98e38f1c8d36abb67bc7aca0668cf64c1ad.tar.gz
otp-24cce98e38f1c8d36abb67bc7aca0668cf64c1ad.tar.bz2
otp-24cce98e38f1c8d36abb67bc7aca0668cf64c1ad.zip
ssh: replace deprecated crypto:rand_uniform
-rw-r--r--lib/ssh/src/ssh_transport.erl4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index 54ea80c727..6b47868d5c 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -181,7 +181,7 @@ ssh_vsn() ->
end.
random_id(Nlo, Nup) ->
- [crypto:rand_uniform($a,$z+1) || _<- lists:duplicate(crypto:rand_uniform(Nlo,Nup+1),x) ].
+ [$a + rand:uniform($z-$a+1) - 1 || _<- lists:duplicate(Nlo + rand:uniform(Nup-Nlo+1) - 1, x)].
hello_version_msg(Data) ->
[Data,"\r\n"].
@@ -1041,7 +1041,7 @@ padding_length(Size, #ssh{encrypt_block_size = BlockSize,
end,
PadBlockSize = max(BlockSize,4),
MaxExtraBlocks = (max(RandomLengthPadding,MinPaddingLen) - MinPaddingLen) div PadBlockSize,
- ExtraPaddingLen = try crypto:rand_uniform(0,MaxExtraBlocks)*PadBlockSize
+ ExtraPaddingLen = try (rand:uniform(MaxExtraBlocks+1) - 1) * PadBlockSize
catch _:_ -> 0
end,
MinPaddingLen + ExtraPaddingLen.