/*
* 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 <security/cryptoki.h>
#include "softGlobal.h"
#include "softSession.h"
#include "softKeys.h"
#include "softOps.h"
{
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer. */
return (rv);
goto clean_exit;
}
goto clean_exit;
}
return (rv);
}
{
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer. */
return (rv);
(phPrivateKey == NULL)) {
goto clean_exit;
}
if ((pPublicKeyTemplate == NULL) ||
(ulPublicKeyAttributeCount == 0)) {
goto clean_exit;
}
if ((pPrivateKeyTemplate == NULL) &&
(ulPrivateKeyAttributeCount != 0)) {
goto clean_exit;
}
return (rv);
}
{
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer. */
return (rv);
if (pMechanism == NULL) {
goto clean_exit;
}
if (pulWrappedKeyLen == NULL) {
goto clean_exit;
}
/* Obtain the wrapping key object pointer. */
goto clean_exit;
}
/* Obtain the to-be-wrapped key object pointer. */
goto clean_exit1;
/* Check if given wrapping key may be used for wrapping. */
goto clean_exit2;
}
/* Check if given wrapping key may be used for encryption. */
goto clean_exit2;
}
/*
* Check to see if key to be wrapped is extractable.
* Note: this should always be true for softtoken keys.
*/
goto clean_exit2;
}
/*
* Wrapping key objects requires calling encrypt operations.
* Check to see if encrypt operation is already active.
*/
/* free the memory to avoid memory leak */
}
/* This active flag will remain ON while wrapping the key. */
return (rv);
}
{
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer. */
return (rv);
if (pMechanism == NULL) {
goto clean_exit;
}
goto clean_exit;
}
goto clean_exit;
}
goto clean_exit;
}
/* Obtain the unwrapping key object pointer. */
goto clean_exit;
}
/* Check if given unwrapping key may be used for unwrapping. */
goto clean_exit1;
}
/* Check if given unwrapping key may be used to decrypt. */
goto clean_exit1;
}
/*
* Unwrapping key objects requires calling decrypt operations.
* Check to see if decrypt operation is already active.
*/
/* free the memory to avoid memory leak */
}
/*
* This active flag will remain ON until application
* is done unwrapping the key.
*/
phKey);
return (rv);
}
{
if (!softtoken_initialized)
return (CKR_CRYPTOKI_NOT_INITIALIZED);
/* Obtain the session pointer. */
return (rv);
if (pMechanism == NULL) {
goto clean_exit;
}
goto clean_exit;
}
/* Obtain the private key object pointer. */
goto clean_exit;
/* Check to see if key object allows for derivation. */
goto clean_exit1;
}
return (rv);
}