aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_trpt_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2015-08-29 08:42:33 +0200
committerHans Nilsson <[email protected]>2015-08-29 08:42:33 +0200
commit4b1202b1b683a2e7a4c7a0da41d4112e255801ec (patch)
tree33db9c66d1475e6178f6138508f69ad1a1f8a40b /lib/ssh/test/ssh_trpt_test_lib.erl
parent1940bb3f4d01c8f7cc1c51af0b4fede4924191a8 (diff)
parentba7b10c4fa2787e11bde6ddacc97ab90fe858484 (diff)
downloadotp-4b1202b1b683a2e7a4c7a0da41d4112e255801ec.tar.gz
otp-4b1202b1b683a2e7a4c7a0da41d4112e255801ec.tar.bz2
otp-4b1202b1b683a2e7a4c7a0da41d4112e255801ec.zip
Merge branch 'hans/ssh/kex_ecdh/OTP-12622' into maint
* hans/ssh/kex_ecdh/OTP-12622: ssh: Elliptic Curve Diffie-Hellman (ECDH)
Diffstat (limited to 'lib/ssh/test/ssh_trpt_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_trpt_test_lib.erl20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/ssh/test/ssh_trpt_test_lib.erl b/lib/ssh/test/ssh_trpt_test_lib.erl
index 38b2789742..66df890f5c 100644
--- a/lib/ssh/test/ssh_trpt_test_lib.erl
+++ b/lib/ssh/test/ssh_trpt_test_lib.erl
@@ -533,7 +533,7 @@ receive_binary_msg(S0=#s{ssh=C0=#ssh{decrypt_block_size = BlockSize,
<<Mac:MacSize/binary, Rest/binary>> = EncRest,
case {ssh_transport:is_valid_mac(Mac, SshPacket, C2),
- catch ssh_message:decode(Payload)}
+ catch ssh_message:decode(set_prefix_if_trouble(Payload,S1))}
of
{false, _} -> fail(bad_mac,S1);
{_, {'EXIT',_}} -> fail(decode_failed,S1);
@@ -557,6 +557,24 @@ receive_binary_msg(S0=#s{ssh=C0=#ssh{decrypt_block_size = BlockSize,
end.
+set_prefix_if_trouble(Msg = <<?BYTE(Op),_/binary>>, #s{alg=#alg{kex=Kex}})
+ when Op == 30;
+ Op == 31
+ ->
+ case catch atom_to_list(Kex) of
+ "ecdh-sha2-" ++ _ ->
+ <<"ecdh",Msg/binary>>;
+ "diffie-hellman-group-exchange-" ++ _ ->
+ <<"dh_gex",Msg/binary>>;
+ "diffie-hellman-group" ++ _ ->
+ <<"dh",Msg/binary>>;
+ _ ->
+ Msg
+ end;
+set_prefix_if_trouble(Msg, _) ->
+ Msg.
+
+
receive_poll(S=#s{socket=Sock}) ->
inet:setopts(Sock, [{active,once}]),
receive