summaryrefslogtreecommitdiffstats
path: root/test/tls-provider.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-08 19:02:44 +0200
committerTomas Mraz <tomas@openssl.org>2021-04-15 09:19:39 +0200
commit85fcc3fb777c527a614e58c23609210a9edf893b (patch)
treea65bb21725443e5c2180de6a5a85d69085233ee5 /test/tls-provider.c
parentAdd selection support to the provider keymgmt_dup function (diff)
downloadopenssl-85fcc3fb777c527a614e58c23609210a9edf893b.tar.xz
openssl-85fcc3fb777c527a614e58c23609210a9edf893b.zip
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 'test/tls-provider.c')
-rw-r--r--test/tls-provider.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/tls-provider.c b/test/tls-provider.c
index 1085273a32..482c3aa0da 100644
--- a/test/tls-provider.c
+++ b/test/tls-provider.c
@@ -52,7 +52,7 @@ typedef struct xorkey_st {
static OSSL_FUNC_keymgmt_new_fn xor_newdata;
static OSSL_FUNC_keymgmt_free_fn xor_freedata;
static OSSL_FUNC_keymgmt_has_fn xor_has;
-static OSSL_FUNC_keymgmt_copy_fn xor_copy;
+static OSSL_FUNC_keymgmt_dup_fn xor_dup;
static OSSL_FUNC_keymgmt_gen_init_fn xor_gen_init;
static OSSL_FUNC_keymgmt_gen_set_params_fn xor_gen_set_params;
static OSSL_FUNC_keymgmt_gen_settable_params_fn xor_gen_settable_params;
@@ -440,9 +440,9 @@ static int xor_has(const void *vkey, int selection)
return ok;
}
-static int xor_copy(void *vtokey, const void *vfromkey, int selection)
+static void *xor_dup(const void *vfromkey, int selection)
{
- XORKEY *tokey = vtokey;
+ XORKEY *tokey = xor_newdata(NULL);
const XORKEY *fromkey = vfromkey;
int ok = 0;
@@ -466,7 +466,11 @@ static int xor_copy(void *vtokey, const void *vfromkey, int selection)
}
}
}
- return ok;
+ if (!ok) {
+ xor_freedata(tokey);
+ tokey = NULL;
+ }
+ return tokey;
}
static ossl_inline int xor_get_params(void *vkey, OSSL_PARAM params[])
@@ -706,7 +710,7 @@ static const OSSL_DISPATCH xor_keymgmt_functions[] = {
{ OSSL_FUNC_KEYMGMT_SET_PARAMS, (void (*) (void))xor_set_params },
{ OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS, (void (*) (void))xor_settable_params },
{ OSSL_FUNC_KEYMGMT_HAS, (void (*)(void))xor_has },
- { OSSL_FUNC_KEYMGMT_COPY, (void (*)(void))xor_copy },
+ { OSSL_FUNC_KEYMGMT_DUP, (void (*)(void))xor_dup },
{ OSSL_FUNC_KEYMGMT_FREE, (void (*)(void))xor_freedata },
{ OSSL_FUNC_KEYMGMT_IMPORT, (void (*)(void))xor_import },
{ OSSL_FUNC_KEYMGMT_IMPORT_TYPES, (void (*)(void))xor_import_types },