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