From 5d5ec165c5b614b03678afdad881f10e25832e46 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Wed, 25 Feb 2015 15:32:49 +1100 Subject: Restrict ECDSA and ECDH tests. ifdef out some more ECDSA and ECDH tests when built against an OpenSSL that does not have eliptic curve functionality. --- regress/unittests/sshkey/test_sshkey.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'regress/unittests/sshkey/test_sshkey.c') diff --git a/regress/unittests/sshkey/test_sshkey.c b/regress/unittests/sshkey/test_sshkey.c index 3e4e39b62..b233a254b 100644 --- a/regress/unittests/sshkey/test_sshkey.c +++ b/regress/unittests/sshkey/test_sshkey.c @@ -217,12 +217,14 @@ sshkey_tests(void) sshkey_free(k1); TEST_DONE(); +#ifdef OPENSSL_HAS_ECC TEST_START("new/free KEY_ECDSA"); k1 = sshkey_new(KEY_ECDSA); ASSERT_PTR_NE(k1, NULL); ASSERT_PTR_EQ(k1->ecdsa, NULL); /* Can't allocate without NID */ sshkey_free(k1); TEST_DONE(); +#endif TEST_START("new/free KEY_ED25519"); k1 = sshkey_new(KEY_ED25519); @@ -273,12 +275,14 @@ sshkey_tests(void) sshkey_free(k1); TEST_DONE(); +#ifdef OPENSSL_HAS_ECC TEST_START("generate KEY_ECDSA wrong bits"); ASSERT_INT_EQ(sshkey_generate(KEY_ECDSA, 42, &k1), SSH_ERR_INVALID_ARGUMENT); ASSERT_PTR_EQ(k1, NULL); sshkey_free(k1); TEST_DONE(); +#endif TEST_START("generate KEY_RSA"); ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &kr), 0); @@ -474,6 +478,7 @@ sshkey_tests(void) sshkey_free(k2); TEST_DONE(); +#ifdef OPENSSL_HAS_ECC TEST_START("sign and verify ECDSA"); k1 = get_private("ecdsa_1"); ASSERT_INT_EQ(sshkey_load_public(test_data_file("ecdsa_2.pub"), &k2, @@ -482,6 +487,7 @@ sshkey_tests(void) sshkey_free(k1); sshkey_free(k2); TEST_DONE(); +#endif TEST_START("sign and verify ED25519"); k1 = get_private("ed25519_1"); -- cgit v1.2.3