xref: /titanic_52/usr/src/lib/pkcs11/include/cryptoki.h (revision c2580b931007758eab8cb5ae8726ebe1588e259b)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2003 Sun Microsystems, Inc.   All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_CRYPTOKI_H
28 #define	_CRYPTOKI_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #ifndef	CK_PTR
37 #define	CK_PTR *
38 #endif
39 
40 #ifndef CK_DEFINE_FUNCTION
41 #define	CK_DEFINE_FUNCTION(returnType, name) returnType name
42 #endif
43 
44 #ifndef CK_DECLARE_FUNCTION
45 #define	CK_DECLARE_FUNCTION(returnType, name) returnType name
46 #endif
47 
48 #ifndef CK_DECLARE_FUNCTION_POINTER
49 #define	CK_DECLARE_FUNCTION_POINTER(returnType, name) returnType (* name)
50 #endif
51 
52 #ifndef CK_CALLBACK_FUNCTION
53 #define	CK_CALLBACK_FUNCTION(returnType, name) returnType (* name)
54 #endif
55 
56 #ifndef NULL_PTR
57 #include <unistd.h>	/* For NULL */
58 #define	NULL_PTR NULL
59 #endif
60 
61 /*
62  * pkcs11t.h defines TRUE and FALSE in a way that upsets lint
63  */
64 #ifndef	CK_DISABLE_TRUE_FALSE
65 #define	CK_DISABLE_TRUE_FALSE
66 #ifndef	TRUE
67 #define	TRUE	1
68 #endif /* TRUE */
69 #ifndef	FALSE
70 #define	FALSE	0
71 #endif /* FALSE */
72 #endif /* CK_DISABLE_TRUE_FALSE */
73 
74 #undef CK_PKCS11_FUNCTION_INFO
75 
76 #include <security/pkcs11.h>
77 
78 /* Solaris specific functions */
79 
80 #include <stdlib.h>
81 
82 /*
83  * SUNW_C_GetMechSession will initialize the framework and do all
84  * the necessary PKCS#11 calls to create a session capable of
85  * providing operations on the requested mechanism
86  */
87 CK_RV SUNW_C_GetMechSession(CK_MECHANISM_TYPE mech,
88     CK_SESSION_HANDLE_PTR hSession);
89 
90 /*
91  * SUNW_C_KeyToObject will create a secret key object for the given
92  * mechanism from the rawkey data.
93  */
94 CK_RV SUNW_C_KeyToObject(CK_SESSION_HANDLE hSession,
95     CK_MECHANISM_TYPE mech, const void *rawkey, size_t rawkey_len,
96     CK_OBJECT_HANDLE_PTR obj);
97 
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif	/* _CRYPTOKI_H */
104