/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdlib.h>
#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 verification. */
goto clean_exit;
}
/*
* This active flag will remain ON until application calls either
* C_Verify or C_VerifyFinal to verify a signature on data.
*/
if (!key_p->is_lib_obj) {
} else {
goto clean_exit;
}
CKR_OK) {
goto clean_exit;
}
CKR_OK) {
goto clean_exit;
}
CKR_OK) {
goto clean_exit;
}
} else {
goto clean_exit;
}
}
break;
}
if (r < 0) {
} else {
}
} else {
}
}
/* free the memory allocated for verify_init.vi_key */
if (key_p->is_lib_obj) {
} else {
}
}
}
return (rv);
}
{
int r;
if (!kernel_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obatin the session pointer */
return (rv);
/* Application must call C_VerifyInit before calling C_Verify. */
return (CKR_OPERATION_NOT_INITIALIZED);
}
/*
* C_Verify must be called without intervening C_VerifyUpdate
* calls.
*/
/*
* C_Verify can not be used to terminate a multi-part
* operation, so we'll leave the active verify operation
* flag on and let the application continue with the
* verify update operation.
*/
return (CKR_FUNCTION_FAILED);
}
goto clean_exit;
} else {
}
}
break;
}
if (r < 0) {
} else {
}
/*
* Always terminate the active verify operation.
* Application needs to call C_VerifyInit again for next
* verify 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_VerifyInit before calling
* C_VerifyUpdate.
*/
return (CKR_OPERATION_NOT_INITIALIZED);
}
goto done;
}
&verify_update)) < 0) {
break;
}
if (r < 0) {
} else {
}
done:
return (rv);
}
/*
* After an error occurred, terminate the current verify
* 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);
/*
* Application must call C_VerifyInit before calling
* C_VerifyFinal.
*/
return (CKR_OPERATION_NOT_INITIALIZED);
}
/* The order of checks is important here */
OP_FINAL);
} else {
/*
* We should not end up here even if an earlier
* C_VerifyFinal() call took the C_Verify() path as
* it never returns CKR_BUFFER_TOO_SMALL.
*/
}
goto clean_exit;
/*
* We are emulating a single-part operation now.
* So, clear the flag.
*/
goto clean_exit;
}
return (rv);
}
break;
}
if (r < 0) {
} else {
}
/* Always terminate the active verify 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
* verify_recover.
*/
goto clean_exit;
}
/*
* This active flag will remain ON until application calls
* C_VerifyRecover to verify a signature on data.
*/
/* Set up the key data */
if (!key_p->is_lib_obj) {
} else {
CKR_OK) {
goto clean_exit;
}
} else {
goto clean_exit;
}
}
&vr_init)) < 0) {
break;
}
if (r < 0) {
} else {
}
/* free the memory allocated for vr_init.ri_key */
if (key_p->is_lib_obj) {
}
}
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_VerifyRecoverInit before calling
* C_Verify.
*/
return (CKR_OPERATION_NOT_INITIALIZED);
}
&verify_recover)) < 0) {
break;
}
if (r < 0) {
} else {
}
if ((rv == CKR_BUFFER_TOO_SMALL) ||
/*
* We will not terminate the active verify operation flag,
* when the application-supplied buffer is too small, or
* the application asks for the length of buffer to hold
* the recovered data.
*/
return (rv);
}
/*
* Always terminate the active verify operation.
* Application needs to call C_VerifyInit again for next
* verify operation.
*/
return (rv);
}