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