xref: /onnv-gate/usr/src/lib/pkcs11/pkcs11_kms/common/kmsGlobal.h (revision 12720:3db6e0082404)
1*12720SWyllys.Ingersoll@Sun.COM /*
2*12720SWyllys.Ingersoll@Sun.COM  * CDDL HEADER START
3*12720SWyllys.Ingersoll@Sun.COM  *
4*12720SWyllys.Ingersoll@Sun.COM  * The contents of this file are subject to the terms of the
5*12720SWyllys.Ingersoll@Sun.COM  * Common Development and Distribution License (the "License").
6*12720SWyllys.Ingersoll@Sun.COM  * You may not use this file except in compliance with the License.
7*12720SWyllys.Ingersoll@Sun.COM  *
8*12720SWyllys.Ingersoll@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*12720SWyllys.Ingersoll@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*12720SWyllys.Ingersoll@Sun.COM  * See the License for the specific language governing permissions
11*12720SWyllys.Ingersoll@Sun.COM  * and limitations under the License.
12*12720SWyllys.Ingersoll@Sun.COM  *
13*12720SWyllys.Ingersoll@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*12720SWyllys.Ingersoll@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*12720SWyllys.Ingersoll@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*12720SWyllys.Ingersoll@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*12720SWyllys.Ingersoll@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*12720SWyllys.Ingersoll@Sun.COM  *
19*12720SWyllys.Ingersoll@Sun.COM  * CDDL HEADER END
20*12720SWyllys.Ingersoll@Sun.COM  */
21*12720SWyllys.Ingersoll@Sun.COM /*
22*12720SWyllys.Ingersoll@Sun.COM  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23*12720SWyllys.Ingersoll@Sun.COM  */
24*12720SWyllys.Ingersoll@Sun.COM 
25*12720SWyllys.Ingersoll@Sun.COM #ifndef _KMSGLOBAL_H
26*12720SWyllys.Ingersoll@Sun.COM #define	_KMSGLOBAL_H
27*12720SWyllys.Ingersoll@Sun.COM 
28*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus
29*12720SWyllys.Ingersoll@Sun.COM extern "C" {
30*12720SWyllys.Ingersoll@Sun.COM #endif
31*12720SWyllys.Ingersoll@Sun.COM 
32*12720SWyllys.Ingersoll@Sun.COM #include <sys/crypto/common.h>
33*12720SWyllys.Ingersoll@Sun.COM #include <security/cryptoki.h>
34*12720SWyllys.Ingersoll@Sun.COM #include <security/pkcs11t.h>
35*12720SWyllys.Ingersoll@Sun.COM #include "kmsObject.h"
36*12720SWyllys.Ingersoll@Sun.COM 
37*12720SWyllys.Ingersoll@Sun.COM typedef struct kms_elem {
38*12720SWyllys.Ingersoll@Sun.COM 	CK_MECHANISM_TYPE type;
39*12720SWyllys.Ingersoll@Sun.COM 	struct kms_elem *knext;		/* Next in hash chain */
40*12720SWyllys.Ingersoll@Sun.COM } kms_elem_t;
41*12720SWyllys.Ingersoll@Sun.COM 
42*12720SWyllys.Ingersoll@Sun.COM extern kms_elem_t **kms_mechhash;
43*12720SWyllys.Ingersoll@Sun.COM extern boolean_t kms_initialized;
44*12720SWyllys.Ingersoll@Sun.COM 
45*12720SWyllys.Ingersoll@Sun.COM #define	KMECH_HASHTABLE_SIZE	67
46*12720SWyllys.Ingersoll@Sun.COM 
47*12720SWyllys.Ingersoll@Sun.COM /* CK_INFO: Information about cryptoki */
48*12720SWyllys.Ingersoll@Sun.COM #define	CRYPTOKI_VERSION_MAJOR	2
49*12720SWyllys.Ingersoll@Sun.COM #define	CRYPTOKI_VERSION_MINOR	20
50*12720SWyllys.Ingersoll@Sun.COM #define	MANUFACTURER_ID		"Oracle Corporation     "
51*12720SWyllys.Ingersoll@Sun.COM #define	LIBRARY_DESCRIPTION	"Oracle Key Management System    "
52*12720SWyllys.Ingersoll@Sun.COM #define	LIBRARY_VERSION_MAJOR	1
53*12720SWyllys.Ingersoll@Sun.COM #define	LIBRARY_VERSION_MINOR	0
54*12720SWyllys.Ingersoll@Sun.COM 
55*12720SWyllys.Ingersoll@Sun.COM /* CK_SLOT_INFO: Information about our slot */
56*12720SWyllys.Ingersoll@Sun.COM #define	SLOT_DESCRIPTION	"Oracle Key Management System    " \
57*12720SWyllys.Ingersoll@Sun.COM 				"                                "
58*12720SWyllys.Ingersoll@Sun.COM #define	KMS_TOKEN_LABEL		"KMS                             "
59*12720SWyllys.Ingersoll@Sun.COM #define	KMS_TOKEN_MODEL		"                "
60*12720SWyllys.Ingersoll@Sun.COM #define	KMS_TOKEN_SERIAL	"                "
61*12720SWyllys.Ingersoll@Sun.COM #define	KMS_TOKEN_FLAGS		CKF_LOGIN_REQUIRED
62*12720SWyllys.Ingersoll@Sun.COM #define	MAX_PIN_LEN		256
63*12720SWyllys.Ingersoll@Sun.COM #define	MIN_PIN_LEN		1
64*12720SWyllys.Ingersoll@Sun.COM #define	HARDWARE_VERSION_MAJOR	0
65*12720SWyllys.Ingersoll@Sun.COM #define	HARDWARE_VERSION_MINOR	0
66*12720SWyllys.Ingersoll@Sun.COM #define	FIRMWARE_VERSION_MAJOR	0
67*12720SWyllys.Ingersoll@Sun.COM #define	FIRMWARE_VERSION_MINOR	0
68*12720SWyllys.Ingersoll@Sun.COM 
69*12720SWyllys.Ingersoll@Sun.COM CK_RV crypto2pkcs11_error_number(uint_t);
70*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_mech(CK_MECHANISM_TYPE);
71*12720SWyllys.Ingersoll@Sun.COM unsigned char *get_symmetric_key_value(kms_object_t *);
72*12720SWyllys.Ingersoll@Sun.COM void free_key_attributes();
73*12720SWyllys.Ingersoll@Sun.COM 
74*12720SWyllys.Ingersoll@Sun.COM CK_RV process_object_attributes(CK_ATTRIBUTE_PTR, CK_ULONG, caddr_t *,
75*12720SWyllys.Ingersoll@Sun.COM     CK_BBOOL *);
76*12720SWyllys.Ingersoll@Sun.COM CK_RV get_object_attributes(CK_ATTRIBUTE_PTR, CK_ULONG, caddr_t);
77*12720SWyllys.Ingersoll@Sun.COM void free_object_attributes(caddr_t, CK_ULONG);
78*12720SWyllys.Ingersoll@Sun.COM CK_RV process_found_objects(kms_session_t *, CK_OBJECT_HANDLE *,
79*12720SWyllys.Ingersoll@Sun.COM     CK_ULONG *);
80*12720SWyllys.Ingersoll@Sun.COM CK_RV get_mechanism_info(kms_slot_t *, CK_MECHANISM_TYPE,
81*12720SWyllys.Ingersoll@Sun.COM     CK_MECHANISM_INFO_PTR, uint32_t *);
82*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_add_extra_attr(CK_ATTRIBUTE_PTR, kms_object_t *);
83*12720SWyllys.Ingersoll@Sun.COM 
84*12720SWyllys.Ingersoll@Sun.COM #ifdef	__cplusplus
85*12720SWyllys.Ingersoll@Sun.COM }
86*12720SWyllys.Ingersoll@Sun.COM #endif
87*12720SWyllys.Ingersoll@Sun.COM 
88*12720SWyllys.Ingersoll@Sun.COM #endif /* _KMSGLOBAL_H */
89