/*
* 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
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
};
NULL, /* seed_random */
};
ext_info, /* ext_info */
NULL, /* init_token */
NULL, /* init_pin */
NULL, /* set_pin */
};
NULL, /* digest_ops */
NULL, /* cipher_ops */
NULL, /* mac_ops */
NULL, /* sign_ops */
NULL, /* verify_ops */
NULL, /* dual_ops */
NULL, /* cipher_mac_ops */
&n2rng_rng_ops, /* rng_ops */
NULL, /* session_ops */
NULL, /* object_ops */
NULL, /* key_ops */
&n2rng_extinfo_op, /* management_ops */
NULL, /* ctx_ops */
NULL /* mech_ops */
};
NULL, /* pi_provider_description */
NULL, /* pi_provider_dev */
NULL, /* pi_provider_handle */
0, /* number of mechanisms */
NULL, /* mechanism table */
0, /* pi_logical_provider_count */
NULL /* pi_logical_providers */
};
static void
{
if (s2len < n)
}
/*ARGSUSED*/
static int
{
/* handle info common to logical and hardware provider */
/* Manufacturer ID */
/* Model */
/* Token flags */
ext_info->ei_max_pin_len = 0;
ext_info->ei_min_pin_len = 0;
/* Time. No need to be supplied for token without a clock */
/* handle hardware provider specific fields */
/* Token label */
/* Serial number */
"0",
/* Version info */
/* set the token label */
return (CRYPTO_SUCCESS);
}
static void
{
/* Unregister provider without checking result */
(void) n2rng_unregister_provider(n2rng);
}
/*
* Register with KCF if not already registered
*/
int
{
int ret;
if (n2rng_isregistered(n2rng)) {
"registered");
return (DDI_SUCCESS);
} else {
if (ret == CRYPTO_SUCCESS) {
"registered");
} else {
"crypto_register_provider() failed (%d)", ret);
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
/*
* Unregister with KCF if not already registered
*/
int
{
if (!n2rng_isregistered(n2rng)) {
"unregistered");
} else {
"unregistered");
} else {
return (DDI_FAILURE);
}
}
return (DDI_SUCCESS);
}
/*
* Set state to failed for all rngs if in control domain and dispatch a task
* to unregister from kcf
*/
void
{
int rngid;
/* Check if error has already been detected */
if (n2rng_isfailed(n2rng)) {
return;
}
/* Set each rng to failed if running in control domain */
if (n2rng_iscontrol(n2rng)) {
rngid++) {
}
}
/* Dispatch task to unregister from kcf */
}
}
/*
* Set state to unconfigured for all rngs if in control domain and dispatch a
* task to unregister from kcf.
*/
void
{
int rngid;
/* Check if unconfigured state has already been detected */
if (!n2rng_isconfigured(n2rng)) {
return;
}
/* Set each rng to unconfigured if running in control domain */
if (n2rng_iscontrol(n2rng)) {
rngid++) {
}
}
/* Dispatch task to unregister from kcf */
} else {
/* Schedule a configuration retry */
}
}
/*
* Setup and also register to kCF
*/
int
{
int ret;
/* Initialize data structures if not already done */
if (!n2rng_isinitialized(n2rng)) {
/* initialize kstats */
/* initialize the FIPS data and mutexes */
if (ret) {
return (DDI_FAILURE);
}
}
/*
* Register with crypto framework if not already registered.
* Be careful not to exceed 32 characters.
*/
if (ret != DDI_SUCCESS) {
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* Unregister from kCF and cleanup
*/
int
{
/* Un-initialize data structures if they exist */
if (n2rng_isinitialized(n2rng)) {
/*
* Unregister from kCF.
* This needs to be done at the beginning of detach.
*/
return (DDI_FAILURE);
}
/* deinitialize kstats */
}
return (DDI_SUCCESS);
}
/*
* At this time there are no periodic health checks. If the health
* check done at attrach time fails, the driver does not even attach.
* So there are no failure conditions to report, and this provider is
* never busy.
*/
/* ARGSUSED */
static void
{
}
/*ARGSUSED*/
static int
{
int rv;
return (rv);
}
static int
{
int i;
int rv;
for (i = 0; i < N2RNG_FIPS_INSTANCES; i++) {
if (rv) {
/* finalize all the FIPS structures allocated so far */
for (--i; i >= 0; --i) {
}
return (rv);
}
}
return (0);
}
static void
{
int i;
for (i = 0; i < N2RNG_FIPS_INSTANCES; i++) {
}
}