xref: /titanic_44/usr/src/uts/common/sys/crypto/ioctladmin.h (revision 0dc2366f7b9f9f36e10909b1e95edbf2a261c2ac)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_CRYPTO_IOCTLADMIN_H
27 #define	_SYS_CRYPTO_IOCTLADMIN_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <sys/crypto/common.h>
35 
36 #define	ADMIN_IOCTL_DEVICE	"/dev/cryptoadm"
37 
38 #define	CRYPTOADMIN(x)		(('y' << 8) | (x))
39 
40 /*
41  * Administrative IOCTLs
42  */
43 
44 typedef struct crypto_get_dev_list {
45 	uint_t			dl_return_value;
46 	uint_t			dl_dev_count;
47 	crypto_dev_list_entry_t	dl_devs[1];
48 } crypto_get_dev_list_t;
49 
50 typedef struct crypto_get_soft_list {
51 	uint_t			sl_return_value;
52 	uint_t			sl_soft_count;
53 	size_t			sl_soft_len;
54 	caddr_t			sl_soft_names;
55 } crypto_get_soft_list_t;
56 
57 typedef struct crypto_get_dev_info {
58 	uint_t			di_return_value;
59 	char			di_dev_name[MAXNAMELEN];
60 	uint_t			di_dev_instance;
61 	uint_t			di_count;
62 	crypto_mech_name_t	di_list[1];
63 } crypto_get_dev_info_t;
64 
65 typedef struct crypto_get_soft_info {
66 	uint_t			si_return_value;
67 	char			si_name[MAXNAMELEN];
68 	uint_t			si_count;
69 	crypto_mech_name_t	si_list[1];
70 } crypto_get_soft_info_t;
71 
72 typedef struct crypto_load_dev_disabled {
73 	uint_t			dd_return_value;
74 	char			dd_dev_name[MAXNAMELEN];
75 	uint_t			dd_dev_instance;
76 	uint_t			dd_count;
77 	crypto_mech_name_t	dd_list[1];
78 } crypto_load_dev_disabled_t;
79 
80 typedef struct crypto_load_soft_disabled {
81 	uint_t			sd_return_value;
82 	char			sd_name[MAXNAMELEN];
83 	uint_t			sd_count;
84 	crypto_mech_name_t	sd_list[1];
85 } crypto_load_soft_disabled_t;
86 
87 typedef struct crypto_unload_soft_module {
88 	uint_t			sm_return_value;
89 	char			sm_name[MAXNAMELEN];
90 } crypto_unload_soft_module_t;
91 
92 typedef struct crypto_load_soft_config {
93 	uint_t			sc_return_value;
94 	char			sc_name[MAXNAMELEN];
95 	uint_t			sc_count;
96 	crypto_mech_name_t	sc_list[1];
97 } crypto_load_soft_config_t;
98 
99 typedef struct crypto_load_door {
100 	uint_t			ld_return_value;
101 	uint_t			ld_did;
102 } crypto_load_door_t;
103 
104 typedef struct crypto_fips140 {
105 	uint_t			fips140_return_value;
106 	uint_t			fips140_op;
107 	uint_t			fips140_status;
108 } crypto_fips140_t;
109 
110 #ifdef	_KERNEL
111 #ifdef	_SYSCALL32
112 
113 typedef struct crypto_get_soft_list32 {
114 	uint32_t		sl_return_value;
115 	uint32_t		sl_soft_count;
116 	size32_t		sl_soft_len;
117 	caddr32_t		sl_soft_names;
118 } crypto_get_soft_list32_t;
119 
120 #endif	/* _SYSCALL32 */
121 #endif	/* _KERNEL */
122 
123 /*
124  * FIPS140 ioctl operations
125  */
126 enum {
127 	FIPS140_STATUS,		/* get current fips140 mode */
128 	FIPS140_ENABLE,		/* enable fips140 mode */
129 	FIPS140_DISABLE		/* disable fips140 mode */
130 
131 
132 };
133 
134 /*
135  * FIPS140 Mode Status
136  */
137 enum {
138 	FIPS140_MODE_UNSET,	 /* userland has not told us the mode */
139 	FIPS140_MODE_VALIDATING, /* In the process of validation to enable */
140 	FIPS140_MODE_SHUTDOWN,	 /* Failure has occurred, shutdown framework */
141 	FIPS140_MODE_ENABLED,	 /* Validation is complete and we are running */
142 	FIPS140_MODE_DISABLED	 /* Not running in FIPS 140 mode */
143 };
144 
145 #define	CRYPTO_GET_VERSION		CRYPTOADMIN(1)
146 #define	CRYPTO_GET_DEV_LIST		CRYPTOADMIN(2)
147 #define	CRYPTO_GET_SOFT_LIST		CRYPTOADMIN(3)
148 #define	CRYPTO_GET_DEV_INFO		CRYPTOADMIN(4)
149 #define	CRYPTO_GET_SOFT_INFO		CRYPTOADMIN(5)
150 #define	CRYPTO_LOAD_DEV_DISABLED	CRYPTOADMIN(8)
151 #define	CRYPTO_LOAD_SOFT_DISABLED	CRYPTOADMIN(9)
152 #define	CRYPTO_UNLOAD_SOFT_MODULE	CRYPTOADMIN(10)
153 #define	CRYPTO_LOAD_SOFT_CONFIG		CRYPTOADMIN(11)
154 #define	CRYPTO_POOL_CREATE		CRYPTOADMIN(12)
155 #define	CRYPTO_POOL_WAIT		CRYPTOADMIN(13)
156 #define	CRYPTO_POOL_RUN			CRYPTOADMIN(14)
157 #define	CRYPTO_LOAD_DOOR		CRYPTOADMIN(15)
158 #define	CRYPTO_FIPS140_STATUS		CRYPTOADMIN(16)
159 #define	CRYPTO_FIPS140_SET		CRYPTOADMIN(17)
160 
161 #ifdef	__cplusplus
162 }
163 #endif
164 
165 #endif	/* _SYS_CRYPTO_IOCTLADMIN_H */
166