summaryrefslogtreecommitdiffstats
path: root/test/evp_extra_test.c
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/evp_extra_test.c
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/evp_extra_test.c')
-rw-r--r--test/evp_extra_test.c13
1 files changed, 13 insertions, 0 deletions
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);