提交 13697f1c 编写于 作者: R Richard Levitte

KEYMGMT: Add a keydata copy function

Reviewed-by: NShane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11158)
上级 1e9101c4
......@@ -92,6 +92,7 @@ struct evp_keymgmt_st {
OSSL_OP_keymgmt_import_types_fn *import_types;
OSSL_OP_keymgmt_export_fn *export;
OSSL_OP_keymgmt_export_types_fn *export_types;
OSSL_OP_keymgmt_copy_fn *copy;
} /* EVP_KEYMGMT */ ;
struct evp_keyexch_st {
......
......@@ -335,3 +335,13 @@ const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt,
return NULL;
return keymgmt->export_types(selection);
}
int evp_keymgmt_copy(const EVP_KEYMGMT *keymgmt,
void *keydata_to, const void *keydata_from,
int selection)
{
/* We assume no copy if the implementation doesn't have a function */
if (keymgmt->copy == NULL)
return 0;
return keymgmt->copy(keydata_to, keydata_from, selection);
}
......@@ -39,6 +39,9 @@ provider-keymgmt - The KEYMGMT library E<lt>-E<gt> provider functions
OSSL_CALLBACK *param_cb, void *cbarg);
const OSSL_PARAM *OP_keymgmt_export_types(int selection);
/* Key object copy */
int OP_keymgmt_copy(void *keydata_to, const void *keydata_from, int selection);
/* Key object validation */
int OP_keymgmt_validate(void *keydata, int selection);
......@@ -93,6 +96,7 @@ macros in L<openssl-core_numbers.h(7)>, as follows:
OP_keymgmt_export OSSL_FUNC_KEYMGMT_EXPORT
OP_keymgmt_export_types OSSL_FUNC_KEYMGMT_EXPORT_TYPES
OP_keymgmt_copy OSSL_FUNC_KEYMGMT_COPY
=head2 Key Objects
......@@ -247,7 +251,7 @@ I<selection> in I<keydata1> and I<keydata2> match. It is assumed that
the caller has ensured that I<keydata1> and I<keydata2> are both owned
by the implementation of this function.
=head2 Key Object Import and Export Functions
=head2 Key Object Import, Export and Copy Functions
OP_keymgmt_import() should import data indicated by I<selection> into
I<keydata> with values taken from the B<OSSL_PARAM> array I<params>.
......@@ -264,6 +268,11 @@ OP_keymgmt_export_types() should return a constant array of descriptor
B<OSSL_PARAM> for data indicated by I<selection>, that the
OP_keymgmt_export() callback can expect to receive.
OP_keymgmt_copy() should copy data subsets indicated by I<selection>
from I<keydata_from> to I<keydata_to>. It is assumed that the caller
has ensured that I<keydata_to> and I<keydata_from> are both owned by
the implementation of this function.
=head2 Built-in RSA Import/Export Types
The following Import/Export types are available for the built-in RSA algorithm:
......
......@@ -651,6 +651,9 @@ int evp_keymgmt_export(const EVP_KEYMGMT *keymgmt, void *keydata,
int selection, OSSL_CALLBACK *param_cb, void *cbarg);
const OSSL_PARAM *evp_keymgmt_export_types(const EVP_KEYMGMT *keymgmt,
int selection);
int evp_keymgmt_copy(const EVP_KEYMGMT *keymgmt,
void *keydata_to, const void *keydata_from,
int selection);
/* Pulling defines out of C source files */
......
......@@ -418,7 +418,7 @@ OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_match,
(const void *keydata1, const void *keydata2,
int selection))
/* Import and export functions, with ddiscovery */
/* Import and export functions, with discovery */
# define OSSL_FUNC_KEYMGMT_IMPORT 40
# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES 41
# define OSSL_FUNC_KEYMGMT_EXPORT 42
......@@ -433,6 +433,12 @@ OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_export,
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_export_types,
(int selection))
/* Copy function, only works for matching keymgmt */
# define OSSL_FUNC_KEYMGMT_COPY 44
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_copy,
( void *keydata_to, const void *keydata_from,
int selection))
/* Key Exchange */
# define OSSL_FUNC_KEYEXCH_NEWCTX 1
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册