diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-11-25 10:32:35 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-11-25 21:34:20 +1100 |
commit | c5f1cc993597fed0a9013743556b1567f476c677 (patch) | |
tree | 728914225a356ac45912311c500abdfa29eb8a1f /regress/unittests | |
parent | 64988266820cc90a45a21672be9d762cbde8d34d (diff) |
upstream: unbreak tests for recent security key changes
OpenBSD-Regress-ID: 2cdf2fcae9962ca4d711338f3ceec3c1391bdf95
Diffstat (limited to 'regress/unittests')
-rw-r--r-- | regress/unittests/Makefile.inc | 5 | ||||
-rw-r--r-- | regress/unittests/authopt/Makefile | 3 | ||||
-rw-r--r-- | regress/unittests/hostkeys/Makefile | 3 | ||||
-rw-r--r-- | regress/unittests/kex/Makefile | 3 | ||||
-rw-r--r-- | regress/unittests/sshkey/Makefile | 3 | ||||
-rw-r--r-- | regress/unittests/sshkey/test_fuzz.c | 6 | ||||
-rw-r--r-- | regress/unittests/sshkey/test_sshkey.c | 8 |
7 files changed, 19 insertions, 12 deletions
diff --git a/regress/unittests/Makefile.inc b/regress/unittests/Makefile.inc index 428ef6836..370224aa5 100644 --- a/regress/unittests/Makefile.inc +++ b/regress/unittests/Makefile.inc | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile.inc,v 1.13 2018/10/17 23:28:05 djm Exp $ | 1 | # $OpenBSD: Makefile.inc,v 1.14 2019/11/25 10:32:35 djm Exp $ |
2 | 2 | ||
3 | REGRESS_FAIL_EARLY?= yes | 3 | REGRESS_FAIL_EARLY?= yes |
4 | 4 | ||
@@ -74,6 +74,9 @@ LDADD+= -lcrypto | |||
74 | DPADD+= ${LIBCRYPTO} | 74 | DPADD+= ${LIBCRYPTO} |
75 | .endif | 75 | .endif |
76 | 76 | ||
77 | LDADD+= -lfido2 -lcbor -lusbhid | ||
78 | DPADD+= ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} | ||
79 | |||
77 | UNITTEST_ARGS?= | 80 | UNITTEST_ARGS?= |
78 | 81 | ||
79 | .if (${UNITTEST_VERBOSE:L} != "no") | 82 | .if (${UNITTEST_VERBOSE:L} != "no") |
diff --git a/regress/unittests/authopt/Makefile b/regress/unittests/authopt/Makefile index 03c34222c..dfec25174 100644 --- a/regress/unittests/authopt/Makefile +++ b/regress/unittests/authopt/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.2 2019/11/01 02:06:52 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.3 2019/11/25 10:32:35 djm Exp $ |
2 | 2 | ||
3 | PROG=test_authopt | 3 | PROG=test_authopt |
4 | SRCS=tests.c | 4 | SRCS=tests.c |
@@ -13,6 +13,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c | |||
13 | SRCS+=addrmatch.c bitmap.c | 13 | SRCS+=addrmatch.c bitmap.c |
14 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c | 14 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c |
15 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c | 15 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c |
16 | SRCS+=ssh-ed25519-sk.c sk-usbhid.c | ||
16 | 17 | ||
17 | SRCS+=digest-openssl.c | 18 | SRCS+=digest-openssl.c |
18 | #SRCS+=digest-libc.c | 19 | #SRCS+=digest-libc.c |
diff --git a/regress/unittests/hostkeys/Makefile b/regress/unittests/hostkeys/Makefile index a8417bda5..e3632c43d 100644 --- a/regress/unittests/hostkeys/Makefile +++ b/regress/unittests/hostkeys/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.5 2019/11/01 02:04:25 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.6 2019/11/25 10:32:35 djm Exp $ |
2 | 2 | ||
3 | PROG=test_hostkeys | 3 | PROG=test_hostkeys |
4 | SRCS=tests.c test_iterate.c | 4 | SRCS=tests.c test_iterate.c |
@@ -11,6 +11,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c | |||
11 | SRCS+=addrmatch.c bitmap.c hostfile.c | 11 | SRCS+=addrmatch.c bitmap.c hostfile.c |
12 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c | 12 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c |
13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c | 13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c |
14 | SRCS+=ssh-ed25519-sk.c sk-usbhid.c | ||
14 | 15 | ||
15 | SRCS+=digest-openssl.c | 16 | SRCS+=digest-openssl.c |
16 | #SRCS+=digest-libc.c | 17 | #SRCS+=digest-libc.c |
diff --git a/regress/unittests/kex/Makefile b/regress/unittests/kex/Makefile index 7b55b876b..c897a7ef5 100644 --- a/regress/unittests/kex/Makefile +++ b/regress/unittests/kex/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.7 2019/11/01 02:03:27 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ |
2 | 2 | ||
3 | PROG=test_kex | 3 | PROG=test_kex |
4 | SRCS=tests.c test_kex.c | 4 | SRCS=tests.c test_kex.c |
@@ -11,6 +11,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c | |||
11 | SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c | 11 | SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c |
12 | SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c | 12 | SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c |
13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c | 13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c |
14 | SRCS+=ssh-ed25519-sk.c sk-usbhid.c | ||
14 | 15 | ||
15 | SRCS+= kex.c | 16 | SRCS+= kex.c |
16 | SRCS+= dh.c | 17 | SRCS+= dh.c |
diff --git a/regress/unittests/sshkey/Makefile b/regress/unittests/sshkey/Makefile index 54da5081d..607a6d3fd 100644 --- a/regress/unittests/sshkey/Makefile +++ b/regress/unittests/sshkey/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.7 2019/11/01 01:57:59 djm Exp $ | 1 | # $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ |
2 | 2 | ||
3 | PROG=test_sshkey | 3 | PROG=test_sshkey |
4 | SRCS=tests.c test_sshkey.c test_file.c test_fuzz.c common.c | 4 | SRCS=tests.c test_sshkey.c test_file.c test_fuzz.c common.c |
@@ -11,6 +11,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c | |||
11 | SRCS+=addrmatch.c bitmap.c | 11 | SRCS+=addrmatch.c bitmap.c |
12 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c | 12 | SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c |
13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c | 13 | SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c |
14 | SRCS+=ssh-ed25519-sk.c sk-usbhid.c | ||
14 | 15 | ||
15 | SRCS+=digest-openssl.c | 16 | SRCS+=digest-openssl.c |
16 | #SRCS+=digest-libc.c | 17 | #SRCS+=digest-libc.c |
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c index db907eb64..359811893 100644 --- a/regress/unittests/sshkey/test_fuzz.c +++ b/regress/unittests/sshkey/test_fuzz.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_fuzz.c,v 1.10 2019/11/01 01:57:59 djm Exp $ */ | 1 | /* $OpenBSD: test_fuzz.c,v 1.11 2019/11/25 10:32:35 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Fuzz tests for key parsing | 3 | * Fuzz tests for key parsing |
4 | * | 4 | * |
@@ -91,7 +91,7 @@ sig_fuzz(struct sshkey *k, const char *sig_alg) | |||
91 | sig_alg, NULL, 0), 0); | 91 | sig_alg, NULL, 0), 0); |
92 | ASSERT_SIZE_T_GT(l, 0); | 92 | ASSERT_SIZE_T_GT(l, 0); |
93 | fuzz = fuzz_begin(fuzzers, sig, l); | 93 | fuzz = fuzz_begin(fuzzers, sig, l); |
94 | ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0), 0); | 94 | ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0, NULL), 0); |
95 | free(sig); | 95 | free(sig); |
96 | TEST_ONERROR(onerror, fuzz); | 96 | TEST_ONERROR(onerror, fuzz); |
97 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { | 97 | for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { |
@@ -99,7 +99,7 @@ sig_fuzz(struct sshkey *k, const char *sig_alg) | |||
99 | if (fuzz_matches_original(fuzz)) | 99 | if (fuzz_matches_original(fuzz)) |
100 | continue; | 100 | continue; |
101 | ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz), | 101 | ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz), |
102 | c, sizeof(c), NULL, 0), 0); | 102 | c, sizeof(c), NULL, 0, NULL), 0); |
103 | } | 103 | } |
104 | fuzz_cleanup(fuzz); | 104 | fuzz_cleanup(fuzz); |
105 | } | 105 | } |
diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c index 9e0ff12e5..025bb9815 100644 --- a/regress/unittests/sshkey/test_sshkey.c +++ b/regress/unittests/sshkey/test_sshkey.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_sshkey.c,v 1.19 2019/11/01 01:57:59 djm Exp $ */ | 1 | /* $OpenBSD: test_sshkey.c,v 1.20 2019/11/25 10:32:35 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for sshkey.h key management API | 3 | * Regress test for sshkey.h key management API |
4 | * | 4 | * |
@@ -123,11 +123,11 @@ signature_test(struct sshkey *k, struct sshkey *bad, const char *sig_alg, | |||
123 | ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, sig_alg, NULL, 0), 0); | 123 | ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, sig_alg, NULL, 0), 0); |
124 | ASSERT_SIZE_T_GT(len, 8); | 124 | ASSERT_SIZE_T_GT(len, 8); |
125 | ASSERT_PTR_NE(sig, NULL); | 125 | ASSERT_PTR_NE(sig, NULL); |
126 | ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0), 0); | 126 | ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0); |
127 | ASSERT_INT_NE(sshkey_verify(bad, sig, len, d, l, NULL, 0), 0); | 127 | ASSERT_INT_NE(sshkey_verify(bad, sig, len, d, l, NULL, 0, NULL), 0); |
128 | /* Fuzz test is more comprehensive, this is just a smoke test */ | 128 | /* Fuzz test is more comprehensive, this is just a smoke test */ |
129 | sig[len - 5] ^= 0x10; | 129 | sig[len - 5] ^= 0x10; |
130 | ASSERT_INT_NE(sshkey_verify(k, sig, len, d, l, NULL, 0), 0); | 130 | ASSERT_INT_NE(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0); |
131 | free(sig); | 131 | free(sig); |
132 | } | 132 | } |
133 | 133 | ||