From f650ab4738107d01925bd4d9043e18bf27ba2dcd Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 7 Nov 2019 09:24:18 +0000 Subject: Fix no-dsa Make sure we don't try and load a DSA key in the tests if DSA has been disabled. Reviewed-by: Shane Lontis Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/10375) --- test/evp_extra_test.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index e7409619fd..f4e792fb1d 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -88,6 +88,7 @@ static const unsigned char kExampleRSAKeyDER[] = { * kExampleDSAKeyDER is a DSA private key in ASN.1, DER format. Of course, you * should never use this key anywhere but in an example. */ +#ifndef OPENSSL_NO_DSA static const unsigned char kExampleDSAKeyDER[] = { 0x30, 0x82, 0x01, 0xba, 0x02, 0x01, 0x00, 0x02, 0x81, 0x81, 0x00, 0x9a, 0x05, 0x6d, 0x33, 0xcd, 0x5d, 0x78, 0xa1, 0xbb, 0xcb, 0x7d, 0x5b, 0x8d, @@ -128,6 +129,7 @@ static const unsigned char kExampleDSAKeyDER[] = { 0xf1, 0x8c, 0x82, 0x97, 0xf2, 0xf4, 0x19, 0xba, 0x2b, 0xf3, 0x16, 0xbe, 0x40, 0x48 }; +#endif /* * kExampleBadRSAKeyDER is an RSA private key in ASN.1, DER format. The private @@ -422,6 +424,7 @@ end: return ret; } +#ifndef OPENSSL_NO_DSA static EVP_PKEY *load_example_dsa_key(void) { EVP_PKEY *ret = NULL; @@ -445,7 +448,7 @@ end: return ret; } - +#endif static int test_EVP_Enveloped(void) { @@ -525,8 +528,13 @@ static int test_EVP_DigestSignInit(int tst) if (!TEST_ptr(pkey = load_example_rsa_key())) goto out; } else { +#ifndef OPENSSL_NO_DSA if (!TEST_ptr(pkey = load_example_dsa_key())) goto out; +#else + ret = 1; + goto out; +#endif } if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, EVP_sha256(), NULL, pkey))) -- cgit v1.2.3