xref: /titanic_50/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSoftCommon.h (revision ba5f469c0173c4d47f377c20b530f5be165d49dc)
1*ba5f469cSkrishna /*
2*ba5f469cSkrishna  * CDDL HEADER START
3*ba5f469cSkrishna  *
4*ba5f469cSkrishna  * The contents of this file are subject to the terms of the
5*ba5f469cSkrishna  * Common Development and Distribution License (the "License").
6*ba5f469cSkrishna  * You may not use this file except in compliance with the License.
7*ba5f469cSkrishna  *
8*ba5f469cSkrishna  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ba5f469cSkrishna  * or http://www.opensolaris.org/os/licensing.
10*ba5f469cSkrishna  * See the License for the specific language governing permissions
11*ba5f469cSkrishna  * and limitations under the License.
12*ba5f469cSkrishna  *
13*ba5f469cSkrishna  * When distributing Covered Code, include this CDDL HEADER in each
14*ba5f469cSkrishna  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ba5f469cSkrishna  * If applicable, add the following below this CDDL HEADER, with the
16*ba5f469cSkrishna  * fields enclosed by brackets "[]" replaced with your own identifying
17*ba5f469cSkrishna  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ba5f469cSkrishna  *
19*ba5f469cSkrishna  * CDDL HEADER END
20*ba5f469cSkrishna  */
21*ba5f469cSkrishna 
22*ba5f469cSkrishna /*
23*ba5f469cSkrishna  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*ba5f469cSkrishna  * Use is subject to license terms.
25*ba5f469cSkrishna  */
26*ba5f469cSkrishna 
27*ba5f469cSkrishna #ifndef	_KERNEL_SOFT_COMMON_H
28*ba5f469cSkrishna #define	_KERNEL_SOFT_COMMON_H
29*ba5f469cSkrishna 
30*ba5f469cSkrishna #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*ba5f469cSkrishna 
32*ba5f469cSkrishna #ifdef __cplusplus
33*ba5f469cSkrishna extern "C" {
34*ba5f469cSkrishna #endif
35*ba5f469cSkrishna 
36*ba5f469cSkrishna #include <sys/crypto/ioctl.h>
37*ba5f469cSkrishna #include <security/cryptoki.h>
38*ba5f469cSkrishna 
39*ba5f469cSkrishna #define	OP_INIT		0x01
40*ba5f469cSkrishna #define	OP_UPDATE	0x02
41*ba5f469cSkrishna #define	OP_FINAL 	0x04
42*ba5f469cSkrishna #define	OP_SINGLE 	0x08
43*ba5f469cSkrishna #define	OP_DIGEST	0x10
44*ba5f469cSkrishna #define	OP_SIGN		0x20
45*ba5f469cSkrishna #define	OP_VERIFY	0x40
46*ba5f469cSkrishna 
47*ba5f469cSkrishna void free_soft_ctx(void *s, int opflag);
48*ba5f469cSkrishna CK_RV do_soft_digest(void **s, CK_MECHANISM_PTR pMechanism, CK_BYTE_PTR pBuf,
49*ba5f469cSkrishna     CK_ULONG ulBufLen, CK_BYTE_PTR pDigest,
50*ba5f469cSkrishna     CK_ULONG_PTR pulDigestLen, int opflag);
51*ba5f469cSkrishna 
52*ba5f469cSkrishna CK_RV do_soft_hmac_init(void **s, CK_MECHANISM_PTR pMechanism, CK_BYTE_PTR kval,
53*ba5f469cSkrishna     CK_ULONG klen, int opflag);
54*ba5f469cSkrishna CK_RV do_soft_hmac_update(void **s, CK_BYTE_PTR pBuf,
55*ba5f469cSkrishna     CK_ULONG ulBufLen, int opflag);
56*ba5f469cSkrishna CK_RV do_soft_hmac_sign(void **s, CK_BYTE_PTR pBuf, CK_ULONG ulBufLen,
57*ba5f469cSkrishna     CK_BYTE_PTR pSignature, CK_ULONG_PTR pulSignatureLen, int opflag);
58*ba5f469cSkrishna CK_RV do_soft_hmac_verify(void **s, CK_BYTE_PTR pBuf, CK_ULONG ulBufLen,
59*ba5f469cSkrishna     CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen, int opflag);
60*ba5f469cSkrishna 
61*ba5f469cSkrishna #ifdef __cplusplus
62*ba5f469cSkrishna }
63*ba5f469cSkrishna #endif
64*ba5f469cSkrishna 
65*ba5f469cSkrishna #endif /* _KERNEL_SOFT_COMMON_H */
66