From 02275afa1ecbfbd39f27d34c97090e76bec232ec Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 1 Nov 2019 02:03:27 +0000 Subject: upstream: additional source files here too OpenBSD-Regress-ID: 09297e484327f911fd353489518cceaa0c1b95ce --- regress/unittests/kex/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'regress/unittests/kex/Makefile') diff --git a/regress/unittests/kex/Makefile b/regress/unittests/kex/Makefile index 7b4c644e5..7b55b876b 100644 --- a/regress/unittests/kex/Makefile +++ b/regress/unittests/kex/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2019/01/21 12:35:20 djm Exp $ +# $OpenBSD: Makefile,v 1.7 2019/11/01 02:03:27 djm Exp $ PROG=test_kex SRCS=tests.c test_kex.c @@ -10,7 +10,7 @@ SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c -SRCS+=cipher-chachapoly.c chacha.c poly1305.c +SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c SRCS+= kex.c SRCS+= dh.c -- cgit v1.2.3 From c5f1cc993597fed0a9013743556b1567f476c677 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Mon, 25 Nov 2019 10:32:35 +0000 Subject: upstream: unbreak tests for recent security key changes OpenBSD-Regress-ID: 2cdf2fcae9962ca4d711338f3ceec3c1391bdf95 --- regress/unittests/Makefile.inc | 5 ++++- regress/unittests/authopt/Makefile | 3 ++- regress/unittests/hostkeys/Makefile | 3 ++- regress/unittests/kex/Makefile | 3 ++- regress/unittests/sshkey/Makefile | 3 ++- regress/unittests/sshkey/test_fuzz.c | 6 +++--- regress/unittests/sshkey/test_sshkey.c | 8 ++++---- 7 files changed, 19 insertions(+), 12 deletions(-) (limited to 'regress/unittests/kex/Makefile') 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 @@ -# $OpenBSD: Makefile.inc,v 1.13 2018/10/17 23:28:05 djm Exp $ +# $OpenBSD: Makefile.inc,v 1.14 2019/11/25 10:32:35 djm Exp $ REGRESS_FAIL_EARLY?= yes @@ -74,6 +74,9 @@ LDADD+= -lcrypto DPADD+= ${LIBCRYPTO} .endif +LDADD+= -lfido2 -lcbor -lusbhid +DPADD+= ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} + UNITTEST_ARGS?= .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 @@ -# $OpenBSD: Makefile,v 1.2 2019/11/01 02:06:52 djm Exp $ +# $OpenBSD: Makefile,v 1.3 2019/11/25 10:32:35 djm Exp $ PROG=test_authopt SRCS=tests.c @@ -13,6 +13,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c +SRCS+=ssh-ed25519-sk.c sk-usbhid.c SRCS+=digest-openssl.c #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 @@ -# $OpenBSD: Makefile,v 1.5 2019/11/01 02:04:25 djm Exp $ +# $OpenBSD: Makefile,v 1.6 2019/11/25 10:32:35 djm Exp $ PROG=test_hostkeys 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 SRCS+=addrmatch.c bitmap.c hostfile.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c +SRCS+=ssh-ed25519-sk.c sk-usbhid.c SRCS+=digest-openssl.c #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 @@ -# $OpenBSD: Makefile,v 1.7 2019/11/01 02:03:27 djm Exp $ +# $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ PROG=test_kex 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 SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c +SRCS+=ssh-ed25519-sk.c sk-usbhid.c SRCS+= kex.c 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 @@ -# $OpenBSD: Makefile,v 1.7 2019/11/01 01:57:59 djm Exp $ +# $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ PROG=test_sshkey 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 SRCS+=addrmatch.c bitmap.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c SRCS+=cipher-chachapoly.c chacha.c poly1305.c ssh-ecdsa-sk.c ssh-sk.c +SRCS+=ssh-ed25519-sk.c sk-usbhid.c SRCS+=digest-openssl.c #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 @@ -/* $OpenBSD: test_fuzz.c,v 1.10 2019/11/01 01:57:59 djm Exp $ */ +/* $OpenBSD: test_fuzz.c,v 1.11 2019/11/25 10:32:35 djm Exp $ */ /* * Fuzz tests for key parsing * @@ -91,7 +91,7 @@ sig_fuzz(struct sshkey *k, const char *sig_alg) sig_alg, NULL, 0), 0); ASSERT_SIZE_T_GT(l, 0); fuzz = fuzz_begin(fuzzers, sig, l); - ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0), 0); + ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0, NULL), 0); free(sig); TEST_ONERROR(onerror, fuzz); for(; !fuzz_done(fuzz); fuzz_next(fuzz)) { @@ -99,7 +99,7 @@ sig_fuzz(struct sshkey *k, const char *sig_alg) if (fuzz_matches_original(fuzz)) continue; ASSERT_INT_NE(sshkey_verify(k, fuzz_ptr(fuzz), fuzz_len(fuzz), - c, sizeof(c), NULL, 0), 0); + c, sizeof(c), NULL, 0, NULL), 0); } fuzz_cleanup(fuzz); } 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 @@ -/* $OpenBSD: test_sshkey.c,v 1.19 2019/11/01 01:57:59 djm Exp $ */ +/* $OpenBSD: test_sshkey.c,v 1.20 2019/11/25 10:32:35 djm Exp $ */ /* * Regress test for sshkey.h key management API * @@ -123,11 +123,11 @@ signature_test(struct sshkey *k, struct sshkey *bad, const char *sig_alg, ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, sig_alg, NULL, 0), 0); ASSERT_SIZE_T_GT(len, 8); ASSERT_PTR_NE(sig, NULL); - ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0), 0); - ASSERT_INT_NE(sshkey_verify(bad, sig, len, d, l, NULL, 0), 0); + ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0); + ASSERT_INT_NE(sshkey_verify(bad, sig, len, d, l, NULL, 0, NULL), 0); /* Fuzz test is more comprehensive, this is just a smoke test */ sig[len - 5] ^= 0x10; - ASSERT_INT_NE(sshkey_verify(k, sig, len, d, l, NULL, 0), 0); + ASSERT_INT_NE(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0); free(sig); } -- cgit v1.2.3 From f73ab8a811bc874c2fb403012aa8e4bfdcaf5ec7 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Sun, 26 Jan 2020 00:09:50 +0000 Subject: upstream: unbreak unittests for recent API / source file changes OpenBSD-Regress-ID: 075a899a01bbf7781d38bf0b33d8366faaf6d3c0 --- regress/misc/kexfuzz/Makefile | 4 ++-- regress/misc/kexfuzz/kexfuzz.c | 8 ++------ regress/unittests/authopt/Makefile | 6 +++--- regress/unittests/hostkeys/Makefile | 6 +++--- regress/unittests/kex/Makefile | 6 +++--- regress/unittests/sshbuf/Makefile | 4 ++-- regress/unittests/sshkey/Makefile | 6 +++--- regress/unittests/sshkey/common.c | 11 ++++------- 8 files changed, 22 insertions(+), 29 deletions(-) (limited to 'regress/unittests/kex/Makefile') diff --git a/regress/misc/kexfuzz/Makefile b/regress/misc/kexfuzz/Makefile index 9cac412dc..9eb86931c 100644 --- a/regress/misc/kexfuzz/Makefile +++ b/regress/misc/kexfuzz/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.6 2019/12/15 18:58:33 djm Exp $ +# $OpenBSD: Makefile,v 1.7 2020/01/26 00:09:50 djm Exp $ .include .include @@ -20,7 +20,7 @@ SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c SRCS+=cipher-chachapoly.c chacha.c poly1305.c -SRCS+=ssh-ecdsa-sk.c ssh-ed25519-sk.c msg.c ssh-sk-client.c +SRCS+=sshbuf-io.c ssh-ecdsa-sk.c ssh-ed25519-sk.c msg.c ssh-sk-client.c SRCS+= kex.c SRCS+= dh.c diff --git a/regress/misc/kexfuzz/kexfuzz.c b/regress/misc/kexfuzz/kexfuzz.c index 7051e87b1..56697c918 100644 --- a/regress/misc/kexfuzz/kexfuzz.c +++ b/regress/misc/kexfuzz/kexfuzz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kexfuzz.c,v 1.5 2019/01/21 12:50:12 djm Exp $ */ +/* $OpenBSD: kexfuzz.c,v 1.6 2020/01/26 00:09:50 djm Exp $ */ /* * Fuzz harness for KEX code * @@ -424,12 +424,8 @@ main(int argc, char **argv) if (packet_index == -1 || direction == -1 || data_path == NULL) badusage("Replace (-r) mode must specify direction " "(-D) packet index (-i) and data path (-f)"); - if ((fd = open(data_path, O_RDONLY)) == -1) - err(1, "open %s", data_path); - replace_data = sshbuf_new(); - if ((r = sshkey_load_file(fd, replace_data)) != 0) + if ((r = sshbuf_load_file(data_path, &replace_data)) != 0) errx(1, "read %s: %s", data_path, ssh_err(r)); - close(fd); } /* Dump mode */ diff --git a/regress/unittests/authopt/Makefile b/regress/unittests/authopt/Makefile index dfec25174..492092fc6 100644 --- a/regress/unittests/authopt/Makefile +++ b/regress/unittests/authopt/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.3 2019/11/25 10:32:35 djm Exp $ +# $OpenBSD: Makefile,v 1.4 2020/01/26 00:09:50 djm Exp $ PROG=test_authopt SRCS=tests.c @@ -7,8 +7,8 @@ SRCS+=auth-options.c # From usr.bin/ssh SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c -SRCS+=atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c ssh-dss.c -SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c +SRCS+=sshbuf-io.c atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c +SRCS+=ssh-dss.c ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c diff --git a/regress/unittests/hostkeys/Makefile b/regress/unittests/hostkeys/Makefile index e3632c43d..c0a893135 100644 --- a/regress/unittests/hostkeys/Makefile +++ b/regress/unittests/hostkeys/Makefile @@ -1,12 +1,12 @@ -# $OpenBSD: Makefile,v 1.6 2019/11/25 10:32:35 djm Exp $ +# $OpenBSD: Makefile,v 1.7 2020/01/26 00:09:50 djm Exp $ PROG=test_hostkeys SRCS=tests.c test_iterate.c # From usr.bin/ssh SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c -SRCS+=atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c ssh-dss.c -SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c +SRCS+=sshbuf-io.c atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c +SRCS+=ssh-dss.c ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c hostfile.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c diff --git a/regress/unittests/kex/Makefile b/regress/unittests/kex/Makefile index c897a7ef5..648006c78 100644 --- a/regress/unittests/kex/Makefile +++ b/regress/unittests/kex/Makefile @@ -1,12 +1,12 @@ -# $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ +# $OpenBSD: Makefile,v 1.9 2020/01/26 00:09:50 djm Exp $ PROG=test_kex SRCS=tests.c test_kex.c # From usr.bin/ssh SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c -SRCS+=atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c ssh-dss.c -SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c +SRCS+=sshbuf-io.c atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c +SRCS+=ssh-dss.c ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c packet.c dispatch.c canohost.c ssh_api.c SRCS+=compat.c ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c diff --git a/regress/unittests/sshbuf/Makefile b/regress/unittests/sshbuf/Makefile index 0e8e9fd10..388cb5a78 100644 --- a/regress/unittests/sshbuf/Makefile +++ b/regress/unittests/sshbuf/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.7 2018/10/17 23:28:05 djm Exp $ +# $OpenBSD: Makefile,v 1.8 2020/01/26 00:09:50 djm Exp $ .include @@ -14,7 +14,7 @@ SRCS+=test_sshbuf_fixed.c # From usr.bin/ssh SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c -SRCS+=atomicio.c +SRCS+=sshbuf-io.c atomicio.c misc.c xmalloc.c log.c fatal.c ssherr.c cleanup.c run-regress-${PROG}: ${PROG} env ${TEST_ENV} ./${PROG} ${UNITTEST_ARGS} diff --git a/regress/unittests/sshkey/Makefile b/regress/unittests/sshkey/Makefile index 607a6d3fd..78b2cf0ce 100644 --- a/regress/unittests/sshkey/Makefile +++ b/regress/unittests/sshkey/Makefile @@ -1,12 +1,12 @@ -# $OpenBSD: Makefile,v 1.8 2019/11/25 10:32:35 djm Exp $ +# $OpenBSD: Makefile,v 1.9 2020/01/26 00:09:50 djm Exp $ PROG=test_sshkey SRCS=tests.c test_sshkey.c test_file.c test_fuzz.c common.c # From usr.bin/ssh SRCS+=sshbuf-getput-basic.c sshbuf-getput-crypto.c sshbuf-misc.c sshbuf.c -SRCS+=atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c ssh-dss.c -SRCS+=ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c +SRCS+=sshbuf-io.c atomicio.c sshkey.c authfile.c cipher.c log.c ssh-rsa.c +SRCS+=ssh-dss.c ssh-ecdsa.c ssh-ed25519.c mac.c umac.c umac128.c hmac.c misc.c SRCS+=ssherr.c uidswap.c cleanup.c xmalloc.c match.c krl.c fatal.c SRCS+=addrmatch.c bitmap.c SRCS+=ed25519.c hash.c ge25519.c fe25519.c sc25519.c verify.c diff --git a/regress/unittests/sshkey/common.c b/regress/unittests/sshkey/common.c index e21638093..effea578c 100644 --- a/regress/unittests/sshkey/common.c +++ b/regress/unittests/sshkey/common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: common.c,v 1.3 2018/09/13 09:03:20 djm Exp $ */ +/* $OpenBSD: common.c,v 1.4 2020/01/26 00:09:50 djm Exp $ */ /* * Helpers for key API tests * @@ -43,13 +43,10 @@ struct sshbuf * load_file(const char *name) { - int fd; - struct sshbuf *ret; + struct sshbuf *ret = NULL; - ASSERT_PTR_NE(ret = sshbuf_new(), NULL); - ASSERT_INT_NE(fd = open(test_data_file(name), O_RDONLY), -1); - ASSERT_INT_EQ(sshkey_load_file(fd, ret), 0); - close(fd); + ASSERT_INT_EQ(sshbuf_load_file(test_data_file(name), &ret), 0); + ASSERT_PTR_NE(ret, NULL); return ret; } -- cgit v1.2.3