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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SOFTGLOBAL_H
27 #define	_SOFTGLOBAL_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #include <security/cryptoki.h>
34 #include <security/pkcs11t.h>
35 
36 /*
37  * The following global variables are defined in softGeneral.c
38  */
39 extern boolean_t softtoken_initialized;
40 extern pthread_mutex_t soft_giant_mutex;
41 extern struct slot soft_slot;
42 extern struct obj_to_be_freed_list obj_delay_freed;
43 extern struct ses_to_be_freed_list ses_delay_freed;
44 
45 #define	SOFTTOKEN_SLOTID	1
46 
47 /* CK_INFO: Information about cryptoki */
48 #define	CRYPTOKI_VERSION_MAJOR	2
49 #define	CRYPTOKI_VERSION_MINOR	40
50 #define	LIBRARY_DESCRIPTION	"Sun Crypto Softtoken            "
51 #define	LIBRARY_VERSION_MAJOR	1
52 #define	LIBRARY_VERSION_MINOR	1
53 
54 
55 /* CK_SLOT_INFO: Information about our slot */
56 #define	HARDWARE_VERSION_MAJOR	0
57 #define	HARDWARE_VERSION_MINOR	0
58 #define	FIRMWARE_VERSION_MAJOR	0
59 #define	FIRMWARE_VERSION_MINOR	0
60 
61 /* CK_TOKEN_INFO: More information about token */
62 #define	TOKEN_MODEL		"1.0             "
63 #define	MAX_PIN_LEN		256
64 #define	MIN_PIN_LEN		1
65 
66 #define	SOFT_TOKEN_FLAGS	CKF_RNG|\
67 				CKF_USER_PIN_INITIALIZED|\
68 				CKF_LOGIN_REQUIRED|\
69 				CKF_RESTORE_KEY_NOT_NEEDED|\
70 				CKF_DUAL_CRYPTO_OPERATIONS|\
71 				CKF_TOKEN_INITIALIZED
72 
73 #ifdef	__cplusplus
74 }
75 #endif
76 
77 #endif /* _SOFTGLOBAL_H */
78