aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2017-01-19 21:51:59 +0100
committerHans Nilsson <[email protected]>2017-02-01 13:12:07 +0100
commit05473252a740ae40894fbd2e5ee4349db6db087c (patch)
tree9c5e9578c12df2bfc62f605f7b47680986eb400b /lib
parentc0b7998760959b02293013cc9e00599303212458 (diff)
downloadotp-05473252a740ae40894fbd2e5ee4349db6db087c.tar.gz
otp-05473252a740ae40894fbd2e5ee4349db6db087c.tar.bz2
otp-05473252a740ae40894fbd2e5ee4349db6db087c.zip
ssh: minor code unfolding
Diffstat (limited to 'lib')
-rw-r--r--lib/ssh/src/ssh_transport.erl10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/ssh/src/ssh_transport.erl b/lib/ssh/src/ssh_transport.erl
index 85ee88ce5f..02209d5dfd 100644
--- a/lib/ssh/src/ssh_transport.erl
+++ b/lib/ssh/src/ssh_transport.erl
@@ -783,9 +783,8 @@ accepted_host(Ssh, PeerName, Public, Opts) ->
yes == yes_no(Ssh, "New host " ++ PeerName ++ " accept")
end.
-known_host_key(#ssh{opts = Opts, key_cb = Mod, peer = Peer} = Ssh,
+known_host_key(#ssh{opts = Opts, key_cb = Mod, peer = {PeerName,_}} = Ssh,
Public, Alg) ->
- PeerName = peer_name(Peer),
case Mod:is_host_key(Public, PeerName, Alg, Opts) of
true ->
ok;
@@ -1631,6 +1630,8 @@ mac('hmac-sha2-256', Key, SeqNum, Data) ->
mac('hmac-sha2-512', Key, SeqNum, Data) ->
crypto:hmac(sha512, Key, [<<?UINT32(SeqNum)>>, Data]).
+
+%%%----------------------------------------------------------------
%% return N hash bytes (HASH)
hash(_SSH, _Char, 0) ->
<<>>;
@@ -1649,7 +1650,7 @@ hash(K, H, Ki, N, HashAlg) ->
Kj = crypto:hash(HashAlg, [K, H, Ki]),
hash(K, H, <<Ki/binary, Kj/binary>>, N-128, HashAlg).
-
+%%%----------------------------------------------------------------
kex_h(SSH, Key, E, F, K) ->
KeyBin = public_key:ssh_encode(Key, ssh2_pubkey),
L = <<?Estring(SSH#ssh.c_version), ?Estring(SSH#ssh.s_version),
@@ -1725,9 +1726,6 @@ mac_digest_size('AEAD_AES_128_GCM') -> 16;
mac_digest_size('AEAD_AES_256_GCM') -> 16;
mac_digest_size(none) -> 0.
-peer_name({Host, _}) ->
- Host.
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Diffie-Hellman utils