summaryrefslogtreecommitdiff
path: root/regress/unittests/hostkeys
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2019-09-07 19:25:00 +1000
committerDamien Miller <djm@mindrot.org>2019-09-08 10:37:17 +1000
commitf61f29afda6c71eda26effa54d3c2e5306fd0833 (patch)
tree065e02eead3f8085a6c69a8976a8fa11e313ac6c /regress/unittests/hostkeys
parent105e1c9218940eb53473f55a9177652d889ddbad (diff)
make unittests pass for no-openssl case
Diffstat (limited to 'regress/unittests/hostkeys')
-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);