From 31da8025b2a138be823194866581741c568f44fe Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Tue, 6 Nov 2018 16:39:08 +0100 Subject: [PATCH] tests: Add dh-group-exchange algorithm tests Signed-off-by: Aris Adamantiadis Reviewed-by: Jakub Jelen Reviewed-by: Andreas Schneider --- tests/client/torture_algorithms.c | 26 ++++++++++++++++++++++++++ tests/torture.c | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/client/torture_algorithms.c b/tests/client/torture_algorithms.c index d327d046..097e3c3c 100644 --- a/tests/client/torture_algorithms.c +++ b/tests/client/torture_algorithms.c @@ -438,6 +438,26 @@ static void torture_algorithms_dh_group18(void **state) { test_algorithm(s->ssh.session, "diffie-hellman-group18-sha512", NULL/*cipher*/, NULL/*hmac*/); } +static void torture_algorithms_dh_gex_sha1(void **state) +{ + struct torture_state *s = *state; + + test_algorithm(s->ssh.session, + "diffie-hellman-group-exchange-sha1", + NULL, /* cipher */ + NULL); /* hmac */ +} + +static void torture_algorithms_dh_gex_sha256(void **state) +{ + struct torture_state *s = *state; + + test_algorithm(s->ssh.session, + "diffie-hellman-group-exchange-sha256", + NULL, /* cipher */ + NULL); /* hmac */ +} + int torture_run_tests(void) { int rc; struct CMUnitTest tests[] = { @@ -544,6 +564,12 @@ int torture_run_tests(void) { cmocka_unit_test_setup_teardown(torture_algorithms_dh_group18, session_setup, session_teardown), + cmocka_unit_test_setup_teardown(torture_algorithms_dh_gex_sha1, + session_setup, + session_teardown), + cmocka_unit_test_setup_teardown(torture_algorithms_dh_gex_sha256, + session_setup, + session_teardown), #if ((OPENSSH_VERSION_MAJOR == 7 && OPENSSH_VERSION_MINOR >= 3) || OPENSSH_VERSION_MAJOR > 7) cmocka_unit_test_setup_teardown(torture_algorithms_ecdh_curve25519_sha256, session_setup, diff --git a/tests/torture.c b/tests/torture.c index fb6eb05f..73ef8faf 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -626,7 +626,8 @@ static void torture_setup_create_sshd_config(void **state, bool pam) # else /* OPENSSH_VERSION 7.0 - 7.5 */ "Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc\n" # endif /* OPENSSH_VERSION 7.0 - 7.6 */ - "KexAlgorithms +diffie-hellman-group1-sha1" + "KexAlgorithms +diffie-hellman-group1-sha1," + "diffie-hellman-group-exchange-sha1" #else /* OPENSSH_VERSION >= 6.7 */ "Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr," "aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,"