/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <errno.h>
#include <security/cryptoki.h>
#include <strings.h>
#include "kernelGlobal.h"
#include "kernelSlot.h"
static CK_RV
{
int r;
return (CKR_HOST_MEMORY);
break;
}
if (r < 0) {
} else {
} else {
}
}
}
return (rv);
}
/*
* This function will be used by metaslot to get the kernel
* provider's threshold value for the supported mechanisms.
*/
void
{
int i;
/*
* We alway use the 1st slot in the kernel to
* get the threshold because all the kernel
* slots will have the same threshold value
* with the same mechanism.
*/
pslot = slot_table[0];
for (i = 0; i < pslot->total_threshold_count; i++) {
tp[i].mech_threshold =
}
}
/*
* To retrieve the crypto_function_list structure with boolean entries
* indicating which functions are supported by the hardware provider which
* is specified by the slot ID.
*/
static CK_RV
{
int r;
int i;
break;
}
if (r < 0) {
} else {
if (fl.fl_return_value == 0) {
} else {
}
}
return (rv);
}
/* copy data structure received from kernel */
}
}
}
for (i = 0; i < pslot->total_threshold_count; i++) {
}
return (CKR_OK);
}
/*
* Initialize the slot table.
*
* This function is called from C_Initialize() only. Since C_Initialize()
* holds the global mutex lock, there is no need to acquire another lock
* in this routine to protect the slot table.
*/
{
int i, cur_slot_num = 0;
int r;
/*
* Find out how many slots are presented from kernel hardware
* providers. If there is no slot presented, just return.
*/
rv = kernel_get_slot_number();
return (rv);
}
/* Allocate space for the slot table */
if (slot_table == NULL) {
return (CKR_HOST_MEMORY);
}
/* For each slot, allocate space and initialize the slot's mutex. */
for (i = 0; i < slot_count; i++) {
if (slot_table[i] == NULL) {
goto failed;
}
/* Initialize this slot's mutex */
(void) free(slot_table[i]);
goto failed;
}
cur_slot_num = i;
}
/*
* Get the provider ID for each slot from kernel and save it in the
* slot table.
*/
goto failed;
}
break;
}
if (r < 0) {
goto failed;
} else {
goto failed;
} else {
}
}
for (i = 0; i < slot_count; i++) {
}
/*
* Get the function list for each slot from kernel and save it in
* the slot table.
*/
for (i = 0; i < slot_count; i++) {
goto failed;
}
}
return (CKR_OK);
for (i = 0; i < cur_slot_num; i++) {
(void) free(slot_table[i]);
}
(void) free(slot_table);
return (rv);
}