1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_CRYPTO_IOCTLADMIN_H
28 #define	_SYS_CRYPTO_IOCTLADMIN_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/zfs_context.h>
35 #include <sys/crypto/common.h>
36 
37 #define	ADMIN_IOCTL_DEVICE	"/dev/cryptoadm"
38 
39 #define	CRYPTOADMIN(x)		(('y' << 8) | (x))
40 
41 /*
42  * Administrative IOCTLs
43  */
44 
45 typedef struct crypto_get_dev_list {
46 	uint_t			dl_return_value;
47 	uint_t			dl_dev_count;
48 	crypto_dev_list_entry_t	dl_devs[1];
49 } crypto_get_dev_list_t;
50 
51 typedef struct crypto_get_soft_list {
52 	uint_t			sl_return_value;
53 	uint_t			sl_soft_count;
54 	size_t			sl_soft_len;
55 	caddr_t			sl_soft_names;
56 } crypto_get_soft_list_t;
57 
58 typedef struct crypto_get_dev_info {
59 	uint_t			di_return_value;
60 	char			di_dev_name[MAXNAMELEN];
61 	uint_t			di_dev_instance;
62 	uint_t			di_count;
63 	crypto_mech_name_t	di_list[1];
64 } crypto_get_dev_info_t;
65 
66 typedef struct crypto_get_soft_info {
67 	uint_t			si_return_value;
68 	char			si_name[MAXNAMELEN];
69 	uint_t			si_count;
70 	crypto_mech_name_t	si_list[1];
71 } crypto_get_soft_info_t;
72 
73 typedef struct crypto_load_dev_disabled {
74 	uint_t			dd_return_value;
75 	char			dd_dev_name[MAXNAMELEN];
76 	uint_t			dd_dev_instance;
77 	uint_t			dd_count;
78 	crypto_mech_name_t	dd_list[1];
79 } crypto_load_dev_disabled_t;
80 
81 typedef struct crypto_load_soft_disabled {
82 	uint_t			sd_return_value;
83 	char			sd_name[MAXNAMELEN];
84 	uint_t			sd_count;
85 	crypto_mech_name_t	sd_list[1];
86 } crypto_load_soft_disabled_t;
87 
88 typedef struct crypto_unload_soft_module {
89 	uint_t			sm_return_value;
90 	char			sm_name[MAXNAMELEN];
91 } crypto_unload_soft_module_t;
92 
93 typedef struct crypto_load_soft_config {
94 	uint_t			sc_return_value;
95 	char			sc_name[MAXNAMELEN];
96 	uint_t			sc_count;
97 	crypto_mech_name_t	sc_list[1];
98 } crypto_load_soft_config_t;
99 
100 typedef struct crypto_load_door {
101 	uint_t			ld_return_value;
102 	uint_t			ld_did;
103 } crypto_load_door_t;
104 
105 #ifdef	_KERNEL
106 #ifdef	_SYSCALL32
107 
108 typedef struct crypto_get_soft_list32 {
109 	uint32_t		sl_return_value;
110 	uint32_t		sl_soft_count;
111 	size32_t		sl_soft_len;
112 	caddr32_t		sl_soft_names;
113 } crypto_get_soft_list32_t;
114 
115 #endif	/* _SYSCALL32 */
116 #endif	/* _KERNEL */
117 
118 #define	CRYPTO_GET_VERSION		CRYPTOADMIN(1)
119 #define	CRYPTO_GET_DEV_LIST		CRYPTOADMIN(2)
120 #define	CRYPTO_GET_SOFT_LIST		CRYPTOADMIN(3)
121 #define	CRYPTO_GET_DEV_INFO		CRYPTOADMIN(4)
122 #define	CRYPTO_GET_SOFT_INFO		CRYPTOADMIN(5)
123 #define	CRYPTO_LOAD_DEV_DISABLED	CRYPTOADMIN(8)
124 #define	CRYPTO_LOAD_SOFT_DISABLED	CRYPTOADMIN(9)
125 #define	CRYPTO_UNLOAD_SOFT_MODULE	CRYPTOADMIN(10)
126 #define	CRYPTO_LOAD_SOFT_CONFIG		CRYPTOADMIN(11)
127 #define	CRYPTO_POOL_CREATE		CRYPTOADMIN(12)
128 #define	CRYPTO_POOL_WAIT		CRYPTOADMIN(13)
129 #define	CRYPTO_POOL_RUN			CRYPTOADMIN(14)
130 #define	CRYPTO_LOAD_DOOR		CRYPTOADMIN(15)
131 
132 #ifdef	__cplusplus
133 }
134 #endif
135 
136 #endif	/* _SYS_CRYPTO_IOCTLADMIN_H */
137