return NULL;
}
- ret->keydata = ctx->op.kex.exchange->derive_skey(ctx->op.kex.algctx,
+ ret->keydata = ctx->op.kex.exchange->derive_skey(ctx->op.kex.algctx, key_type,
ossl_provider_ctx(skeymgmt->prov),
skeymgmt->import, keylen, params);
return NULL;
}
- ret->keydata = ctx->meth->derive_skey(ctx->algctx, ossl_provider_ctx(skeymgmt->prov),
+ ret->keydata = ctx->meth->derive_skey(ctx->algctx, key_type, ossl_provider_ctx(skeymgmt->prov),
skeymgmt->import, keylen, params);
if (ret->keydata == NULL) {
EVP_SKEY_free(ret);
int OSSL_FUNC_kdf_reset(void *kctx);
int OSSL_FUNC_kdf_derive(void *kctx, unsigned char *key, size_t keylen,
const OSSL_PARAM params[]);
- void *OSSL_FUNC_kdf_derive_skey(void *ctx, void *provctx,
+ void *OSSL_FUNC_kdf_derive_skey(void *ctx, const char *key_type, void *provctx,
OSSL_FUNC_skeymgmt_import_fn *import,
size_t keylen, const OSSL_PARAM params[]);
return error.
OSSL_FUNC_kdf_derive_skey() is similar to OSSL_FUNC_kdf_derive() but uses an
-opaque object for storing the derived key.
+opaque object for storing the derived key. It accepts I<key_type> parameter to
+give a hint to the provider what type of the key (e.g. generic or AES) would be
+generated and I<import> function from the B<EVP_SKEYMGMT> object to be
+associated with the key. The B<EVP_SKEYMGMT> object comes from the same
+provider as the KDF itself.
=head2 KDF Parameters
int OSSL_FUNC_keyexch_set_peer(void *ctx, void *provkey);
int OSSL_FUNC_keyexch_derive(void *ctx, unsigned char *secret, size_t *secretlen,
size_t outlen);
- int OSSL_FUNC_keyexch_derive_skey(void *ctx, void *provctx,
+ int OSSL_FUNC_keyexch_derive_skey(void *ctx, const char *key_type, void *provctx,
OSSL_FUNC_skeymgmt_import_fn *import,
size_t keylen, const OSSL_PARAM params[]);
If I<secret> is NULL then the maximum length of the shared secret should be
written to I<*secretlen>.
-OSSL_FUNC_keyexch_derive_skey() is similar to OSSL_FUNC_keyexch_derive() but works
-with an opaque provider-specific object instead of raw bytes buffer.
+OSSL_FUNC_keyexch_derive_skey() is similar to OSSL_FUNC_keyexch_derive() but
+uses an opaque object for storing the derived key. It accepts I<key_type>
+parameter to give a hint to the provider what type of the key (e.g. generic or
+AES) would be generated and I<import> function from the B<EVP_SKEYMGMT> object
+to be associated with the key. The B<EVP_SKEYMGMT> object comes from the same
+provider as the KDF itself.
=head2 Key Exchange Parameters Functions
(void *kctx, const OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(int, kdf_set_skey,
(void *kctx, void *skeydata, const char *paramname))
-OSSL_CORE_MAKE_FUNC(void *, kdf_derive_skey, (void *ctx, void *provctx,
+OSSL_CORE_MAKE_FUNC(void *, kdf_derive_skey, (void *ctx, const char *key_type, void *provctx,
OSSL_FUNC_skeymgmt_import_fn *import,
size_t keylen, const OSSL_PARAM params[]))
OSSL_PARAM params[]))
OSSL_CORE_MAKE_FUNC(const OSSL_PARAM *, keyexch_gettable_ctx_params,
(void *ctx, void *provctx))
-OSSL_CORE_MAKE_FUNC(void *, keyexch_derive_skey, (void *ctx, void *provctx,
+OSSL_CORE_MAKE_FUNC(void *, keyexch_derive_skey, (void *ctx, const char *key_type, void *provctx,
OSSL_FUNC_skeymgmt_import_fn *import,
size_t keylen, const OSSL_PARAM params[]))
}
static
-void *ecdh_derive_skey(void *vpecdhctx, void *provctx, OSSL_FUNC_skeymgmt_import_fn *import,
+void *ecdh_derive_skey(void *vpecdhctx, const char *key_type ossl_unused,
+ void *provctx, OSSL_FUNC_skeymgmt_import_fn *import,
size_t outlen, const OSSL_PARAM params_in[] ossl_unused)
{
unsigned char *secret = NULL;
}
static
-void *kdf_pbkdf1_derive_skey(void *vctx, void *provctx, OSSL_FUNC_skeymgmt_import_fn *import,
+void *kdf_pbkdf1_derive_skey(void *vctx, const char *key_type ossl_unused, void *provctx,
+ OSSL_FUNC_skeymgmt_import_fn *import,
size_t keylen, const OSSL_PARAM params[])
{
unsigned char *key = NULL;