- (dtucker) [regress/unittests/sshkey/test_{file,fuzz,sshkey}.c] Wrap ecdsa-

specific tests inside OPENSSL_HAS_ECC.
This commit is contained in:
Darren Tucker 2014-07-23 04:27:50 +10:00
parent 04f4824940
commit c4ee219a66
4 changed files with 20 additions and 0 deletions

View File

@ -4,6 +4,8 @@
- (djm) [regress/multiplex.sh] change the test for still-open Unix
domain sockets to be robust against nc implementations that produce
error messages.
- (dtucker) [regress/unittests/sshkey/test_{file,fuzz,sshkey}.c] Wrap ecdsa-
specific tests inside OPENSSL_HAS_ECC.
20140721
- OpenBSD CVS Sync

View File

@ -283,6 +283,7 @@ sshkey_file_tests(void)
sshkey_free(k1);
#ifdef OPENSSL_HAS_ECC
TEST_START("parse ECDSA from private");
buf = load_file("ecdsa_1");
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "ecdsa_1",
@ -381,6 +382,7 @@ sshkey_file_tests(void)
TEST_DONE();
sshkey_free(k1);
#endif /* OPENSSL_HAS_ECC */
TEST_START("parse Ed25519 from private");
buf = load_file("ed25519_1");

View File

@ -231,6 +231,7 @@ sshkey_fuzz_tests(void)
fuzz_cleanup(fuzz);
TEST_DONE();
#ifdef OPENSSL_HAS_ECC
TEST_START("fuzz ECDSA private");
buf = load_file("ecdsa_1");
fuzz = fuzz_begin(FUZZ_BASE64, sshbuf_mutable_ptr(buf),
@ -274,6 +275,7 @@ sshkey_fuzz_tests(void)
sshbuf_free(fuzzed);
fuzz_cleanup(fuzz);
TEST_DONE();
#endif
TEST_START("fuzz Ed25519 private");
buf = load_file("ed25519_1");
@ -327,6 +329,7 @@ sshkey_fuzz_tests(void)
sshkey_free(k1);
TEST_DONE();
#ifdef OPENSSL_HAS_ECC
TEST_START("fuzz ECDSA public");
buf = load_file("ecdsa_1");
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key",
@ -341,6 +344,7 @@ sshkey_fuzz_tests(void)
public_fuzz(k1);
sshkey_free(k1);
TEST_DONE();
#endif
TEST_START("fuzz Ed25519 public");
buf = load_file("ed25519_1");
@ -375,6 +379,7 @@ sshkey_fuzz_tests(void)
sshkey_free(k1);
TEST_DONE();
#ifdef OPENSSL_HAS_ECC
TEST_START("fuzz ECDSA sig");
buf = load_file("ecdsa_1");
ASSERT_INT_EQ(sshkey_parse_private_fileblob(buf, "", "key",
@ -383,6 +388,7 @@ sshkey_fuzz_tests(void)
sig_fuzz(k1);
sshkey_free(k1);
TEST_DONE();
#endif
TEST_START("fuzz Ed25519 sig");
buf = load_file("ed25519_1");

View File

@ -215,6 +215,7 @@ sshkey_tests(void)
ASSERT_PTR_NE(kd->dsa->priv_key, NULL);
TEST_DONE();
#ifdef OPENSSL_HAS_ECC
TEST_START("generate KEY_ECDSA");
ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &ke), 0);
ASSERT_PTR_NE(ke, NULL);
@ -222,6 +223,7 @@ sshkey_tests(void)
ASSERT_PTR_NE(EC_KEY_get0_public_key(ke->ecdsa), NULL);
ASSERT_PTR_NE(EC_KEY_get0_private_key(ke->ecdsa), NULL);
TEST_DONE();
#endif
TEST_START("generate KEY_ED25519");
ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &kf), 0);
@ -262,6 +264,7 @@ sshkey_tests(void)
sshkey_free(k1);
TEST_DONE();
#ifdef OPENSSL_HAS_ECC
TEST_START("demote KEY_ECDSA");
ASSERT_INT_EQ(sshkey_demote(ke, &k1), 0);
ASSERT_PTR_NE(k1, NULL);
@ -277,6 +280,7 @@ sshkey_tests(void)
ASSERT_INT_EQ(sshkey_equal(ke, k1), 1);
sshkey_free(k1);
TEST_DONE();
#endif
TEST_START("demote KEY_ED25519");
ASSERT_INT_EQ(sshkey_demote(kf, &k1), 0);
@ -294,9 +298,11 @@ sshkey_tests(void)
TEST_START("equal mismatched key types");
ASSERT_INT_EQ(sshkey_equal(kd, kr), 0);
#ifdef OPENSSL_HAS_ECC
ASSERT_INT_EQ(sshkey_equal(kd, ke), 0);
ASSERT_INT_EQ(sshkey_equal(kr, ke), 0);
ASSERT_INT_EQ(sshkey_equal(ke, kf), 0);
#endif
ASSERT_INT_EQ(sshkey_equal(kd, kf), 0);
TEST_DONE();
@ -307,9 +313,11 @@ sshkey_tests(void)
ASSERT_INT_EQ(sshkey_generate(KEY_DSA, 1024, &k1), 0);
ASSERT_INT_EQ(sshkey_equal(kd, k1), 0);
sshkey_free(k1);
#ifdef OPENSSL_HAS_ECC
ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 256, &k1), 0);
ASSERT_INT_EQ(sshkey_equal(ke, k1), 0);
sshkey_free(k1);
#endif
ASSERT_INT_EQ(sshkey_generate(KEY_ED25519, 256, &k1), 0);
ASSERT_INT_EQ(sshkey_equal(kf, k1), 0);
sshkey_free(k1);
@ -317,7 +325,9 @@ sshkey_tests(void)
sshkey_free(kr);
sshkey_free(kd);
#ifdef OPENSSL_HAS_ECC
sshkey_free(ke);
#endif
sshkey_free(kf);
/* XXX certify test */