summaryrefslogtreecommitdiff
path: root/regress/unittests/kex/test_kex.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2015-07-10 06:23:25 +0000
committerDamien Miller <djm@mindrot.org>2015-07-15 16:04:27 +1000
commit5bf0933184cb622ca3f96d224bf3299fd2285acc (patch)
tree18ad0591b04a1ff98bb69265e04bc7c5b961533e /regress/unittests/kex/test_kex.c
parent7a6e3fd7b41dbd3756b6bf9acd67954c0b1564cc (diff)
upstream commit
Adapt tests, now that DSA if off by default; use PubkeyAcceptedKeyTypes and PubkeyAcceptedKeyTypes to test DSA. Upstream-Regress-ID: 0ff2a3ff5ac1ce5f92321d27aa07b98656efcc5c
Diffstat (limited to 'regress/unittests/kex/test_kex.c')
-rw-r--r--regress/unittests/kex/test_kex.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/regress/unittests/kex/test_kex.c b/regress/unittests/kex/test_kex.c
index c61e2bdbb..6e5999bb9 100644
--- a/regress/unittests/kex/test_kex.c
+++ b/regress/unittests/kex/test_kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: test_kex.c,v 1.1 2015/01/15 23:41:29 markus Exp $ */ 1/* $OpenBSD: test_kex.c,v 1.2 2015/07/10 06:23:25 markus Exp $ */
2/* 2/*
3 * Regress test KEX 3 * Regress test KEX
4 * 4 *
@@ -85,6 +85,7 @@ do_kex_with_key(char *kex, int keytype, int bits)
85 struct sshbuf *state; 85 struct sshbuf *state;
86 struct kex_params kex_params; 86 struct kex_params kex_params;
87 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; 87 char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT };
88 char *keyname = NULL;
88 89
89 TEST_START("sshkey_generate"); 90 TEST_START("sshkey_generate");
90 ASSERT_INT_EQ(sshkey_generate(keytype, bits, &private), 0); 91 ASSERT_INT_EQ(sshkey_generate(keytype, bits, &private), 0);
@@ -98,6 +99,9 @@ do_kex_with_key(char *kex, int keytype, int bits)
98 memcpy(kex_params.proposal, myproposal, sizeof(myproposal)); 99 memcpy(kex_params.proposal, myproposal, sizeof(myproposal));
99 if (kex != NULL) 100 if (kex != NULL)
100 kex_params.proposal[PROPOSAL_KEX_ALGS] = kex; 101 kex_params.proposal[PROPOSAL_KEX_ALGS] = kex;
102 keyname = strdup(sshkey_ssh_name(private));
103 ASSERT_PTR_NE(keyname, NULL);
104 kex_params.proposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = keyname;
101 ASSERT_INT_EQ(ssh_init(&client, 0, &kex_params), 0); 105 ASSERT_INT_EQ(ssh_init(&client, 0, &kex_params), 0);
102 ASSERT_INT_EQ(ssh_init(&server, 1, &kex_params), 0); 106 ASSERT_INT_EQ(ssh_init(&server, 1, &kex_params), 0);
103 ASSERT_PTR_NE(client, NULL); 107 ASSERT_PTR_NE(client, NULL);
@@ -167,6 +171,7 @@ do_kex_with_key(char *kex, int keytype, int bits)
167 ssh_free(client); 171 ssh_free(client);
168 ssh_free(server); 172 ssh_free(server);
169 ssh_free(server2); 173 ssh_free(server2);
174 free(keyname);
170 TEST_DONE(); 175 TEST_DONE();
171} 176}
172 177