xref: /illumos-gate/usr/src/lib/pkcs11/pkcs11_softtoken/common/softGlobal.h (revision 355b4669e025ff377602b6fc7caaf30dbc218371)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SOFTGLOBAL_H
28 #define	_SOFTGLOBAL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <security/cryptoki.h>
37 #include <security/pkcs11t.h>
38 
39 /*
40  * The following global variables are defined in softGeneral.c
41  */
42 extern boolean_t softtoken_initialized;
43 extern pthread_mutex_t soft_giant_mutex;
44 extern struct slot soft_slot;
45 extern struct obj_to_be_freed_list obj_delay_freed;
46 extern struct ses_to_be_freed_list ses_delay_freed;
47 
48 #define	SOFTTOKEN_SLOTID	1
49 
50 /* CK_INFO: Information about cryptoki */
51 #define	CRYPTOKI_VERSION_MAJOR	2
52 #define	CRYPTOKI_VERSION_MINOR	20
53 #define	LIBRARY_DESCRIPTION	"Sun Crypto Softtoken            "
54 #define	LIBRARY_VERSION_MAJOR	1
55 #define	LIBRARY_VERSION_MINOR	1
56 
57 
58 /* CK_SLOT_INFO: Information about our slot */
59 #define	HARDWARE_VERSION_MAJOR	0
60 #define	HARDWARE_VERSION_MINOR	0
61 #define	FIRMWARE_VERSION_MAJOR	0
62 #define	FIRMWARE_VERSION_MINOR	0
63 
64 /* CK_TOKEN_INFO: More information about token */
65 #define	TOKEN_MODEL		"1.0             "
66 #define	MAX_PIN_LEN		256
67 #define	MIN_PIN_LEN		1
68 
69 #define	SOFT_TOKEN_FLAGS	CKF_RNG|\
70 				CKF_USER_PIN_INITIALIZED|\
71 				CKF_LOGIN_REQUIRED|\
72 				CKF_RESTORE_KEY_NOT_NEEDED|\
73 				CKF_DUAL_CRYPTO_OPERATIONS|\
74 				CKF_TOKEN_INITIALIZED
75 
76 extern int looping_read(int, void *, int);
77 extern int looping_write(int, void *, int);
78 
79 #ifdef	__cplusplus
80 }
81 #endif
82 
83 #endif /* _SOFTGLOBAL_H */
84