summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPauli <paul.dale@oracle.com>2020-02-13 11:00:57 +1000
committerPauli <paul.dale@oracle.com>2020-07-22 20:19:01 +1000
commit41bbba537598522daaf8369778de6d1225a4998e (patch)
treecf4eb63dab871fc339eb4ca325fd30b0019752ca /test
parent77ae4f6ff7af7d099206a1fc229be7a3ea0e0596 (diff)
EVP: deprecate the EVP_X_meth_ functions.
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11082)
Diffstat (limited to 'test')
-rw-r--r--test/build.info8
-rw-r--r--test/enginetest.c2
-rw-r--r--test/evp_extra_test.c13
-rw-r--r--test/evp_fetch_prov_test.c8
-rw-r--r--test/pkey_meth_test.c7
-rw-r--r--test/recipes/30-test_engine.t4
6 files changed, 35 insertions, 7 deletions
diff --git a/test/build.info b/test/build.info
index ed547d1488..a49d9c6d6e 100644
--- a/test/build.info
+++ b/test/build.info
@@ -27,14 +27,14 @@ IF[{- !$disabled{tests} -}]
INCLUDE[libtestutil.a]=../include ../apps/include ..
DEPEND[libtestutil.a]=../libcrypto
- PROGRAMS{noinst}=\
+ PROGRAMS{noinst}= \
confdump \
versions \
aborttest test_test \
sanitytest rsa_complex exdatatest bntest \
ectest ecstresstest gmdifftest pbelutest \
destest mdc2test \
- enginetest exptest \
+ exptest \
evp_pkey_provided_test evp_test evp_extra_test evp_extra_test2 \
evp_fetch_prov_test acvp_test evp_libctx_test \
v3nametest v3ext \
@@ -59,6 +59,10 @@ IF[{- !$disabled{tests} -}]
context_internal_test aesgcmtest params_test evp_pkey_dparams_test \
keymgmt_internal_test hexstr_test
+ IF[{- !$disabled{'deprecated-3.0'} -}]
+ PROGRAMS{noinst}=enginetest
+ ENDIF
+
SOURCE[confdump]=confdump.c
INCLUDE[confdump]=../include ../apps/include
DEPEND[confdump]=../libcrypto
diff --git a/test/enginetest.c b/test/enginetest.c
index f3f020cc30..67e4941cdf 100644
--- a/test/enginetest.c
+++ b/test/enginetest.c
@@ -7,7 +7,7 @@
* https://www.openssl.org/source/license.html
*/
-/* We need to use some engine deprecated APIs */
+/* We need to use some deprecated APIs */
#define OPENSSL_SUPPRESS_DEPRECATED
#include <stdio.h>
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index f31ba31e09..51b517fb95 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -7,6 +7,9 @@
* https://www.openssl.org/source/license.html
*/
+/* We need to use some deprecated APIs */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -1140,6 +1143,7 @@ static int test_set_get_raw_keys(int tst)
&& test_set_get_raw_keys_int(tst, 1, 1);
}
+#ifndef OPENSSL_NO_DEPRECATED_3_0
static int pkey_custom_check(EVP_PKEY *pkey)
{
return 0xbeef;
@@ -1156,6 +1160,7 @@ static int pkey_custom_param_check(EVP_PKEY *pkey)
}
static EVP_PKEY_METHOD *custom_pmeth;
+#endif
static int test_EVP_PKEY_check(int i)
{
@@ -1166,7 +1171,9 @@ static int test_EVP_PKEY_check(int i)
EC_KEY *eckey = NULL;
#endif
EVP_PKEY_CTX *ctx = NULL;
+#ifndef OPENSSL_NO_DEPRECATED_3_0
EVP_PKEY_CTX *ctx2 = NULL;
+#endif
const APK_DATA *ak = &keycheckdata[i];
const unsigned char *input = ak->kder;
size_t input_len = ak->size;
@@ -1218,6 +1225,7 @@ static int test_EVP_PKEY_check(int i)
if (!TEST_int_eq(EVP_PKEY_param_check(ctx), expected_param_check))
goto done;
+#ifndef OPENSSL_NO_DEPRECATED_3_0
ctx2 = EVP_PKEY_CTX_new_id(0xdefaced, NULL);
/* assign the pkey directly, as an internal test */
EVP_PKEY_up_ref(pkey);
@@ -1231,12 +1239,15 @@ static int test_EVP_PKEY_check(int i)
if (!TEST_int_eq(EVP_PKEY_param_check(ctx2), 0xbeef))
goto done;
+#endif
ret = 1;
done:
EVP_PKEY_CTX_free(ctx);
+#ifndef OPENSSL_NO_DEPRECATED_3_0
EVP_PKEY_CTX_free(ctx2);
+#endif
EVP_PKEY_free(pkey);
BIO_free(pubkey);
return ret;
@@ -1822,6 +1833,7 @@ int setup_tests(void)
ADD_TEST(test_EVP_SM2_verify);
#endif
ADD_ALL_TESTS(test_set_get_raw_keys, OSSL_NELEM(keys));
+#ifndef OPENSSL_NO_DEPRECATED_3_0
custom_pmeth = EVP_PKEY_meth_new(0xdefaced, 0);
if (!TEST_ptr(custom_pmeth))
return 0;
@@ -1830,6 +1842,7 @@ int setup_tests(void)
EVP_PKEY_meth_set_param_check(custom_pmeth, pkey_custom_param_check);
if (!TEST_int_eq(EVP_PKEY_meth_add0(custom_pmeth), 1))
return 0;
+#endif
ADD_ALL_TESTS(test_EVP_PKEY_check, OSSL_NELEM(keycheckdata));
#ifndef OPENSSL_NO_CMAC
ADD_TEST(test_CMAC_keygen);
diff --git a/test/evp_fetch_prov_test.c b/test/evp_fetch_prov_test.c
index 367493b5e7..d7f43f229d 100644
--- a/test/evp_fetch_prov_test.c
+++ b/test/evp_fetch_prov_test.c
@@ -146,7 +146,7 @@ static int test_EVP_MD_fetch(void)
if (!TEST_true(EVP_MD_up_ref(md)))
goto err;
/* Ref count should now be 2. Release first one here */
- EVP_MD_meth_free(md);
+ EVP_MD_free(md);
} else {
if (!TEST_ptr_null(md))
goto err;
@@ -154,7 +154,7 @@ static int test_EVP_MD_fetch(void)
ret = 1;
err:
- EVP_MD_meth_free(md);
+ EVP_MD_free(md);
OSSL_PROVIDER_unload(prov[0]);
OSSL_PROVIDER_unload(prov[1]);
/* Not normally needed, but we would like to test that
@@ -218,7 +218,7 @@ static int test_EVP_CIPHER_fetch(void)
if (!TEST_true(EVP_CIPHER_up_ref(cipher)))
goto err;
/* Ref count should now be 2. Release first one here */
- EVP_CIPHER_meth_free(cipher);
+ EVP_CIPHER_free(cipher);
}
} else {
if (!TEST_ptr_null(cipher))
@@ -226,7 +226,7 @@ static int test_EVP_CIPHER_fetch(void)
}
ret = 1;
err:
- EVP_CIPHER_meth_free(cipher);
+ EVP_CIPHER_free(cipher);
OSSL_PROVIDER_unload(prov[0]);
OSSL_PROVIDER_unload(prov[1]);
OPENSSL_CTX_free(ctx);
diff --git a/test/pkey_meth_test.c b/test/pkey_meth_test.c
index 6f81249417..ecff269fec 100644
--- a/test/pkey_meth_test.c
+++ b/test/pkey_meth_test.c
@@ -9,6 +9,9 @@
/* Internal tests for EVP_PKEY method ordering */
+/* We need to use some deprecated APIs */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <stdio.h>
#include <string.h>
@@ -47,6 +50,7 @@ static int test_asn1_meths(void)
return good;
}
+#ifndef OPENSSL_NO_DEPRECATED_3_0
/* Test of EVP_PKEY_METHOD ordering */
static int test_pkey_meths(void)
{
@@ -74,10 +78,13 @@ static int test_pkey_meths(void)
}
return good;
}
+#endif
int setup_tests(void)
{
ADD_TEST(test_asn1_meths);
+#ifndef OPENSSL_NO_DEPRECATED_3_0
ADD_TEST(test_pkey_meths);
+#endif
return 1;
}
diff --git a/test/recipes/30-test_engine.t b/test/recipes/30-test_engine.t
index 2edba22599..443c0484b2 100644
--- a/test/recipes/30-test_engine.t
+++ b/test/recipes/30-test_engine.t
@@ -11,8 +11,12 @@ use strict;
use warnings;
use OpenSSL::Test;
+use OpenSSL::Test::Utils;
setup("test_engine");
+plan skip_all => "engines are deprecated"
+ if disabled('deprecated-3.0');
+
plan tests => 1;
ok(run(test(["enginetest"])), "running enginetest");