diff options
author | Richard Levitte <levitte@openssl.org> | 2020-12-02 18:30:55 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-12-16 11:56:38 +0100 |
commit | a2e145f8dbf064b56f793fc77b3ccd79f7c67689 (patch) | |
tree | ffa00af5cda2df173609fe362f9119092f9842cf /test/evp_pkey_dparams_test.c | |
parent | c2403f362efc519e473269d183adc7cceddb8c54 (diff) |
Add necessary checks of OPENSSL_NO_DH, OPENSSL_NO_DSA and OPENSSL_NO_EC
When OpenSSL is configured with 'no-dh', 'no-dsa' and 'no-ec'
combined, some static functions have no use, which the compiler may
complain about. We therefore add extra guards to silence it.
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/13589)
Diffstat (limited to 'test/evp_pkey_dparams_test.c')
-rw-r--r-- | test/evp_pkey_dparams_test.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/test/evp_pkey_dparams_test.c b/test/evp_pkey_dparams_test.c index b8e9493dca..2b6bd31a66 100644 --- a/test/evp_pkey_dparams_test.c +++ b/test/evp_pkey_dparams_test.c @@ -21,7 +21,12 @@ #include <openssl/ec.h> #include "testutil.h" -#ifndef OPENSSL_NO_DH +#if defined(OPENSSL_NO_DH) && defined(OPENSSL_NO_DSA) && defined(OPENSSL_NO_EC) +# define OPENSSL_NO_KEYPARAMS +#endif + +#ifndef OPENSSL_NO_KEYPARAMS +# ifndef OPENSSL_NO_DH static const unsigned char dhparam_bin[] = { 0x30,0x82,0x01,0x08,0x02,0x82,0x01,0x01,0x00,0xc0,0xd1,0x2e,0x14,0x18,0xbd,0x03, 0xfd,0x39,0xe1,0x99,0xf4,0x93,0x06,0x2d,0x49,0xc6,0xb5,0xb9,0xf0,0x91,0xcb,0x2f, @@ -41,9 +46,9 @@ static const unsigned char dhparam_bin[] = { 0x06,0x7f,0x7f,0xd7,0x7b,0x42,0x5b,0xba,0x93,0x7a,0xeb,0x43,0x5f,0xce,0x59,0x26, 0xe8,0x76,0xdc,0xee,0xe2,0xbe,0x36,0x7a,0x83,0x02,0x01,0x02 }; -#endif +# endif -#ifndef OPENSSL_NO_DSA +# ifndef OPENSSL_NO_DSA static const unsigned char dsaparam_bin[] = { 0x30,0x82,0x02,0x28,0x02,0x82,0x01,0x01,0x00,0xf2,0x85,0x01,0xa5,0xb9,0x56,0x65, 0x19,0xff,0x9a,0x7d,0xf9,0x90,0xd6,0xaa,0x73,0xac,0xf7,0x94,0xfa,0x8a,0x64,0x6d, @@ -81,29 +86,28 @@ static const unsigned char dsaparam_bin[] = { 0x22,0x15,0xc1,0x8b,0x04,0xb9,0x8a,0xa8,0xb7,0x1b,0x62,0x44,0xc6,0xef,0x4b,0x74, 0xd0,0xfd,0xa9,0xb4,0x4e,0xdd,0x7d,0x38,0x60,0xd1,0x40,0xcd }; -#endif +# endif -#ifndef OPENSSL_NO_EC +# ifndef OPENSSL_NO_EC static const unsigned char ecparam_bin[] = { 0x06,0x08,0x2a,0x86,0x48,0xce,0x3d,0x03,0x01,0x07 }; -#endif +# endif -#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_DSA) || !defined(OPENSSL_NO_EC) static const struct { int type; const unsigned char *param_bin; size_t param_bin_len; } pkey_params [] = { -#ifndef OPENSSL_NO_DH +# ifndef OPENSSL_NO_DH { EVP_PKEY_DH, dhparam_bin, sizeof(dhparam_bin) }, -#endif -#ifndef OPENSSL_NO_DSA +# endif +# ifndef OPENSSL_NO_DSA { EVP_PKEY_DSA, dsaparam_bin, sizeof(dsaparam_bin) }, -#endif -#ifndef OPENSSL_NO_EC +# endif +# ifndef OPENSSL_NO_EC { EVP_PKEY_EC, ecparam_bin, sizeof(ecparam_bin) } -#endif +# endif }; static int params_bio_test(int id) @@ -140,7 +144,7 @@ static int params_bio_test(int id) int setup_tests(void) { -#if defined(OPENSSL_NO_DH) && defined(OPENSSL_NO_DSA) && defined(OPENSSL_NO_EC) +#ifdef OPENSSL_NO_KEYPARAMS TEST_note("No DH/DSA/EC support"); #else ADD_ALL_TESTS(params_bio_test, OSSL_NELEM(pkey_params)); |