summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test.c
diff options
context:
space:
mode:
authorYi Li <yi1.li@intel.com>2023-04-17 16:20:31 +0800
committerPauli <pauli@openssl.org>2023-06-14 13:06:22 +1000
commit4032cd9a1434610e4dc2bbde01f98d04faa615e5 (patch)
tree6e40e7f29433428db03d9111e496716f2b6dd96a /test/evp_extra_test.c
parentcc343d047c147e0a395fb101efbe9dedf458aa17 (diff)
configure: introduce no-ecx to remove ECX related feature
This can effectively reduce the binary size for platforms that don't need ECX feature(~100KB). Signed-off-by: Yi Li <yi1.li@intel.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/20781)
Diffstat (limited to 'test/evp_extra_test.c')
-rw-r--r--test/evp_extra_test.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 72a6305d89..0b61d5c9e8 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -398,6 +398,7 @@ static const unsigned char pExampleECParamDER[] = {
0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07
};
+# ifndef OPENSSL_NO_ECX
static const unsigned char kExampleED25519KeyDER[] = {
0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, 0x03, 0x2b, 0x65, 0x70,
0x04, 0x22, 0x04, 0x20, 0xba, 0x7b, 0xba, 0x20, 0x1b, 0x02, 0x75, 0x3a,
@@ -419,6 +420,7 @@ static const unsigned char kExampleX25519KeyDER[] = {
0x7b, 0x96, 0x0b, 0xd4, 0x8f, 0xd1, 0xee, 0x67, 0xf2, 0x9b, 0x88, 0xac,
0x50, 0xce, 0x97, 0x36, 0xdd, 0xaf, 0x25, 0xf6, 0x10, 0x34, 0x96, 0x6e
};
+# endif
# endif
#endif
@@ -577,10 +579,12 @@ static APK_DATA keycheckdata[] = {
1, 1},
{pExampleECParamDER, sizeof(pExampleECParamDER), "EC", EVP_PKEY_EC, 0, 0, 1,
2},
+# ifndef OPENSSL_NO_ECX
{kExampleED25519KeyDER, sizeof(kExampleED25519KeyDER), "ED25519",
EVP_PKEY_ED25519, 1, 1, 1, 0},
{kExampleED25519PubKeyDER, sizeof(kExampleED25519PubKeyDER), "ED25519",
EVP_PKEY_ED25519, 0, 1, 1, 1},
+# endif
#endif
};
@@ -630,7 +634,7 @@ static EVP_PKEY *load_example_dh_key(void)
}
# endif
-# ifndef OPENSSL_NO_EC
+# ifndef OPENSSL_NO_ECX
static EVP_PKEY *load_example_ed25519_key(void)
{
return load_example_key("ED25519", kExampleED25519KeyDER,
@@ -2261,7 +2265,7 @@ static struct keys_st {
EVP_PKEY_SIPHASH, "0123456789012345", NULL
#endif
},
-#ifndef OPENSSL_NO_EC
+#ifndef OPENSSL_NO_ECX
{
EVP_PKEY_X25519, "01234567890123456789012345678901",
"abcdefghijklmnopqrstuvwxyzabcdef"
@@ -4304,7 +4308,7 @@ static int test_custom_pmeth(int idx)
# endif
case 3:
case 9:
-# ifndef OPENSSL_NO_EC
+# ifndef OPENSSL_NO_ECX
id = EVP_PKEY_ED25519;
md = NULL;
pkey = load_example_ed25519_key();
@@ -4324,7 +4328,7 @@ static int test_custom_pmeth(int idx)
# endif
case 5:
case 11:
-# ifndef OPENSSL_NO_EC
+# ifndef OPENSSL_NO_ECX
id = EVP_PKEY_X25519;
doderive = 1;
pkey = load_example_x25519_key();
@@ -4648,6 +4652,11 @@ static int test_signatures_with_engine(int tst)
if (tst <= 1)
return 1;
# endif
+# ifdef OPENSSL_NO_ECX
+ /* Skip ECX tests in a no-ecx build */
+ if (tst == 2)
+ return 1;
+# endif
if (!TEST_ptr(e = ENGINE_by_id(engine_id)))
return 0;
@@ -4761,6 +4770,7 @@ static int test_cipher_with_engine(void)
# endif /* OPENSSL_NO_DYNAMIC_ENGINE */
#endif /* OPENSSL_NO_DEPRECATED_3_0 */
+#ifndef OPENSSL_NO_ECX
static int ecxnids[] = {
NID_X25519,
NID_X448,
@@ -4784,6 +4794,7 @@ static int test_ecx_short_keys(int tst)
return 1;
}
+#endif
typedef enum OPTION_choice {
OPT_ERR = -1,
@@ -4802,7 +4813,7 @@ const OPTIONS *test_get_options(void)
return options;
}
-#ifndef OPENSSL_NO_EC
+#ifndef OPENSSL_NO_ECX
/* Test that trying to sign with a public key errors out gracefully */
static int test_ecx_not_private_key(int tst)
{
@@ -4867,7 +4878,7 @@ static int test_ecx_not_private_key(int tst)
return testresult;
}
-#endif /* OPENSSL_NO_EC */
+#endif /* OPENSSL_NO_ECX */
static int test_sign_continuation(void)
{
@@ -5065,9 +5076,8 @@ int setup_tests(void)
# endif
#endif
+#ifndef OPENSSL_NO_ECX
ADD_ALL_TESTS(test_ecx_short_keys, OSSL_NELEM(ecxnids));
-
-#ifndef OPENSSL_NO_EC
ADD_ALL_TESTS(test_ecx_not_private_key, OSSL_NELEM(keys));
#endif