xref: /illumos-gate/usr/src/uts/common/sys/crypto/ioctladmin.h (revision b5a2d8455dfa3190fc977c4bec53e91c99012767)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*b5a2d845SHai-May Chao  * Common Development and Distribution License (the "License").
6*b5a2d845SHai-May Chao  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*b5a2d845SHai-May Chao  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_CRYPTO_IOCTLADMIN_H
277c478bd9Sstevel@tonic-gate #define	_SYS_CRYPTO_IOCTLADMIN_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <sys/crypto/common.h>
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #define	ADMIN_IOCTL_DEVICE	"/dev/cryptoadm"
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #define	CRYPTOADMIN(x)		(('y' << 8) | (x))
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Administrative IOCTLs
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate typedef struct crypto_get_dev_list {
457c478bd9Sstevel@tonic-gate 	uint_t			dl_return_value;
467c478bd9Sstevel@tonic-gate 	uint_t			dl_dev_count;
477c478bd9Sstevel@tonic-gate 	crypto_dev_list_entry_t	dl_devs[1];
487c478bd9Sstevel@tonic-gate } crypto_get_dev_list_t;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate typedef struct crypto_get_soft_list {
517c478bd9Sstevel@tonic-gate 	uint_t			sl_return_value;
527c478bd9Sstevel@tonic-gate 	uint_t			sl_soft_count;
537c478bd9Sstevel@tonic-gate 	size_t			sl_soft_len;
547c478bd9Sstevel@tonic-gate 	caddr_t			sl_soft_names;
557c478bd9Sstevel@tonic-gate } crypto_get_soft_list_t;
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate typedef struct crypto_get_dev_info {
587c478bd9Sstevel@tonic-gate 	uint_t			di_return_value;
597c478bd9Sstevel@tonic-gate 	char			di_dev_name[MAXNAMELEN];
607c478bd9Sstevel@tonic-gate 	uint_t			di_dev_instance;
617c478bd9Sstevel@tonic-gate 	uint_t			di_count;
627c478bd9Sstevel@tonic-gate 	crypto_mech_name_t	di_list[1];
637c478bd9Sstevel@tonic-gate } crypto_get_dev_info_t;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate typedef struct crypto_get_soft_info {
667c478bd9Sstevel@tonic-gate 	uint_t			si_return_value;
677c478bd9Sstevel@tonic-gate 	char			si_name[MAXNAMELEN];
687c478bd9Sstevel@tonic-gate 	uint_t			si_count;
697c478bd9Sstevel@tonic-gate 	crypto_mech_name_t	si_list[1];
707c478bd9Sstevel@tonic-gate } crypto_get_soft_info_t;
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate typedef struct crypto_load_dev_disabled {
737c478bd9Sstevel@tonic-gate 	uint_t			dd_return_value;
747c478bd9Sstevel@tonic-gate 	char			dd_dev_name[MAXNAMELEN];
757c478bd9Sstevel@tonic-gate 	uint_t			dd_dev_instance;
767c478bd9Sstevel@tonic-gate 	uint_t			dd_count;
777c478bd9Sstevel@tonic-gate 	crypto_mech_name_t	dd_list[1];
787c478bd9Sstevel@tonic-gate } crypto_load_dev_disabled_t;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate typedef struct crypto_load_soft_disabled {
817c478bd9Sstevel@tonic-gate 	uint_t			sd_return_value;
827c478bd9Sstevel@tonic-gate 	char			sd_name[MAXNAMELEN];
837c478bd9Sstevel@tonic-gate 	uint_t			sd_count;
847c478bd9Sstevel@tonic-gate 	crypto_mech_name_t	sd_list[1];
857c478bd9Sstevel@tonic-gate } crypto_load_soft_disabled_t;
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate typedef struct crypto_unload_soft_module {
887c478bd9Sstevel@tonic-gate 	uint_t			sm_return_value;
897c478bd9Sstevel@tonic-gate 	char			sm_name[MAXNAMELEN];
907c478bd9Sstevel@tonic-gate } crypto_unload_soft_module_t;
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate typedef struct crypto_load_soft_config {
937c478bd9Sstevel@tonic-gate 	uint_t			sc_return_value;
947c478bd9Sstevel@tonic-gate 	char			sc_name[MAXNAMELEN];
957c478bd9Sstevel@tonic-gate 	uint_t			sc_count;
967c478bd9Sstevel@tonic-gate 	crypto_mech_name_t	sc_list[1];
977c478bd9Sstevel@tonic-gate } crypto_load_soft_config_t;
987c478bd9Sstevel@tonic-gate 
997c478bd9Sstevel@tonic-gate typedef struct crypto_load_door {
1007c478bd9Sstevel@tonic-gate 	uint_t			ld_return_value;
1017c478bd9Sstevel@tonic-gate 	uint_t			ld_did;
1027c478bd9Sstevel@tonic-gate } crypto_load_door_t;
1037c478bd9Sstevel@tonic-gate 
104*b5a2d845SHai-May Chao typedef struct crypto_fips140 {
105*b5a2d845SHai-May Chao 	uint_t			fips140_return_value;
106*b5a2d845SHai-May Chao 	uint_t			fips140_op;
107*b5a2d845SHai-May Chao 	uint_t			fips140_status;
108*b5a2d845SHai-May Chao } crypto_fips140_t;
109*b5a2d845SHai-May Chao 
1107c478bd9Sstevel@tonic-gate #ifdef	_KERNEL
1117c478bd9Sstevel@tonic-gate #ifdef	_SYSCALL32
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate typedef struct crypto_get_soft_list32 {
1147c478bd9Sstevel@tonic-gate 	uint32_t		sl_return_value;
1157c478bd9Sstevel@tonic-gate 	uint32_t		sl_soft_count;
1167c478bd9Sstevel@tonic-gate 	size32_t		sl_soft_len;
1177c478bd9Sstevel@tonic-gate 	caddr32_t		sl_soft_names;
1187c478bd9Sstevel@tonic-gate } crypto_get_soft_list32_t;
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #endif	/* _SYSCALL32 */
1217c478bd9Sstevel@tonic-gate #endif	/* _KERNEL */
1227c478bd9Sstevel@tonic-gate 
123*b5a2d845SHai-May Chao /*
124*b5a2d845SHai-May Chao  * FIPS140 ioctl operations
125*b5a2d845SHai-May Chao  */
126*b5a2d845SHai-May Chao enum {
127*b5a2d845SHai-May Chao 	FIPS140_STATUS,		/* get current fips140 mode */
128*b5a2d845SHai-May Chao 	FIPS140_ENABLE,		/* enable fips140 mode */
129*b5a2d845SHai-May Chao 	FIPS140_DISABLE		/* disable fips140 mode */
130*b5a2d845SHai-May Chao };
131*b5a2d845SHai-May Chao 
132*b5a2d845SHai-May Chao /*
133*b5a2d845SHai-May Chao  * FIPS140 Mode Status
134*b5a2d845SHai-May Chao  */
135*b5a2d845SHai-May Chao enum {
136*b5a2d845SHai-May Chao 	FIPS140_MODE_DISABLED,
137*b5a2d845SHai-May Chao 	FIPS140_MODE_ENABLED
138*b5a2d845SHai-May Chao };
139*b5a2d845SHai-May Chao 
1407c478bd9Sstevel@tonic-gate #define	CRYPTO_GET_VERSION		CRYPTOADMIN(1)
1417c478bd9Sstevel@tonic-gate #define	CRYPTO_GET_DEV_LIST		CRYPTOADMIN(2)
1427c478bd9Sstevel@tonic-gate #define	CRYPTO_GET_SOFT_LIST		CRYPTOADMIN(3)
1437c478bd9Sstevel@tonic-gate #define	CRYPTO_GET_DEV_INFO		CRYPTOADMIN(4)
1447c478bd9Sstevel@tonic-gate #define	CRYPTO_GET_SOFT_INFO		CRYPTOADMIN(5)
1457c478bd9Sstevel@tonic-gate #define	CRYPTO_LOAD_DEV_DISABLED	CRYPTOADMIN(8)
1467c478bd9Sstevel@tonic-gate #define	CRYPTO_LOAD_SOFT_DISABLED	CRYPTOADMIN(9)
1477c478bd9Sstevel@tonic-gate #define	CRYPTO_UNLOAD_SOFT_MODULE	CRYPTOADMIN(10)
1487c478bd9Sstevel@tonic-gate #define	CRYPTO_LOAD_SOFT_CONFIG		CRYPTOADMIN(11)
1497c478bd9Sstevel@tonic-gate #define	CRYPTO_POOL_CREATE		CRYPTOADMIN(12)
1507c478bd9Sstevel@tonic-gate #define	CRYPTO_POOL_WAIT		CRYPTOADMIN(13)
1517c478bd9Sstevel@tonic-gate #define	CRYPTO_POOL_RUN			CRYPTOADMIN(14)
1527c478bd9Sstevel@tonic-gate #define	CRYPTO_LOAD_DOOR		CRYPTOADMIN(15)
153*b5a2d845SHai-May Chao #define	CRYPTO_FIPS140_STATUS		CRYPTOADMIN(16)
154*b5a2d845SHai-May Chao #define	CRYPTO_FIPS140_SET		CRYPTOADMIN(17)
1557c478bd9Sstevel@tonic-gate 
1567c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1577c478bd9Sstevel@tonic-gate }
1587c478bd9Sstevel@tonic-gate #endif
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #endif	/* _SYS_CRYPTO_IOCTLADMIN_H */
161