summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-03-04 23:22:35 +0000
committerDamien Miller <djm@mindrot.org>2015-03-05 10:27:22 +1100
commitac5e8acefa253eb5e5ba186e34236c0e8007afdc (patch)
tree94ce27024ed839d1f236d6a416215c91250c04be
parent2f04af92f036b0c87a23efb259c37da98cd81fe6 (diff)
upstream commit
make these work with !SSH1; ok markus@ deraadt@
-rw-r--r--regress/unittests/hostkeys/test_iterate.c19
-rw-r--r--regress/unittests/sshkey/test_file.c4
-rw-r--r--regress/unittests/sshkey/test_fuzz.c4
3 files changed, 21 insertions, 6 deletions
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c
index 68a70610..fc095ea4 100644
--- a/regress/unittests/hostkeys/test_iterate.c
+++ b/regress/unittests/hostkeys/test_iterate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_iterate.c,v 1.1 2015/02/16 22:18:34 djm Exp $ */
+/* $OpenBSD: test_iterate.c,v 1.2 2015/03/04 23:22:35 djm Exp $ */
/*
* Regress test for hostfile.h hostkeys_foreach()
*
@@ -54,7 +54,7 @@ check(struct hostkey_foreach_line *l, void *_ctx)
{
struct cbctx *ctx = (struct cbctx *)_ctx;
const struct expected *expected;
- const int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0;
+ int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0;
const int matching = (ctx->flags & HKF_WANT_MATCH) != 0;
u_int expected_status, expected_match;
int expected_keytype;
@@ -87,12 +87,21 @@ check(struct hostkey_foreach_line *l, void *_ctx)
expected_status = HKF_STATUS_MATCHED; \
} \
} while (0)
+ expected_keytype = (parse_key || expected->no_parse_keytype < 0) ?
+ expected->l.keytype : expected->no_parse_keytype;
+
+#ifndef WITH_SSH1
+ if (expected->l.keytype == KEY_RSA1 ||
+ expected->no_parse_keytype == KEY_RSA1) {
+ expected_status = HKF_STATUS_INVALID;
+ expected_keytype = KEY_UNSPEC;
+ parse_key = 0;
+ }
+#endif
UPDATE_MATCH_STATUS(match_host_p);
UPDATE_MATCH_STATUS(match_host_s);
UPDATE_MATCH_STATUS(match_ipv4);
UPDATE_MATCH_STATUS(match_ipv6);
- expected_keytype = (parse_key || expected->no_parse_keytype < 0) ?
- expected->l.keytype : expected->no_parse_keytype;
ASSERT_PTR_NE(l->path, NULL); /* Don't care about path */
ASSERT_LONG_LONG_EQ(l->linenum, expected->l.linenum);
@@ -132,6 +141,8 @@ prepare_expected(struct expected *expected, size_t n)
for (i = 0; i < n; i++) {
if (expected[i].key_file == NULL)
continue;
+ if (expected[i].l.keytype == KEY_RSA1)
+ continue;
ASSERT_INT_EQ(sshkey_load_public(
test_data_file(expected[i].key_file), &expected[i].l.key,
NULL), 0);
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c
index 9c38a7c6..fa95212b 100644
--- a/regress/unittests/sshkey/test_file.c
+++ b/regress/unittests/sshkey/test_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_file.c,v 1.2 2014/12/22 02:15:52 djm Exp $ */
+/* $OpenBSD: test_file.c,v 1.3 2015/03/04 23:22:35 djm Exp $ */
/*
* Regress test for sshkey.h key management API
*
@@ -51,6 +51,7 @@ sshkey_file_tests(void)
pw = load_text_file("pw");
TEST_DONE();
+#ifdef WITH_SSH1
TEST_START("parse RSA1 from private");
buf = load_file("rsa1_1");
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "rsa1_1",
@@ -99,6 +100,7 @@ sshkey_file_tests(void)
TEST_DONE();
sshkey_free(k1);
+#endif
TEST_START("parse RSA from private");
buf = load_file("rsa_1");
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c
index 14518ce9..1f08a2e4 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.3 2015/01/26 06:11:28 djm Exp $ */
+/* $OpenBSD: test_fuzz.c,v 1.4 2015/03/04 23:22:35 djm Exp $ */
/*
* Fuzz tests for key parsing
*
@@ -104,6 +104,7 @@ sshkey_fuzz_tests(void)
struct fuzz *fuzz;
int r;
+#ifdef WITH_SSH1
TEST_START("fuzz RSA1 private");
buf = load_file("rsa1_1");
fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP |
@@ -147,6 +148,7 @@ sshkey_fuzz_tests(void)
sshbuf_free(fuzzed);
fuzz_cleanup(fuzz);
TEST_DONE();
+#endif
TEST_START("fuzz RSA private");
buf = load_file("rsa_1");