kcf_verify.c revision 2f2f8eeb149e8cf47dfa3d6c71cde31ad671e029
/*
* 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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/sysmacros.h>
/*
* Verify entry points.
*/
/*
* See comments for crypto_digest_init_prov().
*/
int
{
int rv;
if (rv != CRYPTO_SUCCESS)
return (rv);
}
/* Allocate and initialize the canonical context */
return (CRYPTO_HOST_MEMORY);
}
else {
/* Release the hold done in kcf_new_ctx(). */
}
return (rv);
}
int
{
int error;
/* The pd is returned held */
return (error);
}
/*
* For SW providers, check the validity of the context template
* It is very rare that the generation number mis-matches, so
* it is acceptable to fail here, and let the consumer recover by
* freeing this tmpl and create a new one for the key and new SW
* provider.
*/
return (CRYPTO_OLD_CTX_TEMPLATE);
} else {
}
}
IS_RECOVERABLE(error)) {
/* Add pd to the linked list of providers tried. */
goto retry;
}
return (error);
}
int
{
int error;
return (CRYPTO_INVALID_CONTEXT);
}
/* Release the hold done in kcf_new_ctx() during init step. */
return (error);
}
/*
* See comments for crypto_digest_update().
*/
int
{
int rv;
return (CRYPTO_INVALID_CONTEXT);
}
return (rv);
}
/*
* See comments for crypto_digest_final().
*/
int
{
int rv;
return (CRYPTO_INVALID_CONTEXT);
}
/* Release the hold done in kcf_new_ctx() during init step. */
return (rv);
}
int
{
int rv;
if (rv != CRYPTO_SUCCESS)
return (rv);
}
return (rv);
}
static int
{
int error;
/* The pd is returned held */
return (error);
}
/*
* For SW providers, check the validity of the context template
* It is very rare that the generation number mis-matches, so
* it is acceptable to fail here, and let the consumer recover by
* freeing this tmpl and create a new one for the key and new SW
* provider.
*/
return (CRYPTO_OLD_CTX_TEMPLATE);
} else {
}
}
/* The fast path for SW providers. */
if (fg == CRYPTO_FG_VERIFY_ATOMIC)
else
/* Note: The argument order is different from above */
} else {
/* no crypto context to carry between multiple parts. */
}
IS_RECOVERABLE(error)) {
/* Add pd to the linked list of providers tried. */
goto retry;
}
return (error);
}
int
{
}
int
{
int rv;
if (rv != CRYPTO_SUCCESS)
return (rv);
}
return (rv);
}
int
{
}
int
{
int rv;
if (rv != CRYPTO_SUCCESS)
return (rv);
}
/* Allocate and initialize the canonical context */
return (CRYPTO_HOST_MEMORY);
}
else {
/* Release the hold done in kcf_new_ctx(). */
}
return (rv);
}
int
{
int error;
return (CRYPTO_INVALID_CONTEXT);
}
/* Release the hold done in kcf_new_ctx() during init step. */
return (error);
}