summaryrefslogtreecommitdiff
path: root/regress/unittests/kex
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/kex')
-rw-r--r--regress/unittests/kex/Makefile21
-rw-r--r--regress/unittests/kex/test_kex.c13
2 files changed, 20 insertions, 14 deletions
diff --git a/regress/unittests/kex/Makefile b/regress/unittests/kex/Makefile
index 5c61307a3..7b4c644e5 100644
--- a/regress/unittests/kex/Makefile
+++ b/regress/unittests/kex/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.5 2017/12/21 00:41:22 djm Exp $ 1# $OpenBSD: Makefile,v 1.6 2019/01/21 12:35:20 djm Exp $
2 2
3PROG=test_kex 3PROG=test_kex
4SRCS=tests.c test_kex.c 4SRCS=tests.c test_kex.c
@@ -9,12 +9,21 @@ SRCS+=atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c ssh-dss.c
9SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c 9SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c
10SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c 10SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c
11SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c 11SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c
12SRCS+=kex.c kexc25519.c kexc25519c.c kexc25519s.c kexdh.c kexdhc.c kexdhs.c 12SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c
13SRCS+=kexecdh.c kexecdhc.c kexecdhs.c kexgex.c kexgexc.c kexgexs.c
14SRCS+=dh.c compat.c
15SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c
16SRCS+=cipher-chachapoly.c chacha.c poly1305.c 13SRCS+=cipher-chachapoly.c chacha.c poly1305.c
17SRCS+=smult_curve25519_ref.c 14
15SRCS+= kex.c
16SRCS+= dh.c
17SRCS+= kexdh.c
18SRCS+= kexecdh.c
19SRCS+= kexgex.c
20SRCS+= kexgexc.c
21SRCS+= kexgexs.c
22SRCS+= kexc25519.c
23SRCS+= smult_curve25519_ref.c
24SRCS+= kexgen.c
25SRCS+= kexsntrup4591761x25519.c
26SRCS+= sntrup4591761.c
18 27
19SRCS+=digest-openssl.c 28SRCS+=digest-openssl.c
20#SRCS+=digest-libc.c 29#SRCS+=digest-libc.c
diff --git a/regress/unittests/kex/test_kex.c b/regress/unittests/kex/test_kex.c
index 6e5999bb9..a860efc02 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.2 2015/07/10 06:23:25 markus Exp $ */ 1/* $OpenBSD: test_kex.c,v 1.4 2019/01/21 12:35:20 djm Exp $ */
2/* 2/*
3 * Regress test KEX 3 * Regress test KEX
4 * 4 *
@@ -24,8 +24,6 @@
24#include "packet.h" 24#include "packet.h"
25#include "myproposal.h" 25#include "myproposal.h"
26 26
27struct ssh *active_state = NULL; /* XXX - needed for linking */
28
29void kex_tests(void); 27void kex_tests(void);
30static int do_debug = 0; 28static int do_debug = 0;
31 29
@@ -139,20 +137,19 @@ do_kex_with_key(char *kex, int keytype, int bits)
139 ASSERT_INT_EQ(ssh_init(&server2, 1, NULL), 0); 137 ASSERT_INT_EQ(ssh_init(&server2, 1, NULL), 0);
140 ASSERT_PTR_NE(server2, NULL); 138 ASSERT_PTR_NE(server2, NULL);
141 ASSERT_INT_EQ(ssh_add_hostkey(server2, private), 0); 139 ASSERT_INT_EQ(ssh_add_hostkey(server2, private), 0);
142 kex_free(server2->kex); /* XXX or should ssh_packet_set_state()? */
143 ASSERT_INT_EQ(ssh_packet_set_state(server2, state), 0); 140 ASSERT_INT_EQ(ssh_packet_set_state(server2, state), 0);
144 ASSERT_INT_EQ(sshbuf_len(state), 0); 141 ASSERT_INT_EQ(sshbuf_len(state), 0);
145 sshbuf_free(state); 142 sshbuf_free(state);
146 ASSERT_PTR_NE(server2->kex, NULL); 143 ASSERT_PTR_NE(server2->kex, NULL);
147 /* XXX we need to set the callbacks */ 144 /* XXX we need to set the callbacks */
148 server2->kex->kex[KEX_DH_GRP1_SHA1] = kexdh_server; 145 server2->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server;
149 server2->kex->kex[KEX_DH_GRP14_SHA1] = kexdh_server; 146 server2->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server;
150 server2->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; 147 server2->kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
151 server2->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; 148 server2->kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
152#ifdef OPENSSL_HAS_ECC 149#ifdef OPENSSL_HAS_ECC
153 server2->kex->kex[KEX_ECDH_SHA2] = kexecdh_server; 150 server2->kex->kex[KEX_ECDH_SHA2] = kex_gen_server;
154#endif 151#endif
155 server2->kex->kex[KEX_C25519_SHA256] = kexc25519_server; 152 server2->kex->kex[KEX_C25519_SHA256] = kex_gen_server;
156 server2->kex->load_host_public_key = server->kex->load_host_public_key; 153 server2->kex->load_host_public_key = server->kex->load_host_public_key;
157 server2->kex->load_host_private_key = server->kex->load_host_private_key; 154 server2->kex->load_host_private_key = server->kex->load_host_private_key;
158 server2->kex->sign = server->kex->sign; 155 server2->kex->sign = server->kex->sign;