summaryrefslogtreecommitdiffstats
path: root/test/endecode_test.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-12-02 18:30:55 +0100
committerRichard Levitte <levitte@openssl.org>2020-12-16 11:56:38 +0100
commita2e145f8dbf064b56f793fc77b3ccd79f7c67689 (patch)
treeffa00af5cda2df173609fe362f9119092f9842cf /test/endecode_test.c
parentc2403f362efc519e473269d183adc7cceddb8c54 (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/endecode_test.c')
-rw-r--r--test/endecode_test.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/endecode_test.c b/test/endecode_test.c
index 6e67dd1835..ad76807d4f 100644
--- a/test/endecode_test.c
+++ b/test/endecode_test.c
@@ -25,6 +25,10 @@
#include "helpers/predefined_dhparams.h"
#include "testutil.h"
+#if defined(OPENSSL_NO_DH) && defined(OPENSSL_NO_DSA) && defined(OPENSSL_NO_EC)
+# define OPENSSL_NO_KEYPARAMS
+#endif
+
#ifndef OPENSSL_NO_EC
static BN_CTX *bnctx = NULL;
static OSSL_PARAM_BLD *bld_prime_nc = NULL;
@@ -40,8 +44,7 @@ static OSSL_PARAM *ec_explicit_tri_params_explicit = NULL;
# endif
#endif
-#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_DSA) \
- || !defined(OPENSSL_NO_EC)
+#ifndef OPENSSL_NO_KEYPARAMS
static EVP_PKEY *make_template(const char *type, OSSL_PARAM *genparams)
{
EVP_PKEY *pkey = NULL;
@@ -513,8 +516,7 @@ static int test_unprotected_via_PEM(const char *type, EVP_PKEY *key)
dump_pem, 0);
}
-#if !defined(OPENSSL_NO_DH) || !defined(OPENSSL_NO_DSA) \
- || !defined(OPENSSL_NO_EC)
+#ifndef OPENSSL_NO_KEYPARAMS
static int check_params_DER(const char *type, const void *data, size_t data_len)
{
const unsigned char *datap = data;
@@ -569,7 +571,7 @@ static int test_params_via_PEM(const char *type, EVP_PKEY *key)
test_text, check_params_PEM,
dump_pem, 0);
}
-#endif /* ndef(OPENSSL_NO_DH) || ndef(OPENSSL_NO_DSA) || ndef(OPENSSL_NO_EC) */
+#endif /* !OPENSSL_NO_KEYPARAMS */
static int check_unprotected_legacy_PEM(const char *type,
const void *data, size_t data_len)