/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/sysmacros.h>
/*
* Utility routine to apply the command, 'cmd', to the
* data in the uio structure.
*/
int
void *digest_ctx, void (*update)())
{
return (CRYPTO_ARGUMENTS_BAD);
}
/*
* Jump to the first iovec containing data to be
* processed.
*/
;
/*
* The caller specified an offset that is larger than
* the total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
offset);
switch (cmd) {
case COPY_FROM_DATA:
break;
case COPY_TO_DATA:
break;
case COMPARE_TO_DATA:
return (CRYPTO_SIGNATURE_INVALID);
break;
case MD5_DIGEST_DATA:
case SHA1_DIGEST_DATA:
case SHA2_DIGEST_DATA:
case GHASH_DATA:
break;
}
vec_idx++;
offset = 0;
}
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed.
*/
switch (cmd) {
case COPY_TO_DATA:
return (CRYPTO_BUFFER_TOO_SMALL);
default:
return (CRYPTO_DATA_LEN_RANGE);
}
}
return (CRYPTO_SUCCESS);
}
/*
* Utility routine to apply the command, 'cmd', to the
* data in the mblk structure.
*/
int
void *digest_ctx, void (*update)())
{
/*
* Jump to the first mblk_t containing data to be processed.
*/
;
/*
* The caller specified an offset that is larger
* than the total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
/*
* Now do the processing on the mblk chain.
*/
switch (cmd) {
case COPY_FROM_DATA:
break;
case COPY_TO_DATA:
break;
case COMPARE_TO_DATA:
return (CRYPTO_SIGNATURE_INVALID);
break;
case MD5_DIGEST_DATA:
case SHA1_DIGEST_DATA:
case SHA2_DIGEST_DATA:
case GHASH_DATA:
break;
}
offset = 0;
}
/*
* The end of the mblk was reached but the length
* requested could not be processed.
*/
switch (cmd) {
case COPY_TO_DATA:
return (CRYPTO_BUFFER_TOO_SMALL);
default:
return (CRYPTO_DATA_LEN_RANGE);
}
}
return (CRYPTO_SUCCESS);
}
/*
* Utility routine to copy a buffer to a crypto_data structure.
*/
int
{
case CRYPTO_DATA_RAW:
return (CRYPTO_BUFFER_TOO_SMALL);
}
break;
case CRYPTO_DATA_UIO:
case CRYPTO_DATA_MBLK:
default:
return (CRYPTO_ARGUMENTS_BAD);
}
return (CRYPTO_SUCCESS);
}
/*
* Utility routine to get data from a crypto_data structure.
*
* '*dptr' contains a pointer to a buffer on return. 'buf'
* is allocated by the caller and is ignored for CRYPTO_DATA_RAW case.
*/
int
{
int rv;
case CRYPTO_DATA_RAW:
return (CRYPTO_ARGUMENTS_BAD);
break;
case CRYPTO_DATA_UIO:
return (rv);
break;
case CRYPTO_DATA_MBLK:
return (rv);
break;
default:
return (CRYPTO_ARGUMENTS_BAD);
}
return (CRYPTO_SUCCESS);
}
int
{
int i, count;
/* figure out how much memory to allocate for everything */
len = sizeof (crypto_key_t) +
count * sizeof (crypto_object_attribute_t);
for (i = 0; i < count; i++) {
sizeof (caddr_t));
}
/* one big allocation for everything */
return (CRYPTO_HOST_MEMORY);
sizeof (crypto_key_t));
count * sizeof (crypto_object_attribute_t);
for (i = 0; i < count; i++) {
}
return (CRYPTO_SUCCESS);
}
int
{
flag & CRYPTO_DO_SHA2);
goto dofinal;
}
if (flag & CRYPTO_DO_UPDATE) {
case CRYPTO_DATA_RAW:
break;
case CRYPTO_DATA_UIO:
if (flag & CRYPTO_DO_MD5)
else if (flag & CRYPTO_DO_SHA1)
else
if (rv != CRYPTO_SUCCESS)
return (rv);
break;
case CRYPTO_DATA_MBLK:
if (flag & CRYPTO_DO_MD5)
else if (flag & CRYPTO_DO_SHA1)
else
if (rv != CRYPTO_SUCCESS)
return (rv);
break;
}
}
if (flag & CRYPTO_DO_FINAL) {
}
return (CRYPTO_SUCCESS);
}
int
{
int rv;
&common_ctx->cc_iv[0]);
}
return (CRYPTO_ARGUMENTS_BAD);
return (rv);
}
int
{
&common_ctx->cc_iv[0]);
}
return (CRYPTO_ARGUMENTS_BAD);
}
/*
* Jump to the first iovec containing data to be
* processed.
*/
;
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
/*
* Now process the iovecs.
*/
vec_idx++;
offset = 0;
}
/*
* The end of the specified iovec's was reached but
* the length requested could not be processed, i.e.
* The caller requested to digest more data than it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
return (CRYPTO_SUCCESS);
}
int
{
&common_ctx->cc_iv[0]);
}
/*
* Jump to the first mblk_t containing data to be processed.
*/
;
/*
* The caller specified an offset that is larger than the
* total size of the buffers it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
/*
* Now do the processing on the mblk chain.
*/
offset = 0;
}
/*
* The end of the mblk was reached but the length requested
* could not be processed, i.e. The caller requested
* to digest more data than it provided.
*/
return (CRYPTO_DATA_LEN_RANGE);
}
return (CRYPTO_SUCCESS);
}
/*
* Utility routine to look up a attribute of type, 'type',
* in the key.
*/
int
{
int i;
return (CRYPTO_SUCCESS);
}
}
return (CRYPTO_FAILED);
}