aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2017-10-23 16:33:28 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-12-15 12:00:49 +0100
commit110da49504e52780195a6029bac6720129434f6c (patch)
tree17e004544cdd3372e0d5efd13e19a3714b242661 /tests
parentf3754dc072df7a264c7db28a02604024f3f289b3 (diff)
downloadlibssh-110da49504e52780195a6029bac6720129434f6c.tar.gz
libssh-110da49504e52780195a6029bac6720129434f6c.tar.xz
libssh-110da49504e52780195a6029bac6720129434f6c.zip
config: support for MACs
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/torture_config.c7
-rw-r--r--tests/unittests/torture_options.c8
2 files changed, 14 insertions, 1 deletions
diff --git a/tests/unittests/torture_config.c b/tests/unittests/torture_config.c
index ec0dde53..a0b40239 100644
--- a/tests/unittests/torture_config.c
+++ b/tests/unittests/torture_config.c
@@ -15,6 +15,7 @@
#define PROXYCMD "ssh -q -W %h:%p gateway.example.com"
#define ID_FILE "/etc/xxx"
#define KEXALGORITHMS "ecdh-sha2-nistp521,diffie-hellman-group14-sha1"
+#define MACS "hmac-sha1,hmac-sha2-256"
static int setup_config_files(void **state)
{
@@ -32,7 +33,8 @@ static int setup_config_files(void **state)
"ProxyCommand "PROXYCMD"\n\n");
torture_write_file(LIBSSH_TESTCONFIG3,
"\n\nIdentityFile "ID_FILE"\n"
- "\n\nKexAlgorithms "KEXALGORITHMS"\n");
+ "\n\nKexAlgorithms "KEXALGORITHMS"\n"
+ "\n\nMACs "MACS"\n");
/* Multiple Port settings -> parsing returns early. */
torture_write_file(LIBSSH_TESTCONFIG4,
@@ -89,6 +91,9 @@ static void torture_config_from_file(void **state) {
ssh_string_free_char(v);
assert_string_equal(session->opts.wanted_methods[SSH_KEX], KEXALGORITHMS);
+
+ assert_string_equal(session->opts.wanted_methods[SSH_MAC_C_S], MACS);
+ assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C], MACS);
}
/**
diff --git a/tests/unittests/torture_options.c b/tests/unittests/torture_options.c
index 1a791d22..7e18b1d7 100644
--- a/tests/unittests/torture_options.c
+++ b/tests/unittests/torture_options.c
@@ -96,6 +96,14 @@ static void torture_options_set_macs(void **state) {
assert_true(rc == 0);
assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C], "hmac-sha1");
+ /* Test multiple known MACs */
+ rc = ssh_options_set(session,
+ SSH_OPTIONS_HMAC_S_C,
+ "hmac-sha1,hmac-sha2-256");
+ assert_true(rc == 0);
+ assert_string_equal(session->opts.wanted_methods[SSH_MAC_S_C],
+ "hmac-sha1,hmac-sha2-256");
+
/* Test unknown MACs */
rc = ssh_options_set(session, SSH_OPTIONS_HMAC_S_C, "unknown-crap@example.com,hmac-sha1,unknown@example.com");
assert_true(rc == 0);