summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--regress/unittests/sshkey/test_file.c2
-rw-r--r--regress/unittests/sshkey/test_fuzz.c6
-rw-r--r--regress/unittests/sshkey/test_sshkey.c10
4 files changed, 20 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 16c6bcc12..47a541c39 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,8 @@
4 - (djm) [regress/multiplex.sh] change the test for still-open Unix 4 - (djm) [regress/multiplex.sh] change the test for still-open Unix
5 domain sockets to be robust against nc implementations that produce 5 domain sockets to be robust against nc implementations that produce
6 error messages. 6 error messages.
7 - (dtucker) [regress/unittests/sshkey/test_{file,fuzz,sshkey}.c] Wrap ecdsa-
8 specific tests inside OPENSSL_HAS_ECC.
7 9
820140721 1020140721
9 - OpenBSD CVS Sync 11 - OpenBSD CVS Sync
diff --git a/regress/unittests/sshkey/test_file.c b/regress/unittests/sshkey/test_file.c
index de3ae38c1..d113e2da8 100644
--- a/regress/unittests/sshkey/test_file.c
+++ b/regress/unittests/sshkey/test_file.c
@@ -283,6 +283,7 @@ sshkey_file_tests(void)
283 283
284 sshkey_free(k1); 284 sshkey_free(k1);
285 285
286#ifdef OPENSSL_HAS_ECC
286 TEST_START("parse ECDSA from private"); 287 TEST_START("parse ECDSA from private");
287 buf = load_file("ecdsa_1"); 288 buf = load_file("ecdsa_1");
288 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "ecdsa_1", 289 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "ecdsa_1",
@@ -381,6 +382,7 @@ sshkey_file_tests(void)
381 TEST_DONE(); 382 TEST_DONE();
382 383
383 sshkey_free(k1); 384 sshkey_free(k1);
385#endif /* OPENSSL_HAS_ECC */
384 386
385 TEST_START("parse Ed25519 from private"); 387 TEST_START("parse Ed25519 from private");
386 buf = load_file("ed25519_1"); 388 buf = load_file("ed25519_1");
diff --git a/regress/unittests/sshkey/test_fuzz.c b/regress/unittests/sshkey/test_fuzz.c
index 163e65512..f9da086a4 100644
--- a/regress/unittests/sshkey/test_fuzz.c
+++ b/regress/unittests/sshkey/test_fuzz.c
@@ -231,6 +231,7 @@ sshkey_fuzz_tests(void)
231 fuzz_cleanup(fuzz); 231 fuzz_cleanup(fuzz);
232 TEST_DONE(); 232 TEST_DONE();
233 233
234#ifdef OPENSSL_HAS_ECC
234 TEST_START("fuzz ECDSA private"); 235 TEST_START("fuzz ECDSA private");
235 buf = load_file("ecdsa_1"); 236 buf = load_file("ecdsa_1");
236 fuzz = fuzz_begin(FUZZ_BASE64, sshbuf_mutable_ptr(buf), 237 fuzz = fuzz_begin(FUZZ_BASE64, sshbuf_mutable_ptr(buf),
@@ -274,6 +275,7 @@ sshkey_fuzz_tests(void)
274 sshbuf_free(fuzzed); 275 sshbuf_free(fuzzed);
275 fuzz_cleanup(fuzz); 276 fuzz_cleanup(fuzz);
276 TEST_DONE(); 277 TEST_DONE();
278#endif
277 279
278 TEST_START("fuzz Ed25519 private"); 280 TEST_START("fuzz Ed25519 private");
279 buf = load_file("ed25519_1"); 281 buf = load_file("ed25519_1");
@@ -327,6 +329,7 @@ sshkey_fuzz_tests(void)
327 sshkey_free(k1); 329 sshkey_free(k1);
328 TEST_DONE(); 330 TEST_DONE();
329 331
332#ifdef OPENSSL_HAS_ECC
330 TEST_START("fuzz ECDSA public"); 333 TEST_START("fuzz ECDSA public");
331 buf = load_file("ecdsa_1"); 334 buf = load_file("ecdsa_1");
332 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key", 335 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key",
@@ -341,6 +344,7 @@ sshkey_fuzz_tests(void)
341 public_fuzz(k1); 344 public_fuzz(k1);
342 sshkey_free(k1); 345 sshkey_free(k1);
343 TEST_DONE(); 346 TEST_DONE();
347#endif
344 348
345 TEST_START("fuzz Ed25519 public"); 349 TEST_START("fuzz Ed25519 public");
346 buf = load_file("ed25519_1"); 350 buf = load_file("ed25519_1");
@@ -375,6 +379,7 @@ sshkey_fuzz_tests(void)
375 sshkey_free(k1); 379 sshkey_free(k1);
376 TEST_DONE(); 380 TEST_DONE();
377 381
382#ifdef OPENSSL_HAS_ECC
378 TEST_START("fuzz ECDSA sig"); 383 TEST_START("fuzz ECDSA sig");
379 buf = load_file("ecdsa_1"); 384 buf = load_file("ecdsa_1");
380 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key", 385 ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key",
@@ -383,6 +388,7 @@ sshkey_fuzz_tests(void)
383 sig_fuzz(k1); 388 sig_fuzz(k1);
384 sshkey_free(k1); 389 sshkey_free(k1);
385 TEST_DONE(); 390 TEST_DONE();
391#endif
386 392
387 TEST_START("fuzz Ed25519 sig"); 393 TEST_START("fuzz Ed25519 sig");
388 buf = load_file("ed25519_1"); 394 buf = load_file("ed25519_1");
diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c
index 03dfdba12..292303063 100644
--- a/regress/unittests/sshkey/test_sshkey.c
+++ b/regress/unittests/sshkey/test_sshkey.c
@@ -215,6 +215,7 @@ sshkey_tests(void)
215 ASSERT_PTR_NE(kd->dsa->priv_key, NULL); 215 ASSERT_PTR_NE(kd->dsa->priv_key, NULL);
216 TEST_DONE(); 216 TEST_DONE();
217 217
218#ifdef OPENSSL_HAS_ECC
218 TEST_START("generate KEY_ECDSA"); 219 TEST_START("generate KEY_ECDSA");
219 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &ke), 0); 220 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &ke), 0);
220 ASSERT_PTR_NE(ke, NULL); 221 ASSERT_PTR_NE(ke, NULL);
@@ -222,6 +223,7 @@ sshkey_tests(void)
222 ASSERT_PTR_NE(EC_KEY_get0_public_key(ke->ecdsa), NULL); 223 ASSERT_PTR_NE(EC_KEY_get0_public_key(ke->ecdsa), NULL);
223 ASSERT_PTR_NE(EC_KEY_get0_private_key(ke->ecdsa), NULL); 224 ASSERT_PTR_NE(EC_KEY_get0_private_key(ke->ecdsa), NULL);
224 TEST_DONE(); 225 TEST_DONE();
226#endif
225 227
226 TEST_START("generate KEY_ED25519"); 228 TEST_START("generate KEY_ED25519");
227 ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &kf), 0); 229 ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &kf), 0);
@@ -262,6 +264,7 @@ sshkey_tests(void)
262 sshkey_free(k1); 264 sshkey_free(k1);
263 TEST_DONE(); 265 TEST_DONE();
264 266
267#ifdef OPENSSL_HAS_ECC
265 TEST_START("demote KEY_ECDSA"); 268 TEST_START("demote KEY_ECDSA");
266 ASSERT_INT_EQ(sshkey_demote(ke, &k1), 0); 269 ASSERT_INT_EQ(sshkey_demote(ke, &k1), 0);
267 ASSERT_PTR_NE(k1, NULL); 270 ASSERT_PTR_NE(k1, NULL);
@@ -277,6 +280,7 @@ sshkey_tests(void)
277 ASSERT_INT_EQ(sshkey_equal(ke, k1), 1); 280 ASSERT_INT_EQ(sshkey_equal(ke, k1), 1);
278 sshkey_free(k1); 281 sshkey_free(k1);
279 TEST_DONE(); 282 TEST_DONE();
283#endif
280 284
281 TEST_START("demote KEY_ED25519"); 285 TEST_START("demote KEY_ED25519");
282 ASSERT_INT_EQ(sshkey_demote(kf, &k1), 0); 286 ASSERT_INT_EQ(sshkey_demote(kf, &k1), 0);
@@ -294,9 +298,11 @@ sshkey_tests(void)
294 298
295 TEST_START("equal mismatched key types"); 299 TEST_START("equal mismatched key types");
296 ASSERT_INT_EQ(sshkey_equal(kd, kr), 0); 300 ASSERT_INT_EQ(sshkey_equal(kd, kr), 0);
301#ifdef OPENSSL_HAS_ECC
297 ASSERT_INT_EQ(sshkey_equal(kd, ke), 0); 302 ASSERT_INT_EQ(sshkey_equal(kd, ke), 0);
298 ASSERT_INT_EQ(sshkey_equal(kr, ke), 0); 303 ASSERT_INT_EQ(sshkey_equal(kr, ke), 0);
299 ASSERT_INT_EQ(sshkey_equal(ke, kf), 0); 304 ASSERT_INT_EQ(sshkey_equal(ke, kf), 0);
305#endif
300 ASSERT_INT_EQ(sshkey_equal(kd, kf), 0); 306 ASSERT_INT_EQ(sshkey_equal(kd, kf), 0);
301 TEST_DONE(); 307 TEST_DONE();
302 308
@@ -307,9 +313,11 @@ sshkey_tests(void)
307 ASSERT_INT_EQ(sshkey_generate(KEY_DSA, 1024, &k1), 0); 313 ASSERT_INT_EQ(sshkey_generate(KEY_DSA, 1024, &k1), 0);
308 ASSERT_INT_EQ(sshkey_equal(kd, k1), 0); 314 ASSERT_INT_EQ(sshkey_equal(kd, k1), 0);
309 sshkey_free(k1); 315 sshkey_free(k1);
316#ifdef OPENSSL_HAS_ECC
310 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &k1), 0); 317 ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &k1), 0);
311 ASSERT_INT_EQ(sshkey_equal(ke, k1), 0); 318 ASSERT_INT_EQ(sshkey_equal(ke, k1), 0);
312 sshkey_free(k1); 319 sshkey_free(k1);
320#endif
313 ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &k1), 0); 321 ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &k1), 0);
314 ASSERT_INT_EQ(sshkey_equal(kf, k1), 0); 322 ASSERT_INT_EQ(sshkey_equal(kf, k1), 0);
315 sshkey_free(k1); 323 sshkey_free(k1);
@@ -317,7 +325,9 @@ sshkey_tests(void)
317 325
318 sshkey_free(kr); 326 sshkey_free(kr);
319 sshkey_free(kd); 327 sshkey_free(kd);
328#ifdef OPENSSL_HAS_ECC
320 sshkey_free(ke); 329 sshkey_free(ke);
330#endif
321 sshkey_free(kf); 331 sshkey_free(kf);
322 332
323/* XXX certify test */ 333/* XXX certify test */