softGeneral.c revision f66d273d14eede3a1bb803a39414588d8f143a98
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * CDDL HEADER START
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * The contents of this file are subject to the terms of the
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * Common Development and Distribution License, Version 1.0 only
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * (the "License"). You may not use this file except in compliance
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * with the License.
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * See the License for the specific language governing permissions
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * and limitations under the License.
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * When distributing Covered Code, include this CDDL HEADER in each
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * If applicable, add the following below this CDDL HEADER, with the
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * fields enclosed by brackets "[]" replaced with your own identifying
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * information: Portions Copyright [yyyy] [name of copyright owner]
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * CDDL HEADER END
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent * Use is subject to license terms.
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincent#pragma ident "%Z%%M% %I% %E% SMI"
ac0d91b16ffcc7d2e0adc288dfc92e58728a27ebjason vincentstatic struct CK_FUNCTION_LIST functionList = {
int all_sessions_closing = 0;
/* protects softtoken_initialized and access to C_Initialize/C_Finalize */
static void softtoken_fini();
int initialize_pid;
if (softtoken_initialized) {
return (CKR_CRYPTOKI_ALREADY_INITIALIZED);
return (CKR_ARGUMENTS_BAD);
if (!supplied_ok) {
return (CKR_ARGUMENTS_BAD);
return (CKR_CANT_LOCK);
return (CKR_CANT_LOCK);
return (rv);
(void) soft_destroy_token_session();
return (CKR_CANT_LOCK);
if (soft_token_present) {
(void) soft_destroy_token_session();
return (rv);
return (CKR_OK);
return (rv);
static CK_RV
if (!softtoken_initialized) {
return (CKR_CRYPTOKI_NOT_INITIALIZED);
return (CKR_ARGUMENTS_BAD);
all_sessions_closing = 0;
softtoken_pid = 0;
if (soft_urandom_fd > 0) {
if (soft_random_fd > 0) {
(void) soft_destroy_token_session();
return (rv);
if (!softtoken_initialized) {
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
return (CKR_ARGUMENTS_BAD);
return (CKR_OK);
return (CKR_ARGUMENTS_BAD);
return (CKR_OK);
return (CKR_FUNCTION_NOT_PARALLEL);
return (CKR_FUNCTION_NOT_PARALLEL);
char *p = buf;
if (len == 0)
if (cc < 0) {
return (cc);
} else if (cc == 0) {
return (len2);
p += cc;
} while (len > 0);
return (len2);
char *p = buf;
if (cc < 0) {
} else if (cc == 0) {
return (len2);
p += cc;
} while (len > 0);
return (len2);