summaryrefslogtreecommitdiff
path: root/regress/unittests/hostkeys/test_iterate.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-10-09 22:59:48 +0100
committerColin Watson <cjwatson@debian.org>2019-10-09 22:59:48 +0100
commit4213eec74e74de6310c27a40c3e9759a08a73996 (patch)
treee97a6dcafc6763aea7c804e4e113c2750cb1400d /regress/unittests/hostkeys/test_iterate.c
parent102062f825fb26a74295a1c089c00c4c4c76b68a (diff)
parentcdf1d0a9f5d18535e0a18ff34860e81a6d83aa5c (diff)
Import openssh_8.1p1.orig.tar.gz
Diffstat (limited to 'regress/unittests/hostkeys/test_iterate.c')
-rw-r--r--regress/unittests/hostkeys/test_iterate.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c
index d6963bd2a..5904121ef 100644
--- a/regress/unittests/hostkeys/test_iterate.c
+++ b/regress/unittests/hostkeys/test_iterate.c
@@ -57,7 +57,7 @@ check(struct hostkey_foreach_line *l, void *_ctx)
57 int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0; 57 int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0;
58 const int matching = (ctx->flags & HKF_WANT_MATCH) != 0; 58 const int matching = (ctx->flags & HKF_WANT_MATCH) != 0;
59 u_int expected_status, expected_match; 59 u_int expected_status, expected_match;
60 int expected_keytype; 60 int expected_keytype, skip = 0;
61 61
62 test_subtest_info("entry %zu/%zu, file line %ld", 62 test_subtest_info("entry %zu/%zu, file line %ld",
63 ctx->i + 1, ctx->nexpected, l->linenum); 63 ctx->i + 1, ctx->nexpected, l->linenum);
@@ -92,13 +92,23 @@ check(struct hostkey_foreach_line *l, void *_ctx)
92 92
93#ifndef OPENSSL_HAS_ECC 93#ifndef OPENSSL_HAS_ECC
94 if (expected->l.keytype == KEY_ECDSA || 94 if (expected->l.keytype == KEY_ECDSA ||
95 expected->no_parse_keytype == KEY_ECDSA) { 95 expected->no_parse_keytype == KEY_ECDSA)
96 skip = 1;
97#endif /* OPENSSL_HAS_ECC */
98#ifndef WITH_OPENSSL
99 if (expected->l.keytype == KEY_DSA ||
100 expected->no_parse_keytype == KEY_DSA ||
101 expected->l.keytype == KEY_RSA ||
102 expected->no_parse_keytype == KEY_RSA ||
103 expected->l.keytype == KEY_ECDSA ||
104 expected->no_parse_keytype == KEY_ECDSA)
105 skip = 1;
106#endif /* WITH_OPENSSL */
107 if (skip) {
96 expected_status = HKF_STATUS_INVALID; 108 expected_status = HKF_STATUS_INVALID;
97 expected_keytype = KEY_UNSPEC; 109 expected_keytype = KEY_UNSPEC;
98 parse_key = 0; 110 parse_key = 0;
99 } 111 }
100#endif
101
102 UPDATE_MATCH_STATUS(match_host_p); 112 UPDATE_MATCH_STATUS(match_host_p);
103 UPDATE_MATCH_STATUS(match_host_s); 113 UPDATE_MATCH_STATUS(match_host_s);
104 UPDATE_MATCH_STATUS(match_ipv4); 114 UPDATE_MATCH_STATUS(match_ipv4);
@@ -145,7 +155,15 @@ prepare_expected(struct expected *expected, size_t n)
145#ifndef OPENSSL_HAS_ECC 155#ifndef OPENSSL_HAS_ECC
146 if (expected[i].l.keytype == KEY_ECDSA) 156 if (expected[i].l.keytype == KEY_ECDSA)
147 continue; 157 continue;
148#endif 158#endif /* OPENSSL_HAS_ECC */
159#ifndef WITH_OPENSSL
160 switch (expected[i].l.keytype) {
161 case KEY_RSA:
162 case KEY_DSA:
163 case KEY_ECDSA:
164 continue;
165 }
166#endif /* WITH_OPENSSL */
149 ASSERT_INT_EQ(sshkey_load_public( 167 ASSERT_INT_EQ(sshkey_load_public(
150 test_data_file(expected[i].key_file), &expected[i].l.key, 168 test_data_file(expected[i].key_file), &expected[i].l.key,
151 NULL), 0); 169 NULL), 0);