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