upstream commit
make these work with !SSH1; ok markus@ deraadt@
This commit is contained in:
parent
2f04af92f0
commit
ac5e8acefa
|
@ -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()
|
* 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;
|
struct cbctx *ctx = (struct cbctx *)_ctx;
|
||||||
const struct expected *expected;
|
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;
|
const int matching = (ctx->flags & HKF_WANT_MATCH) != 0;
|
||||||
u_int expected_status, expected_match;
|
u_int expected_status, expected_match;
|
||||||
int expected_keytype;
|
int expected_keytype;
|
||||||
|
@ -87,12 +87,21 @@ check(struct hostkey_foreach_line *l, void *_ctx)
|
||||||
expected_status = HKF_STATUS_MATCHED; \
|
expected_status = HKF_STATUS_MATCHED; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} 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_p);
|
||||||
UPDATE_MATCH_STATUS(match_host_s);
|
UPDATE_MATCH_STATUS(match_host_s);
|
||||||
UPDATE_MATCH_STATUS(match_ipv4);
|
UPDATE_MATCH_STATUS(match_ipv4);
|
||||||
UPDATE_MATCH_STATUS(match_ipv6);
|
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_PTR_NE(l->path, NULL); /* Don't care about path */
|
||||||
ASSERT_LONG_LONG_EQ(l->linenum, expected->l.linenum);
|
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++) {
|
for (i = 0; i < n; i++) {
|
||||||
if (expected[i].key_file == NULL)
|
if (expected[i].key_file == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
if (expected[i].l.keytype == KEY_RSA1)
|
||||||
|
continue;
|
||||||
ASSERT_INT_EQ(sshkey_load_public(
|
ASSERT_INT_EQ(sshkey_load_public(
|
||||||
test_data_file(expected[i].key_file), &expected[i].l.key,
|
test_data_file(expected[i].key_file), &expected[i].l.key,
|
||||||
NULL), 0);
|
NULL), 0);
|
||||||
|
|
|
@ -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
|
* Regress test for sshkey.h key management API
|
||||||
*
|
*
|
||||||
|
@ -51,6 +51,7 @@ sshkey_file_tests(void)
|
||||||
pw = load_text_file("pw");
|
pw = load_text_file("pw");
|
||||||
TEST_DONE();
|
TEST_DONE();
|
||||||
|
|
||||||
|
#ifdef WITH_SSH1
|
||||||
TEST_START("parse RSA1 from private");
|
TEST_START("parse RSA1 from private");
|
||||||
buf = load_file("rsa1_1");
|
buf = load_file("rsa1_1");
|
||||||
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "rsa1_1",
|
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "rsa1_1",
|
||||||
|
@ -99,6 +100,7 @@ sshkey_file_tests(void)
|
||||||
TEST_DONE();
|
TEST_DONE();
|
||||||
|
|
||||||
sshkey_free(k1);
|
sshkey_free(k1);
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_START("parse RSA from private");
|
TEST_START("parse RSA from private");
|
||||||
buf = load_file("rsa_1");
|
buf = load_file("rsa_1");
|
||||||
|
|
|
@ -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
|
* Fuzz tests for key parsing
|
||||||
*
|
*
|
||||||
|
@ -104,6 +104,7 @@ sshkey_fuzz_tests(void)
|
||||||
struct fuzz *fuzz;
|
struct fuzz *fuzz;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
#ifdef WITH_SSH1
|
||||||
TEST_START("fuzz RSA1 private");
|
TEST_START("fuzz RSA1 private");
|
||||||
buf = load_file("rsa1_1");
|
buf = load_file("rsa1_1");
|
||||||
fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP |
|
fuzz = fuzz_begin(FUZZ_1_BIT_FLIP | FUZZ_1_BYTE_FLIP |
|
||||||
|
@ -147,6 +148,7 @@ sshkey_fuzz_tests(void)
|
||||||
sshbuf_free(fuzzed);
|
sshbuf_free(fuzzed);
|
||||||
fuzz_cleanup(fuzz);
|
fuzz_cleanup(fuzz);
|
||||||
TEST_DONE();
|
TEST_DONE();
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_START("fuzz RSA private");
|
TEST_START("fuzz RSA private");
|
||||||
buf = load_file("rsa_1");
|
buf = load_file("rsa_1");
|
||||||
|
|
Loading…
Reference in New Issue