From 5dc2ac2aacfd9ec05d04857bc01aa6e6a4528938 Mon Sep 17 00:00:00 2001 From: Yanis Kurganov Date: Fri, 23 Jan 2015 11:49:02 +0300 Subject: [PATCH] tests: Add torture_algorithms_dh_gex test. Signed-off-by: Yanis Kurganov --- tests/client/torture_algorithms.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/client/torture_algorithms.c b/tests/client/torture_algorithms.c index 8a46638..12edaee 100644 --- a/tests/client/torture_algorithms.c +++ b/tests/client/torture_algorithms.c @@ -267,14 +267,13 @@ static void torture_algorithms_ecdh_sha2_nistp256(void **state) { } #endif -static void torture_algorithms_dh_group1(void **state) { - ssh_session session = *state; +static void test_dh(ssh_session session, const char *algo) { int rc; rc = ssh_options_set(session,SSH_OPTIONS_HOST,"localhost"); assert_true(rc == SSH_OK); - rc = ssh_options_set(session, SSH_OPTIONS_KEY_EXCHANGE, "diffie-hellman-group1-sha1"); + rc = ssh_options_set(session, SSH_OPTIONS_KEY_EXCHANGE, algo); assert_true(rc == SSH_OK); rc = ssh_connect(session); @@ -287,6 +286,15 @@ static void torture_algorithms_dh_group1(void **state) { ssh_disconnect(session); } + +static void torture_algorithms_dh_group1(void **state) { + test_dh(*state, "diffie-hellman-group1-sha1"); +} + +static void torture_algorithms_dh_gex(void **state) { + test_dh(*state, "diffie-hellman-group-exchange-sha1"); +} + int torture_run_tests(void) { int rc; const UnitTest tests[] = { @@ -317,6 +325,7 @@ int torture_run_tests(void) { unit_test_setup_teardown(torture_algorithms_zlib, setup, teardown), unit_test_setup_teardown(torture_algorithms_zlib_openssh, setup, teardown), unit_test_setup_teardown(torture_algorithms_dh_group1,setup,teardown), + unit_test_setup_teardown(torture_algorithms_dh_gex,setup,teardown), #if defined(HAVE_LIBCRYPTO) && defined(HAVE_ECC) unit_test_setup_teardown(torture_algorithms_ecdh_sha2_nistp256,setup,teardown) #endif -- 1.9.5.msysgit.0