/*
* 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 "kernelGlobal.h"
#include "kernelObject.h"
#include "kernelSession.h"
#include "kernelEmulate.h"
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
if (pMechanism == NULL) {
return (CKR_ARGUMENTS_BAD);
}
/* Get the kernel's internal mechanism number. */
return (rv);
}
/* Obtain the session pointer. */
return (rv);
/* Obtain the object pointer. */
return (rv);
}
/* Check to see if key object supports signature. */
goto clean_exit;
}
/*
* This active flag will remain ON until application calls either
* C_Sign or C_SignFinal to actually obtain the signature.
*/
if (!key_p->is_lib_obj) {
} else {
goto clean_exit;
}
goto clean_exit;
}
goto clean_exit;
}
goto clean_exit;
}
} else {
goto clean_exit;
}
}
break;
}
if (r < 0) {
} else {
}
} else {
}
}
if (key_p->is_lib_obj) {
} else {
}
}
}
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer */
return (rv);
if (pulSignatureLen == NULL) {
goto clean_exit;
}
/* Application must call C_SignInit before calling C_Sign. */
return (CKR_OPERATION_NOT_INITIALIZED);
}
/*
* C_Sign must be called without intervening C_SignUpdate
* calls.
*/
/*
* C_Sign can not be used to terminate a multi-part
* operation, so we'll leave the active sign operation
* flag on and let the application continue with the
* sign update operation.
*/
return (CKR_FUNCTION_FAILED);
}
goto done;
} else {
}
}
break;
}
if (r < 0) {
} else {
}
done:
if ((rv == CKR_BUFFER_TOO_SMALL) ||
/*
* We will not terminate the active sign operation flag,
* when the application-supplied buffer is too small, or
* the application asks for the length of buffer to hold
* the signature.
*/
return (rv);
}
/*
* Terminates the active sign operation.
* Application needs to call C_SignInit again for next
* sign operation.
*/
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer */
return (rv);
goto clean_exit;
}
/*
* Application must call C_SignInit before calling
* C_SignUpdate.
*/
return (CKR_OPERATION_NOT_INITIALIZED);
}
goto done;
}
break;
}
if (r < 0) {
} else {
}
done:
return (rv);
}
/*
* After an error occurred, terminate the current sign
* operation by resetting the active and update flags.
*/
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer */
return (rv);
if (pulSignatureLen == NULL) {
goto clean_exit;
}
/*
* Application must call C_SignInit before calling
* C_SignFinal.
*/
return (CKR_OPERATION_NOT_INITIALIZED);
}
/* The order of checks is important here */
} else {
/*
* We end up here if an earlier C_SignFinal() call
* took the C_Sign() path and it had returned
* CKR_BUFFER_TOO_SMALL.
*/
goto clean_exit;
}
}
goto done;
/*
* We are emulating a single-part operation now.
* So, clear the flag.
*/
goto clean_exit;
}
return (rv);
}
break;
}
if (r < 0) {
} else {
}
done:
if ((rv == CKR_BUFFER_TOO_SMALL) ||
/*
* We will not terminate the active sign operation flag,
* when the application-supplied buffer is too small, or
* the application asks for the length of buffer to hold
* the signature.
*/
return (rv);
}
/* Terminates the active sign operation */
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
if (pMechanism == NULL) {
return (CKR_ARGUMENTS_BAD);
}
/* Get the kernel's internal mechanism number. */
return (rv);
/* Obtain the session pointer. */
return (rv);
/* Obtain the object pointer. */
return (rv);
}
/*
* Check to see if key object is a RSA key and if it supports
* sign_recover.
*/
goto clean_exit;
}
/*
* This active flag will remain ON until application calls
* C_SignRecover to actually obtain the signature.
*/
/* Set up the key data */
if (!key_p->is_lib_obj) {
} else {
CKR_OK) {
goto clean_exit;
}
} else {
goto clean_exit;
}
}
break;
}
if (r < 0) {
} else {
}
if (key_p->is_lib_obj) {
}
}
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer */
return (rv);
if (pulSignatureLen == NULL) {
goto clean_exit;
}
/* Application must call C_SignInit before calling C_Sign. */
return (CKR_OPERATION_NOT_INITIALIZED);
}
break;
}
if (r < 0) {
} else {
}
if ((rv == CKR_BUFFER_TOO_SMALL) ||
/*
* We will not terminate the active sign operation flag,
* when the application-supplied buffer is too small, or
* the application asks for the length of buffer to hold
* the signature.
*/
return (rv);
}
/*
* Terminates the active sign operation.
* Application needs to call C_SignInit again for next
* sign operation.
*/
return (rv);
}