Latest update.
This commit is contained in:
@@ -333,100 +333,94 @@ OSSL_CORE_MAKE_FUNC(int, OP_kdf_set_ctx_params,
|
||||
/*-
|
||||
* Key management
|
||||
*
|
||||
* Key domain parameter references can be created in several manners:
|
||||
* - by importing the domain parameter material via an OSSL_PARAM array.
|
||||
* - by generating key domain parameters, given input via an OSSL_PARAM
|
||||
* array.
|
||||
* The Key Management takes care of provider side key objects, and includes
|
||||
* all current functionality to create them, destroy them, set parameters
|
||||
* and key material, etc, essentially everything that manipulates the keys
|
||||
* themselves and their parameters.
|
||||
*
|
||||
* Key references can be created in several manners:
|
||||
* - by importing the key material via an OSSL_PARAM array.
|
||||
* - by generating a key, given optional domain parameters and
|
||||
* additional keygen parameters.
|
||||
* If domain parameters are given, they must have been generated using
|
||||
* the domain parameter generator functions.
|
||||
* If the domain parameters comes from a different provider, results
|
||||
* are undefined.
|
||||
* THE CALLER MUST ENSURE THAT CORRECT DOMAIN PARAMETERS ARE USED.
|
||||
* - by loading an internal key, given a binary blob that forms an identity.
|
||||
* THE CALLER MUST ENSURE THAT A CORRECT IDENTITY IS USED.
|
||||
* The key objects are commonly refered to as |keydata|, and it MUST be able
|
||||
* to contain parameters if the key has any, the public key and the private
|
||||
* key. All parts are optional, but their presence determines what can be
|
||||
* done with the key object in terms of encryption, signature, and so on.
|
||||
* The assumption from libcrypto is that the key object contains any of the
|
||||
* following data combinations:
|
||||
*
|
||||
* - parameters only
|
||||
* - public key only
|
||||
* - public key + private key
|
||||
* - parameters + public key
|
||||
* - parameters + public key + private key
|
||||
*
|
||||
* What "parameters", "public key" and "private key" means in detail is left
|
||||
* to the implementation. In the case of DH and DSA, they would typically
|
||||
* include domain parameters, while for certain variants of RSA, they would
|
||||
* typically include PSS or OAEP parameters.
|
||||
*
|
||||
* Key objects are created with OP_keymgmt_new() and destroyed with
|
||||
* Op_keymgmt_free(). Key objects can have data filled in with
|
||||
* OP_keymgmt_import().
|
||||
*
|
||||
* Three functions are made available to check what selection of data is
|
||||
* present in a key object: OP_keymgmt_has_parameters(),
|
||||
* OP_keymgmt_has_public_key(), and OP_keymgmt_has_private_key(),
|
||||
*/
|
||||
|
||||
/* Key domain parameter creation and destruction */
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORTDOMPARAMS 1
|
||||
# define OSSL_FUNC_KEYMGMT_GENDOMPARAMS 2
|
||||
# define OSSL_FUNC_KEYMGMT_FREEDOMPARAMS 3
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_importdomparams,
|
||||
(void *provctx, const OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_gendomparams,
|
||||
(void *provctx, const OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(void, OP_keymgmt_freedomparams, (void *domparams))
|
||||
/* Key data subset selection - individual bits */
|
||||
# define OSSL_KEYMGMT_SELECT_PRIVATE_KEY 0x01
|
||||
# define OSSL_KEYMGMT_SELECT_PUBLIC_KEY 0x02
|
||||
# define OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS 0x04
|
||||
# define OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS 0x80
|
||||
|
||||
/* Key domain parameter export */
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORTDOMPARAMS 4
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_exportdomparams,
|
||||
(void *domparams, OSSL_CALLBACK *param_cb, void *cbarg))
|
||||
/* Key data subset selection - combinations */
|
||||
# define OSSL_KEYMGMT_SELECT_ALL_PARAMETERS \
|
||||
( OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS \
|
||||
| OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
|
||||
# define OSSL_KEYMGMT_SELECT_KEYPAIR \
|
||||
( OSSL_KEYMGMT_SELECT_PRIVATE_KEY | OSSL_KEYMGMT_SELECT_PUBLIC_KEY )
|
||||
# define OSSL_KEYMGMT_SELECT_ALL \
|
||||
( OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_ALL_PARAMETERS )
|
||||
|
||||
/* Key domain parameter discovery */
|
||||
/*
|
||||
* TODO(v3.0) investigate if we need OP_keymgmt_exportdomparam_types.
|
||||
* 'openssl provider' may be a caller...
|
||||
*/
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORTDOMPARAM_TYPES 5
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORTDOMPARAM_TYPES 6
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importdomparam_types,
|
||||
(void))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportdomparam_types,
|
||||
(void))
|
||||
/* Basic key object creation, destruction */
|
||||
# define OSSL_FUNC_KEYMGMT_NEW 1
|
||||
# define OSSL_FUNC_KEYMGMT_FREE 9
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_new, (void *provctx))
|
||||
OSSL_CORE_MAKE_FUNC(void, OP_keymgmt_free, (void *keydata))
|
||||
|
||||
/* Key domain parameter information */
|
||||
#define OSSL_FUNC_KEYMGMT_GET_DOMPARAM_PARAMS 7
|
||||
#define OSSL_FUNC_KEYMGMT_GETTABLE_DOMPARAM_PARAMS 8
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_domparam_params,
|
||||
(void *domparam, OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_domparam_params,
|
||||
(void))
|
||||
/* Key object information, with discovery */
|
||||
#define OSSL_FUNC_KEYMGMT_GET_PARAMS 10
|
||||
#define OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS 11
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_params,
|
||||
(void *keydata, OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_params, (void))
|
||||
|
||||
/* Key creation and destruction */
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORTKEY 20
|
||||
# define OSSL_FUNC_KEYMGMT_GENKEY 21
|
||||
# define OSSL_FUNC_KEYMGMT_LOADKEY 22
|
||||
# define OSSL_FUNC_KEYMGMT_FREEKEY 23
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_importkey,
|
||||
(void *provctx, const OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_genkey,
|
||||
(void *provctx,
|
||||
void *domparams, const OSSL_PARAM genkeyparams[]))
|
||||
OSSL_CORE_MAKE_FUNC(void *, OP_keymgmt_loadkey,
|
||||
(void *provctx, void *id, size_t idlen))
|
||||
OSSL_CORE_MAKE_FUNC(void, OP_keymgmt_freekey, (void *key))
|
||||
|
||||
/* Key export */
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORTKEY 24
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_exportkey,
|
||||
(void *key, OSSL_CALLBACK *param_cb, void *cbarg))
|
||||
|
||||
/* Key discovery */
|
||||
/*
|
||||
* TODO(v3.0) investigate if we need OP_keymgmt_exportkey_types.
|
||||
* 'openssl provider' may be a caller...
|
||||
*/
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORTKEY_TYPES 25
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORTKEY_TYPES 26
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_importkey_types, (void))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_exportkey_types, (void))
|
||||
|
||||
/* Key information */
|
||||
#define OSSL_FUNC_KEYMGMT_GET_KEY_PARAMS 27
|
||||
#define OSSL_FUNC_KEYMGMT_GETTABLE_KEY_PARAMS 28
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_get_key_params,
|
||||
(void *key, OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_gettable_key_params, (void))
|
||||
|
||||
/* Discovery of supported operations */
|
||||
# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 40
|
||||
OSSL_CORE_MAKE_FUNC(const char *,OP_keymgmt_query_operation_name,
|
||||
/* Key checks - discovery of supported operations */
|
||||
# define OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME 20
|
||||
OSSL_CORE_MAKE_FUNC(const char *, OP_keymgmt_query_operation_name,
|
||||
(int operation_id))
|
||||
|
||||
/* Key checks - key data content checks */
|
||||
# define OSSL_FUNC_KEYMGMT_HAS 21
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_has, (void *keydata, int selection))
|
||||
|
||||
/* Key checks - validation */
|
||||
# define OSSL_FUNC_KEYMGMT_VALIDATE 22
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_validate, (void *keydata, int selection))
|
||||
|
||||
/* Import and export functions, with ddiscovery */
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORT 40
|
||||
# define OSSL_FUNC_KEYMGMT_IMPORT_TYPES 41
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORT 42
|
||||
# define OSSL_FUNC_KEYMGMT_EXPORT_TYPES 43
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_import,
|
||||
(void *keydata, int selection, const OSSL_PARAM params[]))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_import_types,
|
||||
(int selection))
|
||||
OSSL_CORE_MAKE_FUNC(int, OP_keymgmt_export,
|
||||
(void *keydata, int selection,
|
||||
OSSL_CALLBACK *param_cb, void *cbarg))
|
||||
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, OP_keymgmt_export_types,
|
||||
(int selection))
|
||||
|
||||
/* Key Exchange */
|
||||
|
||||
# define OSSL_FUNC_KEYEXCH_NEWCTX 1
|
||||
|
||||
Reference in New Issue
Block a user