aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-04-13 15:03:11 +0200
committerHans Nilsson <[email protected]>2017-04-13 15:03:11 +0200
commita5b52a94e67ec18f9f5c276f8387d27ab6c32c3b (patch)
tree5d7b79b729757cadfefe5f2dd994e2f207807104 /lib
parentea2c79e2c827b8339233fbb5e0b1fc9a5d02e19b (diff)
parent24cce98e38f1c8d36abb67bc7aca0668cf64c1ad (diff)
downloadotp-a5b52a94e67ec18f9f5c276f8387d27ab6c32c3b.tar.gz
otp-a5b52a94e67ec18f9f5c276f8387d27ab6c32c3b.tar.bz2
otp-a5b52a94e67ec18f9f5c276f8387d27ab6c32c3b.zip
Merge branch 'hans/ssh/crypt_rand_uniform'
Diffstat (limited to 'lib')
-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.