xref: /titanic_41/usr/src/uts/common/sys/crypto/ioctl.h (revision c0c79a3f09914f35651895ffc111883455b7f62d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_CRYPTO_IOCTL_H
28 #define	_SYS_CRYPTO_IOCTL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <sys/types.h>
37 #include <sys/crypto/spi.h>
38 #include <sys/crypto/common.h>
39 
40 #define	CRYPTO_MAX_ATTRIBUTE_COUNT	128
41 
42 #define	CRYPTO_IOFLAGS_RW_SESSION	0x00000001
43 
44 #define	CRYPTO(x)		(('y' << 8) | (x))
45 
46 /*
47  * General Purpose Ioctls
48  */
49 
50 typedef struct crypto_function_list {
51 	boolean_t fl_digest_init;
52 	boolean_t fl_digest;
53 	boolean_t fl_digest_update;
54 	boolean_t fl_digest_key;
55 	boolean_t fl_digest_final;
56 
57 	boolean_t fl_encrypt_init;
58 	boolean_t fl_encrypt;
59 	boolean_t fl_encrypt_update;
60 	boolean_t fl_encrypt_final;
61 
62 	boolean_t fl_decrypt_init;
63 	boolean_t fl_decrypt;
64 	boolean_t fl_decrypt_update;
65 	boolean_t fl_decrypt_final;
66 
67 	boolean_t fl_mac_init;
68 	boolean_t fl_mac;
69 	boolean_t fl_mac_update;
70 	boolean_t fl_mac_final;
71 
72 	boolean_t fl_sign_init;
73 	boolean_t fl_sign;
74 	boolean_t fl_sign_update;
75 	boolean_t fl_sign_final;
76 	boolean_t fl_sign_recover_init;
77 	boolean_t fl_sign_recover;
78 
79 	boolean_t fl_verify_init;
80 	boolean_t fl_verify;
81 	boolean_t fl_verify_update;
82 	boolean_t fl_verify_final;
83 	boolean_t fl_verify_recover_init;
84 	boolean_t fl_verify_recover;
85 
86 	boolean_t fl_digest_encrypt_update;
87 	boolean_t fl_decrypt_digest_update;
88 	boolean_t fl_sign_encrypt_update;
89 	boolean_t fl_decrypt_verify_update;
90 
91 	boolean_t fl_seed_random;
92 	boolean_t fl_generate_random;
93 
94 	boolean_t fl_session_open;
95 	boolean_t fl_session_close;
96 	boolean_t fl_session_login;
97 	boolean_t fl_session_logout;
98 
99 	boolean_t fl_object_create;
100 	boolean_t fl_object_copy;
101 	boolean_t fl_object_destroy;
102 	boolean_t fl_object_get_size;
103 	boolean_t fl_object_get_attribute_value;
104 	boolean_t fl_object_set_attribute_value;
105 	boolean_t fl_object_find_init;
106 	boolean_t fl_object_find;
107 	boolean_t fl_object_find_final;
108 
109 	boolean_t fl_key_generate;
110 	boolean_t fl_key_generate_pair;
111 	boolean_t fl_key_wrap;
112 	boolean_t fl_key_unwrap;
113 	boolean_t fl_key_derive;
114 
115 	boolean_t fl_init_token;
116 	boolean_t fl_init_pin;
117 	boolean_t fl_set_pin;
118 
119 	boolean_t prov_is_limited;
120 	uint32_t prov_hash_threshold;
121 	uint32_t prov_hash_limit;
122 } crypto_function_list_t;
123 
124 typedef struct crypto_get_function_list {
125 	uint_t			fl_return_value;
126 	crypto_provider_id_t	fl_provider_id;
127 	crypto_function_list_t	fl_list;
128 } crypto_get_function_list_t;
129 
130 typedef struct crypto_get_mechanism_number {
131 	uint_t			pn_return_value;
132 	caddr_t			pn_mechanism_string;
133 	size_t			pn_mechanism_len;
134 	crypto_mech_type_t	pn_internal_number;
135 } crypto_get_mechanism_number_t;
136 
137 #ifdef	_KERNEL
138 #ifdef	_SYSCALL32
139 
140 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
141 #pragma pack(4)
142 #endif
143 
144 typedef struct crypto_get_mechanism_number32 {
145 	uint32_t		pn_return_value;
146 	caddr32_t		pn_mechanism_string;
147 	size32_t		pn_mechanism_len;
148 	crypto_mech_type_t	pn_internal_number;
149 } crypto_get_mechanism_number32_t;
150 
151 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
152 #pragma pack()
153 #endif
154 
155 #endif	/* _SYSCALL32 */
156 #endif	/* _KERNEL */
157 
158 #define	CRYPTO_GET_FUNCTION_LIST	CRYPTO(20)
159 #define	CRYPTO_GET_MECHANISM_NUMBER	CRYPTO(21)
160 
161 /*
162  * Session Ioctls
163  */
164 
165 typedef uint32_t	crypto_flags_t;
166 
167 typedef struct crypto_open_session {
168 	uint_t			os_return_value;
169 	crypto_session_id_t	os_session;
170 	crypto_flags_t		os_flags;
171 	crypto_provider_id_t	os_provider_id;
172 } crypto_open_session_t;
173 
174 typedef struct crypto_close_session {
175 	uint_t			cs_return_value;
176 	crypto_session_id_t	cs_session;
177 } crypto_close_session_t;
178 
179 typedef struct crypto_close_all_sessions {
180 	uint_t			as_return_value;
181 	crypto_provider_id_t	as_provider_id;
182 } crypto_close_all_sessions_t;
183 
184 #define	CRYPTO_OPEN_SESSION		CRYPTO(30)
185 #define	CRYPTO_CLOSE_SESSION		CRYPTO(31)
186 #define	CRYPTO_CLOSE_ALL_SESSIONS	CRYPTO(32)
187 
188 /*
189  * Login Ioctls
190  */
191 typedef struct crypto_login {
192 	uint_t			co_return_value;
193 	crypto_session_id_t	co_session;
194 	uint_t			co_user_type;
195 	uint_t			co_pin_len;
196 	caddr_t			co_pin;
197 } crypto_login_t;
198 
199 typedef struct crypto_logout {
200 	uint_t			cl_return_value;
201 	crypto_session_id_t	cl_session;
202 } crypto_logout_t;
203 
204 #ifdef	_KERNEL
205 #ifdef	_SYSCALL32
206 
207 typedef struct crypto_login32 {
208 	uint32_t		co_return_value;
209 	crypto_session_id_t	co_session;
210 	uint32_t		co_user_type;
211 	uint32_t		co_pin_len;
212 	caddr32_t		co_pin;
213 } crypto_login32_t;
214 
215 typedef struct crypto_logout32 {
216 	uint32_t		cl_return_value;
217 	crypto_session_id_t	cl_session;
218 } crypto_logout32_t;
219 
220 #endif	/* _SYSCALL32 */
221 #endif	/* _KERNEL */
222 
223 #define	CRYPTO_LOGIN			CRYPTO(40)
224 #define	CRYPTO_LOGOUT			CRYPTO(41)
225 
226 /*
227  * Cryptographic Ioctls
228  */
229 typedef struct crypto_encrypt {
230 	uint_t			ce_return_value;
231 	crypto_session_id_t	ce_session;
232 	size_t			ce_datalen;
233 	caddr_t			ce_databuf;
234 	size_t			ce_encrlen;
235 	caddr_t			ce_encrbuf;
236 } crypto_encrypt_t;
237 
238 typedef struct crypto_encrypt_init {
239 	uint_t			ei_return_value;
240 	crypto_session_id_t	ei_session;
241 	crypto_mechanism_t	ei_mech;
242 	crypto_key_t		ei_key;
243 } crypto_encrypt_init_t;
244 
245 typedef struct crypto_encrypt_update {
246 	uint_t			eu_return_value;
247 	crypto_session_id_t	eu_session;
248 	size_t			eu_datalen;
249 	caddr_t			eu_databuf;
250 	size_t			eu_encrlen;
251 	caddr_t			eu_encrbuf;
252 } crypto_encrypt_update_t;
253 
254 typedef struct crypto_encrypt_final {
255 	uint_t			ef_return_value;
256 	crypto_session_id_t	ef_session;
257 	size_t			ef_encrlen;
258 	caddr_t			ef_encrbuf;
259 } crypto_encrypt_final_t;
260 
261 typedef struct crypto_decrypt {
262 	uint_t			cd_return_value;
263 	crypto_session_id_t	cd_session;
264 	size_t			cd_encrlen;
265 	caddr_t			cd_encrbuf;
266 	size_t			cd_datalen;
267 	caddr_t			cd_databuf;
268 } crypto_decrypt_t;
269 
270 typedef struct crypto_decrypt_init {
271 	uint_t			di_return_value;
272 	crypto_session_id_t	di_session;
273 	crypto_mechanism_t	di_mech;
274 	crypto_key_t		di_key;
275 } crypto_decrypt_init_t;
276 
277 typedef struct crypto_decrypt_update {
278 	uint_t			du_return_value;
279 	crypto_session_id_t	du_session;
280 	size_t			du_encrlen;
281 	caddr_t			du_encrbuf;
282 	size_t			du_datalen;
283 	caddr_t			du_databuf;
284 } crypto_decrypt_update_t;
285 
286 typedef struct crypto_decrypt_final {
287 	uint_t			df_return_value;
288 	crypto_session_id_t	df_session;
289 	size_t			df_datalen;
290 	caddr_t			df_databuf;
291 } crypto_decrypt_final_t;
292 
293 typedef struct crypto_digest {
294 	uint_t			cd_return_value;
295 	crypto_session_id_t	cd_session;
296 	size_t			cd_datalen;
297 	caddr_t			cd_databuf;
298 	size_t			cd_digestlen;
299 	caddr_t			cd_digestbuf;
300 } crypto_digest_t;
301 
302 typedef struct crypto_digest_init {
303 	uint_t			di_return_value;
304 	crypto_session_id_t	di_session;
305 	crypto_mechanism_t	di_mech;
306 } crypto_digest_init_t;
307 
308 typedef struct crypto_digest_update {
309 	uint_t			du_return_value;
310 	crypto_session_id_t	du_session;
311 	size_t			du_datalen;
312 	caddr_t			du_databuf;
313 } crypto_digest_update_t;
314 
315 typedef struct crypto_digest_key {
316 	uint_t			dk_return_value;
317 	crypto_session_id_t	dk_session;
318 	crypto_key_t		dk_key;
319 } crypto_digest_key_t;
320 
321 typedef struct crypto_digest_final {
322 	uint_t			df_return_value;
323 	crypto_session_id_t	df_session;
324 	size_t			df_digestlen;
325 	caddr_t			df_digestbuf;
326 } crypto_digest_final_t;
327 
328 typedef struct crypto_mac {
329 	uint_t			cm_return_value;
330 	crypto_session_id_t	cm_session;
331 	size_t			cm_datalen;
332 	caddr_t			cm_databuf;
333 	size_t			cm_maclen;
334 	caddr_t			cm_macbuf;
335 } crypto_mac_t;
336 
337 typedef struct crypto_mac_init {
338 	uint_t			mi_return_value;
339 	crypto_session_id_t	mi_session;
340 	crypto_mechanism_t	mi_mech;
341 	crypto_key_t		mi_key;
342 } crypto_mac_init_t;
343 
344 typedef struct crypto_mac_update {
345 	uint_t			mu_return_value;
346 	crypto_session_id_t	mu_session;
347 	size_t			mu_datalen;
348 	caddr_t			mu_databuf;
349 } crypto_mac_update_t;
350 
351 typedef struct crypto_mac_final {
352 	uint_t			mf_return_value;
353 	crypto_session_id_t	mf_session;
354 	size_t			mf_maclen;
355 	caddr_t			mf_macbuf;
356 } crypto_mac_final_t;
357 
358 typedef struct crypto_sign {
359 	uint_t			cs_return_value;
360 	crypto_session_id_t	cs_session;
361 	size_t			cs_datalen;
362 	caddr_t			cs_databuf;
363 	size_t			cs_signlen;
364 	caddr_t			cs_signbuf;
365 } crypto_sign_t;
366 
367 typedef struct crypto_sign_init {
368 	uint_t			si_return_value;
369 	crypto_session_id_t	si_session;
370 	crypto_mechanism_t	si_mech;
371 	crypto_key_t		si_key;
372 } crypto_sign_init_t;
373 
374 typedef struct crypto_sign_update {
375 	uint_t			su_return_value;
376 	crypto_session_id_t	su_session;
377 	size_t			su_datalen;
378 	caddr_t			su_databuf;
379 } crypto_sign_update_t;
380 
381 typedef struct crypto_sign_final {
382 	uint_t			sf_return_value;
383 	crypto_session_id_t	sf_session;
384 	size_t			sf_signlen;
385 	caddr_t			sf_signbuf;
386 } crypto_sign_final_t;
387 
388 typedef struct crypto_sign_recover_init {
389 	uint_t			ri_return_value;
390 	crypto_session_id_t	ri_session;
391 	crypto_mechanism_t	ri_mech;
392 	crypto_key_t		ri_key;
393 } crypto_sign_recover_init_t;
394 
395 typedef struct crypto_sign_recover {
396 	uint_t			sr_return_value;
397 	crypto_session_id_t	sr_session;
398 	size_t			sr_datalen;
399 	caddr_t			sr_databuf;
400 	size_t			sr_signlen;
401 	caddr_t			sr_signbuf;
402 } crypto_sign_recover_t;
403 
404 typedef struct crypto_verify {
405 	uint_t			cv_return_value;
406 	crypto_session_id_t	cv_session;
407 	size_t			cv_datalen;
408 	caddr_t			cv_databuf;
409 	size_t			cv_signlen;
410 	caddr_t			cv_signbuf;
411 } crypto_verify_t;
412 
413 typedef struct crypto_verify_init {
414 	uint_t			vi_return_value;
415 	crypto_session_id_t	vi_session;
416 	crypto_mechanism_t	vi_mech;
417 	crypto_key_t		vi_key;
418 } crypto_verify_init_t;
419 
420 typedef struct crypto_verify_update {
421 	uint_t			vu_return_value;
422 	crypto_session_id_t	vu_session;
423 	size_t			vu_datalen;
424 	caddr_t			vu_databuf;
425 } crypto_verify_update_t;
426 
427 typedef struct crypto_verify_final {
428 	uint_t			vf_return_value;
429 	crypto_session_id_t	vf_session;
430 	size_t			vf_signlen;
431 	caddr_t			vf_signbuf;
432 } crypto_verify_final_t;
433 
434 typedef struct crypto_verify_recover_init {
435 	uint_t			ri_return_value;
436 	crypto_session_id_t	ri_session;
437 	crypto_mechanism_t	ri_mech;
438 	crypto_key_t		ri_key;
439 } crypto_verify_recover_init_t;
440 
441 typedef struct crypto_verify_recover {
442 	uint_t			vr_return_value;
443 	crypto_session_id_t	vr_session;
444 	size_t			vr_signlen;
445 	caddr_t			vr_signbuf;
446 	size_t			vr_datalen;
447 	caddr_t			vr_databuf;
448 } crypto_verify_recover_t;
449 
450 typedef struct crypto_digest_encrypt_update {
451 	uint_t			eu_return_value;
452 	crypto_session_id_t	eu_session;
453 	size_t			eu_datalen;
454 	caddr_t			eu_databuf;
455 	size_t			eu_encrlen;
456 	caddr_t			eu_encrbuf;
457 } crypto_digest_encrypt_update_t;
458 
459 typedef struct crypto_decrypt_digest_update {
460 	uint_t			du_return_value;
461 	crypto_session_id_t	du_session;
462 	size_t			du_encrlen;
463 	caddr_t			du_encrbuf;
464 	size_t			du_datalen;
465 	caddr_t			du_databuf;
466 } crypto_decrypt_digest_update_t;
467 
468 typedef struct crypto_sign_encrypt_update {
469 	uint_t			eu_return_value;
470 	crypto_session_id_t	eu_session;
471 	size_t			eu_datalen;
472 	caddr_t			eu_databuf;
473 	size_t			eu_encrlen;
474 	caddr_t			eu_encrbuf;
475 } crypto_sign_encrypt_update_t;
476 
477 typedef struct crypto_decrypt_verify_update {
478 	uint_t			vu_return_value;
479 	crypto_session_id_t	vu_session;
480 	size_t			vu_encrlen;
481 	caddr_t			vu_encrbuf;
482 	size_t			vu_datalen;
483 	caddr_t			vu_databuf;
484 } crypto_decrypt_verify_update_t;
485 
486 #ifdef	_KERNEL
487 #ifdef	_SYSCALL32
488 
489 typedef struct crypto_encrypt32 {
490 	uint32_t		ce_return_value;
491 	crypto_session_id_t	ce_session;
492 	size32_t		ce_datalen;
493 	caddr32_t		ce_databuf;
494 	size32_t		ce_encrlen;
495 	caddr32_t		ce_encrbuf;
496 } crypto_encrypt32_t;
497 
498 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
499 #pragma pack(4)
500 #endif
501 
502 typedef struct crypto_encrypt_init32 {
503 	uint32_t		ei_return_value;
504 	crypto_session_id_t	ei_session;
505 	crypto_mechanism32_t	ei_mech;
506 	crypto_key32_t		ei_key;
507 } crypto_encrypt_init32_t;
508 
509 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
510 #pragma pack()
511 #endif
512 
513 typedef struct crypto_encrypt_update32 {
514 	uint32_t		eu_return_value;
515 	crypto_session_id_t	eu_session;
516 	size32_t		eu_datalen;
517 	caddr32_t		eu_databuf;
518 	size32_t		eu_encrlen;
519 	caddr32_t		eu_encrbuf;
520 } crypto_encrypt_update32_t;
521 
522 typedef struct crypto_encrypt_final32 {
523 	uint32_t		ef_return_value;
524 	crypto_session_id_t	ef_session;
525 	size32_t		ef_encrlen;
526 	caddr32_t		ef_encrbuf;
527 } crypto_encrypt_final32_t;
528 
529 typedef struct crypto_decrypt32 {
530 	uint32_t		cd_return_value;
531 	crypto_session_id_t	cd_session;
532 	size32_t		cd_encrlen;
533 	caddr32_t		cd_encrbuf;
534 	size32_t		cd_datalen;
535 	caddr32_t		cd_databuf;
536 } crypto_decrypt32_t;
537 
538 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
539 #pragma pack(4)
540 #endif
541 
542 typedef struct crypto_decrypt_init32 {
543 	uint32_t		di_return_value;
544 	crypto_session_id_t	di_session;
545 	crypto_mechanism32_t	di_mech;
546 	crypto_key32_t		di_key;
547 } crypto_decrypt_init32_t;
548 
549 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
550 #pragma pack()
551 #endif
552 
553 typedef struct crypto_decrypt_update32 {
554 	uint32_t		du_return_value;
555 	crypto_session_id_t	du_session;
556 	size32_t		du_encrlen;
557 	caddr32_t		du_encrbuf;
558 	size32_t		du_datalen;
559 	caddr32_t		du_databuf;
560 } crypto_decrypt_update32_t;
561 
562 typedef struct crypto_decrypt_final32 {
563 	uint32_t		df_return_value;
564 	crypto_session_id_t	df_session;
565 	size32_t		df_datalen;
566 	caddr32_t		df_databuf;
567 } crypto_decrypt_final32_t;
568 
569 typedef struct crypto_digest32 {
570 	uint32_t		cd_return_value;
571 	crypto_session_id_t	cd_session;
572 	size32_t		cd_datalen;
573 	caddr32_t		cd_databuf;
574 	size32_t		cd_digestlen;
575 	caddr32_t		cd_digestbuf;
576 } crypto_digest32_t;
577 
578 typedef struct crypto_digest_init32 {
579 	uint32_t		di_return_value;
580 	crypto_session_id_t	di_session;
581 	crypto_mechanism32_t	di_mech;
582 } crypto_digest_init32_t;
583 
584 typedef struct crypto_digest_update32 {
585 	uint32_t		du_return_value;
586 	crypto_session_id_t	du_session;
587 	size32_t		du_datalen;
588 	caddr32_t		du_databuf;
589 } crypto_digest_update32_t;
590 
591 typedef struct crypto_digest_key32 {
592 	uint32_t		dk_return_value;
593 	crypto_session_id_t	dk_session;
594 	crypto_key32_t		dk_key;
595 } crypto_digest_key32_t;
596 
597 typedef struct crypto_digest_final32 {
598 	uint32_t		df_return_value;
599 	crypto_session_id_t	df_session;
600 	size32_t		df_digestlen;
601 	caddr32_t		df_digestbuf;
602 } crypto_digest_final32_t;
603 
604 typedef struct crypto_mac32 {
605 	uint32_t		cm_return_value;
606 	crypto_session_id_t	cm_session;
607 	size32_t		cm_datalen;
608 	caddr32_t		cm_databuf;
609 	size32_t		cm_maclen;
610 	caddr32_t		cm_macbuf;
611 } crypto_mac32_t;
612 
613 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
614 #pragma pack(4)
615 #endif
616 
617 typedef struct crypto_mac_init32 {
618 	uint32_t		mi_return_value;
619 	crypto_session_id_t	mi_session;
620 	crypto_mechanism32_t	mi_mech;
621 	crypto_key32_t		mi_key;
622 } crypto_mac_init32_t;
623 
624 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
625 #pragma pack()
626 #endif
627 
628 typedef struct crypto_mac_update32 {
629 	uint32_t		mu_return_value;
630 	crypto_session_id_t	mu_session;
631 	size32_t		mu_datalen;
632 	caddr32_t		mu_databuf;
633 } crypto_mac_update32_t;
634 
635 typedef struct crypto_mac_final32 {
636 	uint32_t		mf_return_value;
637 	crypto_session_id_t	mf_session;
638 	size32_t		mf_maclen;
639 	caddr32_t		mf_macbuf;
640 } crypto_mac_final32_t;
641 
642 typedef struct crypto_sign32 {
643 	uint32_t		cs_return_value;
644 	crypto_session_id_t	cs_session;
645 	size32_t		cs_datalen;
646 	caddr32_t		cs_databuf;
647 	size32_t		cs_signlen;
648 	caddr32_t		cs_signbuf;
649 } crypto_sign32_t;
650 
651 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
652 #pragma pack(4)
653 #endif
654 
655 typedef struct crypto_sign_init32 {
656 	uint32_t		si_return_value;
657 	crypto_session_id_t	si_session;
658 	crypto_mechanism32_t	si_mech;
659 	crypto_key32_t		si_key;
660 } crypto_sign_init32_t;
661 
662 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
663 #pragma pack()
664 #endif
665 
666 typedef struct crypto_sign_update32 {
667 	uint32_t		su_return_value;
668 	crypto_session_id_t	su_session;
669 	size32_t		su_datalen;
670 	caddr32_t		su_databuf;
671 } crypto_sign_update32_t;
672 
673 typedef struct crypto_sign_final32 {
674 	uint32_t		sf_return_value;
675 	crypto_session_id_t	sf_session;
676 	size32_t		sf_signlen;
677 	caddr32_t		sf_signbuf;
678 } crypto_sign_final32_t;
679 
680 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
681 #pragma pack(4)
682 #endif
683 
684 typedef struct crypto_sign_recover_init32 {
685 	uint32_t		ri_return_value;
686 	crypto_session_id_t	ri_session;
687 	crypto_mechanism32_t	ri_mech;
688 	crypto_key32_t		ri_key;
689 } crypto_sign_recover_init32_t;
690 
691 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
692 #pragma pack()
693 #endif
694 
695 typedef struct crypto_sign_recover32 {
696 	uint32_t		sr_return_value;
697 	crypto_session_id_t	sr_session;
698 	size32_t		sr_datalen;
699 	caddr32_t		sr_databuf;
700 	size32_t		sr_signlen;
701 	caddr32_t		sr_signbuf;
702 } crypto_sign_recover32_t;
703 
704 typedef struct crypto_verify32 {
705 	uint32_t		cv_return_value;
706 	crypto_session_id_t	cv_session;
707 	size32_t		cv_datalen;
708 	caddr32_t		cv_databuf;
709 	size32_t		cv_signlen;
710 	caddr32_t		cv_signbuf;
711 } crypto_verify32_t;
712 
713 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
714 #pragma pack(4)
715 #endif
716 
717 typedef struct crypto_verify_init32 {
718 	uint32_t		vi_return_value;
719 	crypto_session_id_t	vi_session;
720 	crypto_mechanism32_t	vi_mech;
721 	crypto_key32_t		vi_key;
722 } crypto_verify_init32_t;
723 
724 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
725 #pragma pack()
726 #endif
727 
728 typedef struct crypto_verify_update32 {
729 	uint32_t		vu_return_value;
730 	crypto_session_id_t	vu_session;
731 	size32_t		vu_datalen;
732 	caddr32_t		vu_databuf;
733 } crypto_verify_update32_t;
734 
735 typedef struct crypto_verify_final32 {
736 	uint32_t		vf_return_value;
737 	crypto_session_id_t	vf_session;
738 	size32_t		vf_signlen;
739 	caddr32_t		vf_signbuf;
740 } crypto_verify_final32_t;
741 
742 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
743 #pragma pack(4)
744 #endif
745 
746 typedef struct crypto_verify_recover_init32 {
747 	uint32_t		ri_return_value;
748 	crypto_session_id_t	ri_session;
749 	crypto_mechanism32_t	ri_mech;
750 	crypto_key32_t		ri_key;
751 } crypto_verify_recover_init32_t;
752 
753 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
754 #pragma pack()
755 #endif
756 
757 typedef struct crypto_verify_recover32 {
758 	uint32_t		vr_return_value;
759 	crypto_session_id_t	vr_session;
760 	size32_t		vr_signlen;
761 	caddr32_t		vr_signbuf;
762 	size32_t		vr_datalen;
763 	caddr32_t		vr_databuf;
764 } crypto_verify_recover32_t;
765 
766 typedef struct crypto_digest_encrypt_update32 {
767 	uint32_t		eu_return_value;
768 	crypto_session_id_t	eu_session;
769 	size32_t		eu_datalen;
770 	caddr32_t		eu_databuf;
771 	size32_t		eu_encrlen;
772 	caddr32_t		eu_encrbuf;
773 } crypto_digest_encrypt_update32_t;
774 
775 typedef struct crypto_decrypt_digest_update32 {
776 	uint32_t		du_return_value;
777 	crypto_session_id_t	du_session;
778 	size32_t		du_encrlen;
779 	caddr32_t		du_encrbuf;
780 	size32_t		du_datalen;
781 	caddr32_t		du_databuf;
782 } crypto_decrypt_digest_update32_t;
783 
784 typedef struct crypto_sign_encrypt_update32 {
785 	uint32_t		eu_return_value;
786 	crypto_session_id_t	eu_session;
787 	size32_t		eu_datalen;
788 	caddr32_t		eu_databuf;
789 	size32_t		eu_encrlen;
790 	caddr32_t		eu_encrbuf;
791 } crypto_sign_encrypt_update32_t;
792 
793 typedef struct crypto_decrypt_verify_update32 {
794 	uint32_t		vu_return_value;
795 	crypto_session_id_t	vu_session;
796 	size32_t		vu_encrlen;
797 	caddr32_t		vu_encrbuf;
798 	size32_t		vu_datalen;
799 	caddr32_t		vu_databuf;
800 } crypto_decrypt_verify_update32_t;
801 
802 #endif	/* _SYSCALL32 */
803 #endif	/* _KERNEL */
804 
805 #define	CRYPTO_ENCRYPT			CRYPTO(50)
806 #define	CRYPTO_ENCRYPT_INIT		CRYPTO(51)
807 #define	CRYPTO_ENCRYPT_UPDATE		CRYPTO(52)
808 #define	CRYPTO_ENCRYPT_FINAL		CRYPTO(53)
809 #define	CRYPTO_DECRYPT			CRYPTO(54)
810 #define	CRYPTO_DECRYPT_INIT		CRYPTO(55)
811 #define	CRYPTO_DECRYPT_UPDATE		CRYPTO(56)
812 #define	CRYPTO_DECRYPT_FINAL		CRYPTO(57)
813 
814 #define	CRYPTO_DIGEST			CRYPTO(58)
815 #define	CRYPTO_DIGEST_INIT		CRYPTO(59)
816 #define	CRYPTO_DIGEST_UPDATE		CRYPTO(60)
817 #define	CRYPTO_DIGEST_KEY		CRYPTO(61)
818 #define	CRYPTO_DIGEST_FINAL		CRYPTO(62)
819 #define	CRYPTO_MAC			CRYPTO(63)
820 #define	CRYPTO_MAC_INIT			CRYPTO(64)
821 #define	CRYPTO_MAC_UPDATE		CRYPTO(65)
822 #define	CRYPTO_MAC_FINAL		CRYPTO(66)
823 
824 #define	CRYPTO_SIGN			CRYPTO(67)
825 #define	CRYPTO_SIGN_INIT		CRYPTO(68)
826 #define	CRYPTO_SIGN_UPDATE		CRYPTO(69)
827 #define	CRYPTO_SIGN_FINAL		CRYPTO(70)
828 #define	CRYPTO_SIGN_RECOVER_INIT	CRYPTO(71)
829 #define	CRYPTO_SIGN_RECOVER		CRYPTO(72)
830 #define	CRYPTO_VERIFY			CRYPTO(73)
831 #define	CRYPTO_VERIFY_INIT		CRYPTO(74)
832 #define	CRYPTO_VERIFY_UPDATE		CRYPTO(75)
833 #define	CRYPTO_VERIFY_FINAL		CRYPTO(76)
834 #define	CRYPTO_VERIFY_RECOVER_INIT	CRYPTO(77)
835 #define	CRYPTO_VERIFY_RECOVER		CRYPTO(78)
836 
837 #define	CRYPTO_DIGEST_ENCRYPT_UPDATE	CRYPTO(79)
838 #define	CRYPTO_DECRYPT_DIGEST_UPDATE	CRYPTO(80)
839 #define	CRYPTO_SIGN_ENCRYPT_UPDATE	CRYPTO(81)
840 #define	CRYPTO_DECRYPT_VERIFY_UPDATE	CRYPTO(82)
841 
842 /*
843  * Random Number Ioctls
844  */
845 typedef struct crypto_seed_random {
846 	uint_t			sr_return_value;
847 	crypto_session_id_t	sr_session;
848 	size_t			sr_seedlen;
849 	caddr_t			sr_seedbuf;
850 } crypto_seed_random_t;
851 
852 typedef struct crypto_generate_random {
853 	uint_t			gr_return_value;
854 	crypto_session_id_t	gr_session;
855 	caddr_t			gr_buf;
856 	size_t			gr_buflen;
857 } crypto_generate_random_t;
858 
859 #ifdef	_KERNEL
860 #ifdef	_SYSCALL32
861 
862 typedef struct crypto_seed_random32 {
863 	uint32_t		sr_return_value;
864 	crypto_session_id_t	sr_session;
865 	size32_t		sr_seedlen;
866 	caddr32_t		sr_seedbuf;
867 } crypto_seed_random32_t;
868 
869 typedef struct crypto_generate_random32 {
870 	uint32_t		gr_return_value;
871 	crypto_session_id_t	gr_session;
872 	caddr32_t		gr_buf;
873 	size32_t		gr_buflen;
874 } crypto_generate_random32_t;
875 
876 #endif	/* _SYSCALL32 */
877 #endif	/* _KERNEL */
878 
879 #define	CRYPTO_SEED_RANDOM		CRYPTO(90)
880 #define	CRYPTO_GENERATE_RANDOM		CRYPTO(91)
881 
882 /*
883  * Object Management Ioctls
884  */
885 typedef struct crypto_object_create {
886 	uint_t			oc_return_value;
887 	crypto_session_id_t	oc_session;
888 	crypto_object_id_t	oc_handle;
889 	uint_t			oc_count;
890 	caddr_t			oc_attributes;
891 } crypto_object_create_t;
892 
893 typedef struct crypto_object_copy {
894 	uint_t			oc_return_value;
895 	crypto_session_id_t	oc_session;
896 	crypto_object_id_t	oc_handle;
897 	crypto_object_id_t	oc_new_handle;
898 	uint_t			oc_count;
899 	caddr_t			oc_new_attributes;
900 } crypto_object_copy_t;
901 
902 typedef struct crypto_object_destroy {
903 	uint_t			od_return_value;
904 	crypto_session_id_t	od_session;
905 	crypto_object_id_t	od_handle;
906 } crypto_object_destroy_t;
907 
908 typedef struct crypto_object_get_attribute_value {
909 	uint_t			og_return_value;
910 	crypto_session_id_t	og_session;
911 	crypto_object_id_t	og_handle;
912 	uint_t			og_count;
913 	caddr_t			og_attributes;
914 } crypto_object_get_attribute_value_t;
915 
916 typedef struct crypto_object_get_size {
917 	uint_t			gs_return_value;
918 	crypto_session_id_t	gs_session;
919 	crypto_object_id_t	gs_handle;
920 	size_t			gs_size;
921 } crypto_object_get_size_t;
922 
923 typedef struct crypto_object_set_attribute_value {
924 	uint_t			sa_return_value;
925 	crypto_session_id_t	sa_session;
926 	crypto_object_id_t	sa_handle;
927 	uint_t			sa_count;
928 	caddr_t			sa_attributes;
929 } crypto_object_set_attribute_value_t;
930 
931 typedef struct crypto_object_find_init {
932 	uint_t			fi_return_value;
933 	crypto_session_id_t	fi_session;
934 	uint_t			fi_count;
935 	caddr_t			fi_attributes;
936 } crypto_object_find_init_t;
937 
938 typedef struct crypto_object_find_update {
939 	uint_t			fu_return_value;
940 	crypto_session_id_t	fu_session;
941 	uint_t			fu_max_count;
942 	uint_t			fu_count;
943 	caddr_t			fu_handles;
944 } crypto_object_find_update_t;
945 
946 typedef struct crypto_object_find_final {
947 	uint_t			ff_return_value;
948 	crypto_session_id_t	ff_session;
949 } crypto_object_find_final_t;
950 
951 #ifdef	_KERNEL
952 #ifdef	_SYSCALL32
953 
954 typedef struct crypto_object_create32 {
955 	uint32_t		oc_return_value;
956 	crypto_session_id_t	oc_session;
957 	crypto_object_id_t	oc_handle;
958 	uint32_t		oc_count;
959 	caddr32_t		oc_attributes;
960 } crypto_object_create32_t;
961 
962 typedef struct crypto_object_copy32 {
963 	uint32_t		oc_return_value;
964 	crypto_session_id_t	oc_session;
965 	crypto_object_id_t	oc_handle;
966 	crypto_object_id_t	oc_new_handle;
967 	uint32_t		oc_count;
968 	caddr32_t		oc_new_attributes;
969 } crypto_object_copy32_t;
970 
971 typedef struct crypto_object_destroy32 {
972 	uint32_t		od_return_value;
973 	crypto_session_id_t	od_session;
974 	crypto_object_id_t	od_handle;
975 } crypto_object_destroy32_t;
976 
977 typedef struct crypto_object_get_attribute_value32 {
978 	uint32_t		og_return_value;
979 	crypto_session_id_t	og_session;
980 	crypto_object_id_t	og_handle;
981 	uint32_t		og_count;
982 	caddr32_t		og_attributes;
983 } crypto_object_get_attribute_value32_t;
984 
985 typedef struct crypto_object_get_size32 {
986 	uint32_t		gs_return_value;
987 	crypto_session_id_t	gs_session;
988 	crypto_object_id_t	gs_handle;
989 	size32_t		gs_size;
990 } crypto_object_get_size32_t;
991 
992 typedef struct crypto_object_set_attribute_value32 {
993 	uint32_t		sa_return_value;
994 	crypto_session_id_t	sa_session;
995 	crypto_object_id_t	sa_handle;
996 	uint32_t		sa_count;
997 	caddr32_t		sa_attributes;
998 } crypto_object_set_attribute_value32_t;
999 
1000 typedef struct crypto_object_find_init32 {
1001 	uint32_t		fi_return_value;
1002 	crypto_session_id_t	fi_session;
1003 	uint32_t		fi_count;
1004 	caddr32_t		fi_attributes;
1005 } crypto_object_find_init32_t;
1006 
1007 typedef struct crypto_object_find_update32 {
1008 	uint32_t		fu_return_value;
1009 	crypto_session_id_t	fu_session;
1010 	uint32_t		fu_max_count;
1011 	uint32_t		fu_count;
1012 	caddr32_t		fu_handles;
1013 } crypto_object_find_update32_t;
1014 
1015 typedef struct crypto_object_find_final32 {
1016 	uint32_t		ff_return_value;
1017 	crypto_session_id_t	ff_session;
1018 } crypto_object_find_final32_t;
1019 
1020 #endif	/* _SYSCALL32 */
1021 #endif	/* _KERNEL */
1022 
1023 #define	CRYPTO_OBJECT_CREATE			CRYPTO(100)
1024 #define	CRYPTO_OBJECT_COPY			CRYPTO(101)
1025 #define	CRYPTO_OBJECT_DESTROY			CRYPTO(102)
1026 #define	CRYPTO_OBJECT_GET_ATTRIBUTE_VALUE	CRYPTO(103)
1027 #define	CRYPTO_OBJECT_GET_SIZE			CRYPTO(104)
1028 #define	CRYPTO_OBJECT_SET_ATTRIBUTE_VALUE	CRYPTO(105)
1029 #define	CRYPTO_OBJECT_FIND_INIT			CRYPTO(106)
1030 #define	CRYPTO_OBJECT_FIND_UPDATE		CRYPTO(107)
1031 #define	CRYPTO_OBJECT_FIND_FINAL		CRYPTO(108)
1032 
1033 /*
1034  * Key Generation Ioctls
1035  */
1036 typedef struct crypto_object_generate_key {
1037 	uint_t			gk_return_value;
1038 	crypto_session_id_t	gk_session;
1039 	crypto_object_id_t	gk_handle;
1040 	crypto_mechanism_t	gk_mechanism;
1041 	uint_t			gk_count;
1042 	caddr_t			gk_attributes;
1043 } crypto_object_generate_key_t;
1044 
1045 typedef struct crypto_object_generate_key_pair {
1046 	uint_t			kp_return_value;
1047 	crypto_session_id_t	kp_session;
1048 	crypto_object_id_t	kp_public_handle;
1049 	crypto_object_id_t	kp_private_handle;
1050 	uint_t			kp_public_count;
1051 	uint_t			kp_private_count;
1052 	caddr_t			kp_public_attributes;
1053 	caddr_t			kp_private_attributes;
1054 	crypto_mechanism_t	kp_mechanism;
1055 } crypto_object_generate_key_pair_t;
1056 
1057 typedef struct crypto_object_wrap_key {
1058 	uint_t			wk_return_value;
1059 	crypto_session_id_t	wk_session;
1060 	crypto_mechanism_t	wk_mechanism;
1061 	crypto_key_t		wk_wrapping_key;
1062 	crypto_object_id_t	wk_object_handle;
1063 	size_t			wk_wrapped_key_len;
1064 	caddr_t			wk_wrapped_key;
1065 } crypto_object_wrap_key_t;
1066 
1067 typedef struct crypto_object_unwrap_key {
1068 	uint_t			uk_return_value;
1069 	crypto_session_id_t	uk_session;
1070 	crypto_mechanism_t	uk_mechanism;
1071 	crypto_key_t		uk_unwrapping_key;
1072 	crypto_object_id_t	uk_object_handle;
1073 	size_t			uk_wrapped_key_len;
1074 	caddr_t			uk_wrapped_key;
1075 	uint_t			uk_count;
1076 	caddr_t			uk_attributes;
1077 } crypto_object_unwrap_key_t;
1078 
1079 typedef struct crypto_derive_key {
1080 	uint_t			dk_return_value;
1081 	crypto_session_id_t	dk_session;
1082 	crypto_mechanism_t	dk_mechanism;
1083 	crypto_key_t		dk_base_key;
1084 	crypto_object_id_t	dk_object_handle;
1085 	uint_t			dk_count;
1086 	caddr_t			dk_attributes;
1087 } crypto_derive_key_t;
1088 
1089 #ifdef	_KERNEL
1090 #ifdef	_SYSCALL32
1091 
1092 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1093 #pragma pack(4)
1094 #endif
1095 
1096 typedef struct crypto_object_generate_key32 {
1097 	uint32_t		gk_return_value;
1098 	crypto_session_id_t	gk_session;
1099 	crypto_object_id_t	gk_handle;
1100 	crypto_mechanism32_t	gk_mechanism;
1101 	uint32_t		gk_count;
1102 	caddr32_t		gk_attributes;
1103 } crypto_object_generate_key32_t;
1104 
1105 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
1106 #pragma pack()
1107 #endif
1108 
1109 typedef struct crypto_object_generate_key_pair32 {
1110 	uint32_t		kp_return_value;
1111 	crypto_session_id_t	kp_session;
1112 	crypto_object_id_t	kp_public_handle;
1113 	crypto_object_id_t	kp_private_handle;
1114 	uint32_t		kp_public_count;
1115 	uint32_t		kp_private_count;
1116 	caddr32_t		kp_public_attributes;
1117 	caddr32_t		kp_private_attributes;
1118 	crypto_mechanism32_t	kp_mechanism;
1119 } crypto_object_generate_key_pair32_t;
1120 
1121 typedef struct crypto_object_wrap_key32 {
1122 	uint32_t		wk_return_value;
1123 	crypto_session_id_t	wk_session;
1124 	crypto_mechanism32_t	wk_mechanism;
1125 	crypto_key32_t		wk_wrapping_key;
1126 	crypto_object_id_t	wk_object_handle;
1127 	size32_t		wk_wrapped_key_len;
1128 	caddr32_t		wk_wrapped_key;
1129 } crypto_object_wrap_key32_t;
1130 
1131 typedef struct crypto_object_unwrap_key32 {
1132 	uint32_t		uk_return_value;
1133 	crypto_session_id_t	uk_session;
1134 	crypto_mechanism32_t	uk_mechanism;
1135 	crypto_key32_t		uk_unwrapping_key;
1136 	crypto_object_id_t	uk_object_handle;
1137 	size32_t		uk_wrapped_key_len;
1138 	caddr32_t		uk_wrapped_key;
1139 	uint32_t		uk_count;
1140 	caddr32_t		uk_attributes;
1141 } crypto_object_unwrap_key32_t;
1142 
1143 typedef struct crypto_derive_key32 {
1144 	uint32_t		dk_return_value;
1145 	crypto_session_id_t	dk_session;
1146 	crypto_mechanism32_t	dk_mechanism;
1147 	crypto_key32_t		dk_base_key;
1148 	crypto_object_id_t	dk_object_handle;
1149 	uint32_t		dk_count;
1150 	caddr32_t		dk_attributes;
1151 } crypto_derive_key32_t;
1152 
1153 #endif	/* _SYSCALL32 */
1154 #endif	/* _KERNEL */
1155 
1156 #define	CRYPTO_GENERATE_KEY		CRYPTO(110)
1157 #define	CRYPTO_GENERATE_KEY_PAIR	CRYPTO(111)
1158 #define	CRYPTO_WRAP_KEY			CRYPTO(112)
1159 #define	CRYPTO_UNWRAP_KEY		CRYPTO(113)
1160 #define	CRYPTO_DERIVE_KEY		CRYPTO(114)
1161 
1162 /*
1163  * Provider Management Ioctls
1164  */
1165 
1166 typedef struct crypto_get_provider_list {
1167 	uint_t			pl_return_value;
1168 	uint_t			pl_count;
1169 	crypto_provider_entry_t	pl_list[1];
1170 } crypto_get_provider_list_t;
1171 
1172 typedef struct crypto_provider_data {
1173 	uchar_t			pd_prov_desc[CRYPTO_PROVIDER_DESCR_MAX_LEN];
1174 	uchar_t			pd_label[CRYPTO_EXT_SIZE_LABEL];
1175 	uchar_t			pd_manufacturerID[CRYPTO_EXT_SIZE_MANUF];
1176 	uchar_t			pd_model[CRYPTO_EXT_SIZE_MODEL];
1177 	uchar_t			pd_serial_number[CRYPTO_EXT_SIZE_SERIAL];
1178 	ulong_t			pd_flags;
1179 	ulong_t			pd_max_session_count;
1180 	ulong_t			pd_session_count;
1181 	ulong_t			pd_max_rw_session_count;
1182 	ulong_t			pd_rw_session_count;
1183 	ulong_t			pd_max_pin_len;
1184 	ulong_t			pd_min_pin_len;
1185 	ulong_t			pd_total_public_memory;
1186 	ulong_t			pd_free_public_memory;
1187 	ulong_t			pd_total_private_memory;
1188 	ulong_t			pd_free_private_memory;
1189 	crypto_version_t	pd_hardware_version;
1190 	crypto_version_t	pd_firmware_version;
1191 	uchar_t			pd_time[CRYPTO_EXT_SIZE_TIME];
1192 } crypto_provider_data_t;
1193 
1194 typedef struct crypto_get_provider_info {
1195 	uint_t			gi_return_value;
1196 	crypto_provider_id_t	gi_provider_id;
1197 	crypto_provider_data_t	gi_provider_data;
1198 } crypto_get_provider_info_t;
1199 
1200 typedef struct crypto_get_provider_mechanisms {
1201 	uint_t			pm_return_value;
1202 	crypto_provider_id_t	pm_provider_id;
1203 	uint_t			pm_count;
1204 	crypto_mech_name_t	pm_list[1];
1205 } crypto_get_provider_mechanisms_t;
1206 
1207 typedef struct crypto_get_provider_mechanism_info {
1208 	uint_t			mi_return_value;
1209 	crypto_provider_id_t	mi_provider_id;
1210 	crypto_mech_name_t	mi_mechanism_name;
1211 	uint32_t		mi_min_key_size;
1212 	uint32_t		mi_max_key_size;
1213 	uint32_t		mi_flags;
1214 } crypto_get_provider_mechanism_info_t;
1215 
1216 typedef struct crypto_init_token {
1217 	uint_t			it_return_value;
1218 	crypto_provider_id_t	it_provider_id;
1219 	caddr_t			it_pin;
1220 	size_t			it_pin_len;
1221 	caddr_t			it_label;
1222 } crypto_init_token_t;
1223 
1224 typedef struct crypto_init_pin {
1225 	uint_t			ip_return_value;
1226 	crypto_session_id_t	ip_session;
1227 	caddr_t			ip_pin;
1228 	size_t			ip_pin_len;
1229 } crypto_init_pin_t;
1230 
1231 typedef struct crypto_set_pin {
1232 	uint_t			sp_return_value;
1233 	crypto_session_id_t	sp_session;
1234 	caddr_t			sp_old_pin;
1235 	size_t			sp_old_len;
1236 	caddr_t			sp_new_pin;
1237 	size_t			sp_new_len;
1238 } crypto_set_pin_t;
1239 
1240 #ifdef	_KERNEL
1241 #ifdef	_SYSCALL32
1242 
1243 typedef struct crypto_get_provider_list32 {
1244 	uint32_t		pl_return_value;
1245 	uint32_t		pl_count;
1246 	crypto_provider_entry_t pl_list[1];
1247 } crypto_get_provider_list32_t;
1248 
1249 typedef struct crypto_version32 {
1250 	uchar_t	cv_major;
1251 	uchar_t	cv_minor;
1252 } crypto_version32_t;
1253 
1254 typedef struct crypto_provider_data32 {
1255 	uchar_t			pd_prov_desc[CRYPTO_PROVIDER_DESCR_MAX_LEN];
1256 	uchar_t			pd_label[CRYPTO_EXT_SIZE_LABEL];
1257 	uchar_t			pd_manufacturerID[CRYPTO_EXT_SIZE_MANUF];
1258 	uchar_t			pd_model[CRYPTO_EXT_SIZE_MODEL];
1259 	uchar_t			pd_serial_number[CRYPTO_EXT_SIZE_SERIAL];
1260 	uint32_t		pd_flags;
1261 	uint32_t		pd_max_session_count;
1262 	uint32_t		pd_session_count;
1263 	uint32_t		pd_max_rw_session_count;
1264 	uint32_t		pd_rw_session_count;
1265 	uint32_t		pd_max_pin_len;
1266 	uint32_t		pd_min_pin_len;
1267 	uint32_t		pd_total_public_memory;
1268 	uint32_t		pd_free_public_memory;
1269 	uint32_t		pd_total_private_memory;
1270 	uint32_t		pd_free_private_memory;
1271 	crypto_version32_t	pd_hardware_version;
1272 	crypto_version32_t	pd_firmware_version;
1273 	uchar_t			pd_time[CRYPTO_EXT_SIZE_TIME];
1274 } crypto_provider_data32_t;
1275 
1276 typedef struct crypto_get_provider_info32 {
1277 	uint32_t		gi_return_value;
1278 	crypto_provider_id_t	gi_provider_id;
1279 	crypto_provider_data32_t gi_provider_data;
1280 } crypto_get_provider_info32_t;
1281 
1282 typedef struct crypto_get_provider_mechanisms32 {
1283 	uint32_t		pm_return_value;
1284 	crypto_provider_id_t	pm_provider_id;
1285 	uint32_t		pm_count;
1286 	crypto_mech_name_t	pm_list[1];
1287 } crypto_get_provider_mechanisms32_t;
1288 
1289 typedef struct crypto_init_token32 {
1290 	uint32_t		it_return_value;
1291 	crypto_provider_id_t	it_provider_id;
1292 	caddr32_t		it_pin;
1293 	size32_t		it_pin_len;
1294 	caddr32_t		it_label;
1295 } crypto_init_token32_t;
1296 
1297 typedef struct crypto_init_pin32 {
1298 	uint32_t		ip_return_value;
1299 	crypto_session_id_t	ip_session;
1300 	caddr32_t		ip_pin;
1301 	size32_t		ip_pin_len;
1302 } crypto_init_pin32_t;
1303 
1304 typedef struct crypto_set_pin32 {
1305 	uint32_t		sp_return_value;
1306 	crypto_session_id_t	sp_session;
1307 	caddr32_t		sp_old_pin;
1308 	size32_t		sp_old_len;
1309 	caddr32_t		sp_new_pin;
1310 	size32_t		sp_new_len;
1311 } crypto_set_pin32_t;
1312 
1313 #endif	/* _SYSCALL32 */
1314 #endif	/* _KERNEL */
1315 
1316 #define	CRYPTO_GET_PROVIDER_LIST		CRYPTO(120)
1317 #define	CRYPTO_GET_PROVIDER_INFO		CRYPTO(121)
1318 #define	CRYPTO_GET_PROVIDER_MECHANISMS		CRYPTO(122)
1319 #define	CRYPTO_GET_PROVIDER_MECHANISM_INFO	CRYPTO(123)
1320 #define	CRYPTO_INIT_TOKEN			CRYPTO(124)
1321 #define	CRYPTO_INIT_PIN				CRYPTO(125)
1322 #define	CRYPTO_SET_PIN				CRYPTO(126)
1323 
1324 #ifdef	__cplusplus
1325 }
1326 #endif
1327 
1328 #endif	/* _SYS_CRYPTO_IOCTL_H */
1329