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