summaryrefslogtreecommitdiffstats
path: root/test/keymgmt_internal_test.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-03-21 06:21:26 +0100
committerRichard Levitte <levitte@openssl.org>2020-03-25 17:01:10 +0100
commitacb90ba8ffe6a27f625607760e82842673eb9378 (patch)
treee2960e7bf66bf703ec58c26942462a1cbf27ed7b /test/keymgmt_internal_test.c
parentEVP: Add EVP_PKEY_set_type_by_keymgmt() and use it (diff)
downloadopenssl-acb90ba8ffe6a27f625607760e82842673eb9378.tar.xz
openssl-acb90ba8ffe6a27f625607760e82842673eb9378.zip
EVP: Downgrade keys rather than upgrade
Upgrading EVP_PKEYs from containing legacy keys to containing provider side keys proved to be risky, with a number of unpleasant corner cases, and with functions like EVP_PKEY_get0_DSA() failing unexpectedly. We therefore change course, and instead of upgrading legacy internal keys to provider side internal keys, we downgrade provider side internal keys to legacy ones. To be able to do this, we add |import_from| and make it a callback function designed for evp_keymgmt_export(). This means that evp_pkey_upgrade_to_provider() is replaced with evp_pkey_downgrade(). EVP_PKEY_copy_parameters() is the most deeply affected function of this change. Fixes #11366 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11375)
Diffstat (limited to 'test/keymgmt_internal_test.c')
-rw-r--r--test/keymgmt_internal_test.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/test/keymgmt_internal_test.c b/test/keymgmt_internal_test.c
index 5ef238ccf1..fd60893a45 100644
--- a/test/keymgmt_internal_test.c
+++ b/test/keymgmt_internal_test.c
@@ -207,14 +207,10 @@ static int test_pass_rsa(FIXTURE *fixture)
|| !TEST_ptr_ne(km1, km2))
goto err;
- if (!TEST_ptr(evp_pkey_export_to_provider(pk, NULL, &km1, NULL))
- || !TEST_ptr(evp_pkey_upgrade_to_provider(pk, NULL, &km1, NULL))
- || !TEST_ptr(provkey = evp_keymgmt_util_export_to_provider(pk, km2)))
- goto err;
-
- if (!TEST_true(evp_keymgmt_export(km2, provkey,
- OSSL_KEYMGMT_SELECT_KEYPAIR,
- &export_cb, keydata)))
+ if (!TEST_ptr(provkey = evp_pkey_export_to_provider(pk, NULL, &km1, NULL))
+ || !TEST_true(evp_keymgmt_export(km2, provkey,
+ OSSL_KEYMGMT_SELECT_KEYPAIR,
+ &export_cb, keydata)))
goto err;
/*