xref: /onnv-gate/usr/src/uts/common/crypto/api/kcf_object.c (revision 12304:bcfa0838b31e)
1904Smcpowers /*
2904Smcpowers  * CDDL HEADER START
3904Smcpowers  *
4904Smcpowers  * The contents of this file are subject to the terms of the
5*12304SValerie.Fenwick@Oracle.COM  * Common Development and Distribution License (the "License").
6*12304SValerie.Fenwick@Oracle.COM  * You may not use this file except in compliance with the License.
7904Smcpowers  *
8904Smcpowers  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9904Smcpowers  * or http://www.opensolaris.org/os/licensing.
10904Smcpowers  * See the License for the specific language governing permissions
11904Smcpowers  * and limitations under the License.
12904Smcpowers  *
13904Smcpowers  * When distributing Covered Code, include this CDDL HEADER in each
14904Smcpowers  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15904Smcpowers  * If applicable, add the following below this CDDL HEADER, with the
16904Smcpowers  * fields enclosed by brackets "[]" replaced with your own identifying
17904Smcpowers  * information: Portions Copyright [yyyy] [name of copyright owner]
18904Smcpowers  *
19904Smcpowers  * CDDL HEADER END
20904Smcpowers  */
21904Smcpowers /*
22*12304SValerie.Fenwick@Oracle.COM  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
23904Smcpowers  */
24904Smcpowers 
25904Smcpowers 
26904Smcpowers #include <sys/errno.h>
27904Smcpowers #include <sys/types.h>
28904Smcpowers #include <sys/kmem.h>
29904Smcpowers #include <sys/cmn_err.h>
30904Smcpowers #include <sys/sysmacros.h>
31904Smcpowers #include <sys/crypto/common.h>
32904Smcpowers #include <sys/crypto/impl.h>
33904Smcpowers #include <sys/crypto/api.h>
34904Smcpowers #include <sys/crypto/spi.h>
35904Smcpowers #include <sys/crypto/sched_impl.h>
36904Smcpowers 
37904Smcpowers #define	CRYPTO_OPS_OFFSET(f)		offsetof(crypto_ops_t, co_##f)
38904Smcpowers #define	CRYPTO_OBJECT_OFFSET(f)		offsetof(crypto_object_ops_t, f)
39904Smcpowers 
40904Smcpowers int
crypto_object_create(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_attribute_t * attrs,uint_t count,crypto_object_id_t * object_handle,crypto_call_req_t * crq)41904Smcpowers crypto_object_create(crypto_provider_t provider, crypto_session_id_t sid,
42904Smcpowers     crypto_object_attribute_t *attrs, uint_t count,
43904Smcpowers     crypto_object_id_t *object_handle, crypto_call_req_t *crq)
44904Smcpowers {
45904Smcpowers 	kcf_req_params_t params;
46904Smcpowers 	kcf_provider_desc_t *pd = provider;
47904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
48904Smcpowers 	int rv;
49904Smcpowers 
50904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
51904Smcpowers 
52904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
53904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
54904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_create),
55*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
56904Smcpowers 
57904Smcpowers 		if (rv != CRYPTO_SUCCESS)
58904Smcpowers 			return (rv);
59904Smcpowers 	}
60904Smcpowers 
61904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
62904Smcpowers 		rv = KCF_PROV_OBJECT_CREATE(real_provider, sid,
63904Smcpowers 		    attrs, count, object_handle, KCF_SWFP_RHNDL(crq));
64904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
65904Smcpowers 	} else {
66904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_CREATE,
67904Smcpowers 		    sid, 0, attrs, count, object_handle, 0,
68904Smcpowers 		    NULL, NULL, 0, NULL);
69904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
70904Smcpowers 		    &params, B_FALSE);
71904Smcpowers 	}
72904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
73904Smcpowers 		KCF_PROV_REFRELE(real_provider);
74904Smcpowers 
75904Smcpowers 	return (rv);
76904Smcpowers }
77904Smcpowers 
78904Smcpowers int
crypto_object_destroy(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_id_t object_handle,crypto_call_req_t * crq)79904Smcpowers crypto_object_destroy(crypto_provider_t provider, crypto_session_id_t sid,
80904Smcpowers     crypto_object_id_t object_handle, crypto_call_req_t *crq)
81904Smcpowers {
82904Smcpowers 	kcf_req_params_t params;
83904Smcpowers 	kcf_provider_desc_t *pd = provider;
84904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
85904Smcpowers 	int rv;
86904Smcpowers 
87904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
88904Smcpowers 
89904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
90904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
91904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_destroy),
92*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
93904Smcpowers 
94904Smcpowers 		if (rv != CRYPTO_SUCCESS)
95904Smcpowers 			return (rv);
96904Smcpowers 	}
97904Smcpowers 
98904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
99904Smcpowers 		rv = KCF_PROV_OBJECT_DESTROY(real_provider, sid,
100904Smcpowers 		    object_handle, KCF_SWFP_RHNDL(crq));
101904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
102904Smcpowers 	} else {
103904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_DESTROY,
104904Smcpowers 		    sid, object_handle, NULL, 0, NULL, 0,
105904Smcpowers 		    NULL, NULL, 0, NULL);
106904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
107904Smcpowers 		    &params, B_FALSE);
108904Smcpowers 	}
109904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
110904Smcpowers 		KCF_PROV_REFRELE(real_provider);
111904Smcpowers 
112904Smcpowers 	return (rv);
113904Smcpowers }
114904Smcpowers 
115904Smcpowers int
crypto_object_copy(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_id_t object_handle,crypto_object_attribute_t * attrs,uint_t count,crypto_object_id_t * new_handle,crypto_call_req_t * crq)116904Smcpowers crypto_object_copy(crypto_provider_t provider, crypto_session_id_t sid,
117904Smcpowers     crypto_object_id_t object_handle, crypto_object_attribute_t *attrs,
118904Smcpowers     uint_t count, crypto_object_id_t *new_handle, crypto_call_req_t *crq)
119904Smcpowers {
120904Smcpowers 	kcf_req_params_t params;
121904Smcpowers 	kcf_provider_desc_t *pd = provider;
122904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
123904Smcpowers 	int rv;
124904Smcpowers 
125904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
126904Smcpowers 
127904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
128904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
129904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_copy),
130*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
131904Smcpowers 
132904Smcpowers 		if (rv != CRYPTO_SUCCESS)
133904Smcpowers 			return (rv);
134904Smcpowers 	}
135904Smcpowers 
136904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
137904Smcpowers 		rv = KCF_PROV_OBJECT_COPY(real_provider, sid,
138904Smcpowers 		    object_handle, attrs, count, new_handle,
139904Smcpowers 		    KCF_SWFP_RHNDL(crq));
140904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
141904Smcpowers 	} else {
142904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_COPY,
143904Smcpowers 		    sid, object_handle, attrs, count,
144904Smcpowers 		    new_handle, 0, NULL, NULL, 0, NULL);
145904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
146904Smcpowers 		    &params, B_FALSE);
147904Smcpowers 	}
148904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
149904Smcpowers 		KCF_PROV_REFRELE(real_provider);
150904Smcpowers 
151904Smcpowers 	return (rv);
152904Smcpowers }
153904Smcpowers 
154904Smcpowers int
crypto_object_get_attribute_value(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_id_t object_handle,crypto_object_attribute_t * attrs,uint_t count,crypto_call_req_t * crq)155904Smcpowers crypto_object_get_attribute_value(crypto_provider_t provider,
156904Smcpowers     crypto_session_id_t sid, crypto_object_id_t object_handle,
157904Smcpowers     crypto_object_attribute_t *attrs, uint_t count, crypto_call_req_t *crq)
158904Smcpowers {
159904Smcpowers 	kcf_req_params_t params;
160904Smcpowers 	kcf_provider_desc_t *pd = provider;
161904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
162904Smcpowers 	int rv;
163904Smcpowers 
164904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
165904Smcpowers 
166904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
167904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
168904Smcpowers 		    object_ops),
169904Smcpowers 		    CRYPTO_OBJECT_OFFSET(object_get_attribute_value),
170*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
171904Smcpowers 
172904Smcpowers 		if (rv != CRYPTO_SUCCESS)
173904Smcpowers 			return (rv);
174904Smcpowers 	}
175904Smcpowers 
176904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
177904Smcpowers 		rv = KCF_PROV_OBJECT_GET_ATTRIBUTE_VALUE(real_provider,
178904Smcpowers 		    sid, object_handle, attrs, count, KCF_SWFP_RHNDL(crq));
179904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
180904Smcpowers 	} else {
181904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params,
182904Smcpowers 		    KCF_OP_OBJECT_GET_ATTRIBUTE_VALUE, sid, object_handle,
183904Smcpowers 		    attrs, count, NULL, 0, NULL, NULL, 0, NULL);
184904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
185904Smcpowers 		    &params, B_FALSE);
186904Smcpowers 	}
187904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
188904Smcpowers 		KCF_PROV_REFRELE(real_provider);
189904Smcpowers 
190904Smcpowers 	return (rv);
191904Smcpowers }
192904Smcpowers 
193904Smcpowers int
crypto_object_set_attribute_value(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_id_t object_handle,crypto_object_attribute_t * attrs,uint_t count,crypto_call_req_t * crq)194904Smcpowers crypto_object_set_attribute_value(crypto_provider_t provider,
195904Smcpowers     crypto_session_id_t sid, crypto_object_id_t object_handle,
196904Smcpowers     crypto_object_attribute_t *attrs, uint_t count, crypto_call_req_t *crq)
197904Smcpowers {
198904Smcpowers 	kcf_req_params_t params;
199904Smcpowers 	kcf_provider_desc_t *pd = provider;
200904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
201904Smcpowers 	int rv;
202904Smcpowers 
203904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
204904Smcpowers 
205904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
206904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
207904Smcpowers 		    object_ops),
208904Smcpowers 		    CRYPTO_OBJECT_OFFSET(object_set_attribute_value),
209*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
210904Smcpowers 
211904Smcpowers 		if (rv != CRYPTO_SUCCESS)
212904Smcpowers 			return (rv);
213904Smcpowers 	}
214904Smcpowers 
215904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
216904Smcpowers 		rv = KCF_PROV_OBJECT_SET_ATTRIBUTE_VALUE(real_provider,
217904Smcpowers 		    sid, object_handle, attrs, count, KCF_SWFP_RHNDL(crq));
218904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
219904Smcpowers 	} else {
220904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params,
221904Smcpowers 		    KCF_OP_OBJECT_SET_ATTRIBUTE_VALUE, sid, object_handle,
222904Smcpowers 		    attrs, count, NULL, 0, NULL, NULL, 0, NULL);
223904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
224904Smcpowers 		    &params, B_FALSE);
225904Smcpowers 	}
226904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
227904Smcpowers 		KCF_PROV_REFRELE(real_provider);
228904Smcpowers 
229904Smcpowers 	return (rv);
230904Smcpowers }
231904Smcpowers 
232904Smcpowers int
crypto_object_get_size(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_id_t object_handle,size_t * size,crypto_call_req_t * crq)233904Smcpowers crypto_object_get_size(crypto_provider_t provider, crypto_session_id_t sid,
234904Smcpowers     crypto_object_id_t object_handle, size_t *size, crypto_call_req_t *crq)
235904Smcpowers {
236904Smcpowers 	kcf_req_params_t params;
237904Smcpowers 	kcf_provider_desc_t *pd = provider;
238904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
239904Smcpowers 	int rv;
240904Smcpowers 
241904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
242904Smcpowers 
243904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
244904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
245904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_get_size),
246*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
247904Smcpowers 
248904Smcpowers 		if (rv != CRYPTO_SUCCESS)
249904Smcpowers 			return (rv);
250904Smcpowers 
251904Smcpowers 	}
252904Smcpowers 
253904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
254904Smcpowers 		rv = KCF_PROV_OBJECT_GET_SIZE(real_provider,
255904Smcpowers 		    sid, object_handle, size, KCF_SWFP_RHNDL(crq));
256904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
257904Smcpowers 	} else {
258904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_GET_SIZE, sid,
259904Smcpowers 		    object_handle, NULL, 0, NULL, size, NULL, NULL, 0, NULL);
260904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
261904Smcpowers 		    &params, B_FALSE);
262904Smcpowers 	}
263904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
264904Smcpowers 		KCF_PROV_REFRELE(real_provider);
265904Smcpowers 
266904Smcpowers 	return (rv);
267904Smcpowers }
268904Smcpowers 
269904Smcpowers int
crypto_object_find_init(crypto_provider_t provider,crypto_session_id_t sid,crypto_object_attribute_t * attrs,uint_t count,void ** cookie,crypto_call_req_t * crq)270904Smcpowers crypto_object_find_init(crypto_provider_t provider, crypto_session_id_t sid,
271904Smcpowers     crypto_object_attribute_t *attrs, uint_t count, void **cookie,
272904Smcpowers     crypto_call_req_t *crq)
273904Smcpowers {
274904Smcpowers 	kcf_req_params_t params;
275904Smcpowers 	kcf_provider_desc_t *pd = provider;
276904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
277904Smcpowers 	int rv;
278904Smcpowers 
279904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
280904Smcpowers 
281904Smcpowers 	if (cookie == NULL) {
282904Smcpowers 		return (CRYPTO_ARGUMENTS_BAD);
283904Smcpowers 	}
284904Smcpowers 
285904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
286904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
287904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_find_init),
288*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
289904Smcpowers 
290904Smcpowers 		if (rv != CRYPTO_SUCCESS)
291904Smcpowers 			return (rv);
292904Smcpowers 	}
293904Smcpowers 
294904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
295904Smcpowers 		rv = KCF_PROV_OBJECT_FIND_INIT(real_provider,
296904Smcpowers 		    sid, attrs, count, cookie, KCF_SWFP_RHNDL(crq));
297904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
298904Smcpowers 	} else {
299904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_FIND_INIT,
300904Smcpowers 		    sid, 0, attrs, count, NULL, 0, cookie, NULL, 0, NULL);
301904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
302904Smcpowers 		    &params, B_FALSE);
303904Smcpowers 	}
304904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
305904Smcpowers 		KCF_PROV_REFRELE(real_provider);
306904Smcpowers 
307904Smcpowers 	return (rv);
308904Smcpowers }
309904Smcpowers 
310904Smcpowers int
crypto_object_find_final(crypto_provider_t provider,void * cookie,crypto_call_req_t * crq)311904Smcpowers crypto_object_find_final(crypto_provider_t provider, void *cookie,
312904Smcpowers     crypto_call_req_t *crq)
313904Smcpowers {
314904Smcpowers 	kcf_req_params_t params;
315904Smcpowers 	kcf_provider_desc_t *pd = provider;
316904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
317904Smcpowers 	int rv;
318904Smcpowers 
319904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
320904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
321904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_find_final),
322*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
323904Smcpowers 
324904Smcpowers 		if (rv != CRYPTO_SUCCESS)
325904Smcpowers 			return (rv);
326904Smcpowers 	}
327904Smcpowers 
328904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
329904Smcpowers 		rv = KCF_PROV_OBJECT_FIND_FINAL(real_provider,
330904Smcpowers 		    cookie, KCF_SWFP_RHNDL(crq));
331904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
332904Smcpowers 	} else {
333904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_FIND_FINAL,
334904Smcpowers 		    0, 0, NULL, 0, NULL, 0, NULL, cookie, 0, NULL);
335904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, NULL, &params,
336904Smcpowers 		    B_FALSE);
337904Smcpowers 	}
338904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
339904Smcpowers 		KCF_PROV_REFRELE(real_provider);
340904Smcpowers 
341904Smcpowers 	return (rv);
342904Smcpowers }
343904Smcpowers 
344904Smcpowers int
crypto_object_find(crypto_provider_t provider,void * cookie,crypto_object_id_t * handles,uint_t * count,uint_t max_count,crypto_call_req_t * crq)345904Smcpowers crypto_object_find(crypto_provider_t provider, void *cookie,
346904Smcpowers     crypto_object_id_t *handles, uint_t *count, uint_t max_count,
347904Smcpowers     crypto_call_req_t *crq)
348904Smcpowers {
349904Smcpowers 	kcf_req_params_t params;
350904Smcpowers 	kcf_provider_desc_t *pd = provider;
351904Smcpowers 	kcf_provider_desc_t *real_provider = pd;
352904Smcpowers 	int rv;
353904Smcpowers 
354904Smcpowers 	ASSERT(KCF_PROV_REFHELD(pd));
355904Smcpowers 
356904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER) {
357904Smcpowers 		rv = kcf_get_hardware_provider_nomech(CRYPTO_OPS_OFFSET(
358904Smcpowers 		    object_ops), CRYPTO_OBJECT_OFFSET(object_find),
359*12304SValerie.Fenwick@Oracle.COM 		    pd, &real_provider);
360904Smcpowers 
361904Smcpowers 		if (rv != CRYPTO_SUCCESS)
362904Smcpowers 			return (rv);
363904Smcpowers 	}
364904Smcpowers 
365904Smcpowers 	if (CHECK_FASTPATH(crq, real_provider)) {
366904Smcpowers 		rv = KCF_PROV_OBJECT_FIND(real_provider, cookie, handles,
367904Smcpowers 		    max_count, count, KCF_SWFP_RHNDL(crq));
368904Smcpowers 		KCF_PROV_INCRSTATS(pd, rv);
369904Smcpowers 	} else {
370904Smcpowers 		KCF_WRAP_OBJECT_OPS_PARAMS(&params, KCF_OP_OBJECT_FIND, 0,
371904Smcpowers 		    0, NULL, 0, handles, 0, NULL, cookie, max_count, count);
372904Smcpowers 		rv = kcf_submit_request(real_provider, NULL, crq,
373904Smcpowers 		    &params, B_FALSE);
374904Smcpowers 	}
375904Smcpowers 	if (pd->pd_prov_type == CRYPTO_LOGICAL_PROVIDER)
376904Smcpowers 		KCF_PROV_REFRELE(real_provider);
377904Smcpowers 
378904Smcpowers 	return (rv);
379904Smcpowers }
380