diff options
author | Rich Salz <rsalz@akamai.com> | 2020-12-08 10:13:54 -0500 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-01-21 12:08:46 +0100 |
commit | a3d267f18492a1e874534d5af6072bc8b7a290e5 (patch) | |
tree | c52694a08afe3ee51be563a2ebb6118acf63d44f /test/evp_test.c | |
parent | 3aa7212e0a4fd1533c8a28b8587dd8b022f3a66f (diff) |
Deprecate EVP_KEY_new_CMAC_key and EVP_PKEY_new_CMAC_key_ex
EVP_KEY_new_CMAC_key_ex was in the pre-release 3.0 only, so is safe
to remove.
Restore 1.1.1 version of EVP_PKEY_new_CMAC_key documentation.
Also make testing of EVP_PKEY_new_CMAC_key properly #ifdef'd.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13829)
Diffstat (limited to 'test/evp_test.c')
-rw-r--r-- | test/evp_test.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/test/evp_test.c b/test/evp_test.c index b1c9c72b8b..94bbdc7a35 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -7,6 +7,7 @@ * https://www.openssl.org/source/license.html */ +#define OPENSSL_SUPPRESS_DEPRECATED /* EVP_PKEY_new_CMAC_key */ #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -1152,6 +1153,14 @@ static int mac_test_run_pkey(EVP_TEST *t) OBJ_nid2sn(expected->type), expected->alg); if (expected->type == EVP_PKEY_CMAC) { +#ifdef OPENSSL_NO_DEPRECATED_3_0 + TEST_info("skipping, PKEY CMAC '%s' is disabled", expected->alg); + t->skip = 1; + t->err = NULL; + goto err; +#else + OSSL_LIB_CTX *tmpctx; + if (expected->alg != NULL && is_cipher_disabled(expected->alg)) { TEST_info("skipping, PKEY CMAC '%s' is disabled", expected->alg); t->skip = 1; @@ -1162,8 +1171,11 @@ static int mac_test_run_pkey(EVP_TEST *t) t->err = "MAC_KEY_CREATE_ERROR"; goto err; } - key = EVP_PKEY_new_CMAC_key_ex(expected->key, expected->key_len, - EVP_CIPHER_name(cipher), libctx, NULL); + tmpctx = OSSL_LIB_CTX_set0_default(libctx); + key = EVP_PKEY_new_CMAC_key(NULL, expected->key, expected->key_len, + cipher); + OSSL_LIB_CTX_set0_default(tmpctx); +#endif } else { key = EVP_PKEY_new_raw_private_key_ex(libctx, OBJ_nid2sn(expected->type), NULL, |