diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-04-08 19:02:44 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-04-15 09:19:39 +0200 |
commit | 85fcc3fb777c527a614e58c23609210a9edf893b (patch) | |
tree | a65bb21725443e5c2180de6a5a85d69085233ee5 /crypto/evp/p_lib.c | |
parent | b4f447c038c05260491eb880e4a9c420b476c119 (diff) |
Remove keymgmt_copy function from the provider API
It is superceded by the keymgmt_dup.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14793)
Diffstat (limited to 'crypto/evp/p_lib.c')
-rw-r--r-- | crypto/evp/p_lib.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 04d9c80bd3..de4f1811c1 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -180,10 +180,12 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) /* * If |to| is provided, we know that |from| is legacy at this point. - * Try exporting |from| to |to|'s keymgmt, then use evp_keymgmt_copy() + * Try exporting |from| to |to|'s keymgmt, then use evp_keymgmt_dup() * to copy the appropriate data to |to|'s keydata. + * We cannot override existing data so do it only if there is no keydata + * in |to| yet. */ - if (to->keymgmt != NULL) { + if (to->keymgmt != NULL && to->keydata == NULL) { EVP_KEYMGMT *to_keymgmt = to->keymgmt; void *from_keydata = evp_pkey_export_to_provider((EVP_PKEY *)from, NULL, &to_keymgmt, @@ -196,8 +198,9 @@ int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) if (from_keydata == NULL) ERR_raise(ERR_LIB_EVP, EVP_R_DIFFERENT_KEY_TYPES); else - ok = evp_keymgmt_copy(to->keymgmt, to->keydata, from_keydata, - SELECT_PARAMETERS); + ok = (to->keydata = evp_keymgmt_dup(to->keymgmt, + from_keydata, + SELECT_PARAMETERS)) != NULL; goto end; } |