diff options
author | Hans Nilsson <[email protected]> | 2015-08-05 22:12:18 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2015-08-29 08:40:52 +0200 |
commit | ba7b10c4fa2787e11bde6ddacc97ab90fe858484 (patch) | |
tree | 0e8f5997242dcc7a96d64c5af199ea7c5511e58a /lib/ssh/test/ssh_trpt_test_lib.erl | |
parent | b78c3b351fc955aa14bdfc3577890031ffffa9f0 (diff) | |
download | otp-ba7b10c4fa2787e11bde6ddacc97ab90fe858484.tar.gz otp-ba7b10c4fa2787e11bde6ddacc97ab90fe858484.tar.bz2 otp-ba7b10c4fa2787e11bde6ddacc97ab90fe858484.zip |
ssh: Elliptic Curve Diffie-Hellman (ECDH)
Adds ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp512
and OTP-12938
hmac-sha2-512
Diffstat (limited to 'lib/ssh/test/ssh_trpt_test_lib.erl')
-rw-r--r-- | lib/ssh/test/ssh_trpt_test_lib.erl | 20 |
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 |