adm_kef_ioctl.c revision 1b22764f59e3a183ca5db98b6bfd27fdf2b20e02
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License (the "License").
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Use is subject to license terms.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindistatic crypto_get_soft_info_t *setup_get_soft_info(char *, int);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Prepare the argument for the LOAD_SOFT_CONFIG ioctl call for the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * provider pointed by pent. Return NULL if out of memory.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi pload_soft_conf = malloc(sizeof (crypto_load_soft_config_t) +
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi (void) strlcpy(pload_soft_conf->sc_name, pent->name, MAXNAMELEN);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi while (i < sup_count) {
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Prepare the argument for the LOAD_SOFT_DISABLED ioctl call for the
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * provider pointed by pent. Return NULL if out of memory.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi pload_soft_dis = malloc(sizeof (crypto_load_soft_disabled_t) +
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi (void) strlcpy(pload_soft_dis->sd_name, pent->name, MAXNAMELEN);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (i < dis_count) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Prepare the argument for the LOAD_DEV_DISABLED ioctl call for the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * provider pointed by pent. Return NULL if out of memory.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* get the device name and the instance number */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi if (split_hw_provname(pent->name, pname, &inst_num) == FAILURE) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi /* allocate space for pload_dev_des */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi pload_dev_dis = malloc(sizeof (crypto_load_dev_disabled_t) +
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi /* set the values for pload_dev_dis */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (void) strlcpy(pload_dev_dis->dd_dev_name, pname, MAXNAMELEN);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi while (i < dis_count) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Prepare the calling argument of the UNLOAD_SOFT_MODULE ioctl call for the
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * provider pointed by pent. Return NULL if out of memory.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi punload_soft = malloc(sizeof (crypto_unload_soft_module_t));
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi (void) strlcpy(punload_soft->sm_name, pent->name, MAXNAMELEN);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Prepare the calling argument for the GET_SOFT_INFO call for the provider
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * with the number of mechanisms specified in the second argument.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Called by get_soft_info().
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi extra_mech_size = sizeof (crypto_mech_name_t) * (count - 1);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi psoft_info = malloc(sizeof (crypto_get_soft_info_t) + extra_mech_size);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi (void) strlcpy(psoft_info->si_name, provname, MAXNAMELEN);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Get the device list from kernel.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi if ((fd = open(ADMIN_IOCTL_DEVICE, O_RDONLY)) == -1) {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi cryptoerror(LOG_STDERR, gettext("failed to open %s: %s"),
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (SUCCESS);
int rc;
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (rc);
int count;
int rc;
return (FAILURE);
/* use kcf.conf for kernel software providers in global zone */
NULL) {
/* No kcf.conf entry for this provider */
== FAILURE) {
return (FAILURE);
return (FAILURE);
* kcf.conf not there in non-global zone: set mech count to 1.
return (FAILURE);
return (FAILURE);
return (FAILURE);
== NULL) {
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (rc);
int len;
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (FAILURE);
return (SUCCESS);