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