894b27768c68091df4918b3219c91ed77d2d4054mcpowers * CDDL HEADER START
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * The contents of this file are subject to the terms of the
72eff6e227f67512593e6384d82fb5eb9be3121bmcpowers * Common Development and Distribution License (the "License").
72eff6e227f67512593e6384d82fb5eb9be3121bmcpowers * You may not use this file except in compliance with the License.
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * See the License for the specific language governing permissions
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * and limitations under the License.
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * When distributing Covered Code, include this CDDL HEADER in each
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * If applicable, add the following below this CDDL HEADER, with the
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * fields enclosed by brackets "[]" replaced with your own identifying
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * information: Portions Copyright [yyyy] [name of copyright owner]
894b27768c68091df4918b3219c91ed77d2d4054mcpowers * CDDL HEADER END
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
894b27768c68091df4918b3219c91ed77d2d4054mcpowers#define CRYPTO_OPS_OFFSET(f) offsetof(crypto_ops_t, co_##f)
894b27768c68091df4918b3219c91ed77d2d4054mcpowers#define CRYPTO_KEY_OFFSET(f) offsetof(crypto_key_ops_t, f)
894b27768c68091df4918b3219c91ed77d2d4054mcpowerscrypto_key_generate(crypto_provider_t provider, crypto_session_id_t sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_mechanism_t *mech, crypto_object_attribute_t *attrs, uint_t count,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_object_id_t *handle, crypto_call_req_t *crq)
436935a13231964207120b7e50a063b53b8e579cVladimir Kotal rv = kcf_get_hardware_provider(mech->cm_type, NULL,
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick CRYPTO_MECH_INVALID, NULL, pd, &real_provider,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers KCF_WRAP_KEY_OPS_PARAMS(¶ms, KCF_OP_KEY_GENERATE, sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers mech, attrs, count, handle, NULL, 0, NULL, NULL, NULL, 0);
894b27768c68091df4918b3219c91ed77d2d4054mcpowerscrypto_key_generate_pair(crypto_provider_t provider, crypto_session_id_t sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_mechanism_t *mech, crypto_object_attribute_t *pub_attrs,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers uint_t pub_count, crypto_object_attribute_t *pri_attrs, uint_t pri_count,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_object_id_t *pub_handle, crypto_object_id_t *pri_handle,
436935a13231964207120b7e50a063b53b8e579cVladimir Kotal rv = kcf_get_hardware_provider(mech->cm_type, NULL,
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick CRYPTO_MECH_INVALID, NULL, pd, &real_provider,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers rv = KCF_PROV_KEY_GENERATE_PAIR(real_provider, sid, mech,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers pub_attrs, pub_count, pri_attrs, pri_count, pub_handle,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers KCF_WRAP_KEY_OPS_PARAMS(¶ms, KCF_OP_KEY_GENERATE_PAIR,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers sid, mech, pub_attrs, pub_count, pub_handle, pri_attrs,
894b27768c68091df4918b3219c91ed77d2d4054mcpowerscrypto_key_wrap(crypto_provider_t provider, crypto_session_id_t sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_mechanism_t *mech, crypto_key_t *wrapping_key,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_object_id_t *key, uchar_t *wrapped_key, size_t *wrapped_key_len,
436935a13231964207120b7e50a063b53b8e579cVladimir Kotal rv = kcf_get_hardware_provider(mech->cm_type, wrapping_key,
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick CRYPTO_MECH_INVALID, NULL, pd, &real_provider,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers rv = KCF_PROV_KEY_WRAP(real_provider, sid, mech, wrapping_key,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers key, wrapped_key, wrapped_key_len, KCF_SWFP_RHNDL(crq));
894b27768c68091df4918b3219c91ed77d2d4054mcpowers KCF_WRAP_KEY_OPS_PARAMS(¶ms, KCF_OP_KEY_WRAP, sid, mech,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers NULL, 0, key, NULL, 0, NULL, wrapping_key, wrapped_key,
894b27768c68091df4918b3219c91ed77d2d4054mcpowerscrypto_key_unwrap(crypto_provider_t provider, crypto_session_id_t sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_mechanism_t *mech, crypto_key_t *unwrapping_key,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_object_attribute_t *attrs, uint_t count, crypto_object_id_t *key,
436935a13231964207120b7e50a063b53b8e579cVladimir Kotal rv = kcf_get_hardware_provider(mech->cm_type, unwrapping_key,
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick CRYPTO_MECH_INVALID, NULL, pd, &real_provider,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers unwrapping_key, wrapped_key, wrapped_key_len, attrs,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers KCF_WRAP_KEY_OPS_PARAMS(¶ms, KCF_OP_KEY_UNWRAP, sid, mech,
894b27768c68091df4918b3219c91ed77d2d4054mcpowerscrypto_key_derive(crypto_provider_t provider, crypto_session_id_t sid,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers crypto_object_id_t *new_key, crypto_call_req_t *crq)
436935a13231964207120b7e50a063b53b8e579cVladimir Kotal rv = kcf_get_hardware_provider(mech->cm_type, base_key,
9b009fc1b553084f6003dcd46b171890049de0ffValerie Bubb Fenwick CRYPTO_MECH_INVALID, NULL, pd, &real_provider,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers rv = KCF_PROV_KEY_DERIVE(real_provider, sid, mech, base_key,
894b27768c68091df4918b3219c91ed77d2d4054mcpowers KCF_WRAP_KEY_OPS_PARAMS(¶ms, KCF_OP_KEY_DERIVE, sid, mech,