dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / pkcs11 / pkcs11_kernel / common / kernelEmulate.h
blob653fd6e965d292c250ae02c07578c70f5c720632
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _KERNEL_EMULATE_H
28 #define _KERNEL_EMULATE_H
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include <strings.h>
35 #include <sys/crypto/ioctl.h>
36 #include <security/cryptoki.h>
37 #include "kernelGlobal.h"
38 #include "kernelSession.h"
39 #include "kernelSoftCommon.h"
41 #define SLOT_THRESHOLD(sp) (slot_table[sp->ses_slotid]->sl_threshold)
42 #define SLOT_HASH_MAX_INDATA_LEN(sp) \
43 (slot_table[sp->ses_slotid]->sl_hash_max_inlen)
44 #define SLOT_HMAC_MAX_INDATA_LEN(sp) \
45 (slot_table[sp->ses_slotid]->sl_hmac_max_inlen)
46 #define SLOT_HAS_LIMITED_HASH(sp) (slot_table[sp->ses_slotid]->sl_flags & \
47 CRYPTO_LIMITED_HASH_SUPPORT)
48 #define SLOT_HAS_LIMITED_HMAC(sp) (slot_table[sp->ses_slotid]->sl_flags & \
49 CRYPTO_LIMITED_HMAC_SUPPORT)
50 #define get_sp(opp) (((digest_buf_t *)((opp)->context))->soft_sp)
51 #define get_spp(opp) (&(((digest_buf_t *)((opp)->context))->soft_sp))
53 /* reinit buffer so that we can reuse it */
54 #define REINIT_OPBUF(opp) { \
55 if ((opp)->flags & CRYPTO_EMULATE) { \
56 digest_buf_t *bufp = (opp)->context; \
57 if (bufp != NULL) { \
58 bzero(bufp->buf, bufp->indata_len); \
59 bufp->indata_len = 0; \
60 } \
61 } \
64 boolean_t is_hmac(CK_MECHANISM_TYPE mechanism);
65 CK_RV emulate_buf_init(kernel_session_t *session_p, int buflen, int opflag);
66 CK_RV emulate_init(kernel_session_t *session_p, CK_MECHANISM_PTR pMechanism,
67 crypto_key_t *keyp, int opflag);
68 CK_RV emulate_update(kernel_session_t *session_p, CK_BYTE_PTR pPart,
69 CK_ULONG ulPartLen, int opflag);
71 #ifdef __cplusplus
73 #endif
75 #endif /* _KERNEL_EMULATE_H */