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