aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/test/ssh_test_lib.erl
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2016-10-28 17:57:31 +0200
committerHans Nilsson <[email protected]>2016-10-28 17:57:31 +0200
commit46bed9a80840ce658c16d6983c0b3a2548bf1a6b (patch)
treef006ce4a5a83b6dc1b447c068060e36bf9d524df /lib/ssh/test/ssh_test_lib.erl
parent284d4e244c6c4605c619cb44d807464bd5bc8f52 (diff)
downloadotp-46bed9a80840ce658c16d6983c0b3a2548bf1a6b.tar.gz
otp-46bed9a80840ce658c16d6983c0b3a2548bf1a6b.tar.bz2
otp-46bed9a80840ce658c16d6983c0b3a2548bf1a6b.zip
ssh: move rekeying test to ssh_test_lib
Diffstat (limited to 'lib/ssh/test/ssh_test_lib.erl')
-rw-r--r--lib/ssh/test/ssh_test_lib.erl17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/ssh/test/ssh_test_lib.erl b/lib/ssh/test/ssh_test_lib.erl
index 6c8fd95b2e..7cd364a6dc 100644
--- a/lib/ssh/test/ssh_test_lib.erl
+++ b/lib/ssh/test/ssh_test_lib.erl
@@ -797,3 +797,20 @@ busy_wait(Nus, T0) ->
end.
%%%----------------------------------------------------------------
+%% get_kex_init - helper function to get key_exchange_init_msg
+
+get_kex_init(Conn) ->
+ %% First, validate the key exchange is complete (StateName == connected)
+ {{connected,_},S} = sys:get_state(Conn),
+ %% Next, walk through the elements of the #state record looking
+ %% for the #ssh_msg_kexinit record. This method is robust against
+ %% changes to either record. The KEXINIT message contains a cookie
+ %% unique to each invocation of the key exchange procedure (RFC4253)
+ SL = tuple_to_list(S),
+ case lists:keyfind(ssh_msg_kexinit, 1, SL) of
+ false ->
+ throw(not_found);
+ KexInit ->
+ KexInit
+ end.
+