summaryrefslogtreecommitdiff
path: root/regress/unittests/kex/test_kex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/kex/test_kex.c')
-rw-r--r--regress/unittests/kex/test_kex.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/regress/unittests/kex/test_kex.c b/regress/unittests/kex/test_kex.c
index a860efc02..0e7cd9e07 100644
--- a/regress/unittests/kex/test_kex.c
+++ b/regress/unittests/kex/test_kex.c
@@ -142,13 +142,15 @@ do_kex_with_key(char *kex, int keytype, int bits)
142 sshbuf_free(state); 142 sshbuf_free(state);
143 ASSERT_PTR_NE(server2->kex, NULL); 143 ASSERT_PTR_NE(server2->kex, NULL);
144 /* XXX we need to set the callbacks */ 144 /* XXX we need to set the callbacks */
145#ifdef WITH_OPENSSL
145 server2->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server; 146 server2->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server;
146 server2->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server; 147 server2->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server;
147 server2->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 148 server2->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
148 server2->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; 149 server2->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
149#ifdef OPENSSL_HAS_ECC 150#ifdef OPENSSL_HAS_ECC
150 server2->kex->kex[KEX_ECDH_SHA2] = kex_gen_server; 151 server2->kex->kex[KEX_ECDH_SHA2] = kex_gen_server;
151#endif 152#endif /* OPENSSL_HAS_ECC */
153#endif /* WITH_OPENSSL */
152 server2->kex->kex[KEX_C25519_SHA256] = kex_gen_server; 154 server2->kex->kex[KEX_C25519_SHA256] = kex_gen_server;
153 server2->kex->load_host_public_key = server->kex->load_host_public_key; 155 server2->kex->load_host_public_key = server->kex->load_host_public_key;
154 server2->kex->load_host_private_key = server->kex->load_host_private_key; 156 server2->kex->load_host_private_key = server->kex->load_host_private_key;
@@ -175,11 +177,13 @@ do_kex_with_key(char *kex, int keytype, int bits)
175static void 177static void
176do_kex(char *kex) 178do_kex(char *kex)
177{ 179{
180#ifdef WITH_OPENSSL
178 do_kex_with_key(kex, KEY_RSA, 2048); 181 do_kex_with_key(kex, KEY_RSA, 2048);
179 do_kex_with_key(kex, KEY_DSA, 1024); 182 do_kex_with_key(kex, KEY_DSA, 1024);
180#ifdef OPENSSL_HAS_ECC 183#ifdef OPENSSL_HAS_ECC
181 do_kex_with_key(kex, KEY_ECDSA, 256); 184 do_kex_with_key(kex, KEY_ECDSA, 256);
182#endif 185#endif /* OPENSSL_HAS_ECC */
186#endif /* WITH_OPENSSL */
183 do_kex_with_key(kex, KEY_ED25519, 256); 187 do_kex_with_key(kex, KEY_ED25519, 256);
184} 188}
185 189
@@ -187,13 +191,15 @@ void
187kex_tests(void) 191kex_tests(void)
188{ 192{
189 do_kex("curve25519-sha256@libssh.org"); 193 do_kex("curve25519-sha256@libssh.org");
194#ifdef WITH_OPENSSL
190#ifdef OPENSSL_HAS_ECC 195#ifdef OPENSSL_HAS_ECC
191 do_kex("ecdh-sha2-nistp256"); 196 do_kex("ecdh-sha2-nistp256");
192 do_kex("ecdh-sha2-nistp384"); 197 do_kex("ecdh-sha2-nistp384");
193 do_kex("ecdh-sha2-nistp521"); 198 do_kex("ecdh-sha2-nistp521");
194#endif 199#endif /* OPENSSL_HAS_ECC */
195 do_kex("diffie-hellman-group-exchange-sha256"); 200 do_kex("diffie-hellman-group-exchange-sha256");
196 do_kex("diffie-hellman-group-exchange-sha1"); 201 do_kex("diffie-hellman-group-exchange-sha1");
197 do_kex("diffie-hellman-group14-sha1"); 202 do_kex("diffie-hellman-group14-sha1");
198 do_kex("diffie-hellman-group1-sha1"); 203 do_kex("diffie-hellman-group1-sha1");
204#endif /* WITH_OPENSSL */
199} 205}