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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _KERNEL_SLOT_H
27 #define _KERNEL_SLOT_H
33 #include "kernelSession.h"
34 #include <sys/crypto/ioctl.h>
36 #define CKU_PUBLIC 2 /* default session auth. state */
38 typedef struct cipher_mechs_threshold
{
40 uint32_t mech_threshold
;
41 } cipher_mechs_threshold_t
;
44 * This slot has limited hash support. It can not do multi-part
47 #define CRYPTO_LIMITED_HASH_SUPPORT 0x00000001
50 * This slot has limited hmac support. It can not do multi-part
53 #define CRYPTO_LIMITED_HMAC_SUPPORT 0x00000002
55 typedef struct kernel_slot
{
56 CK_SLOT_ID sl_provider_id
; /* kernel provider ID */
57 crypto_function_list_t sl_func_list
; /* function list */
58 kernel_session_t
*sl_sess_list
; /* all open sessions */
59 CK_USER_TYPE sl_state
; /* session's auth. state */
60 struct object
*sl_tobj_list
; /* token object list */
61 pthread_mutex_t sl_mutex
;
63 * The valid values are defined above.
68 * The maximum input data that can be digested by this slot.
69 * Used only if CRYPTO_LIMITED_HASH_SUPPORT is set in sl_flags.
71 int sl_hash_max_inlen
;
74 * The maximum input data that can be hmac'ed by this slot.
75 * Used only if CRYPTO_LIMITED_HMAC_SUPPORT is set in sl_flags.
77 int sl_hmac_max_inlen
;
80 * The threshold for input data size. We use this slot
81 * only if data size is at or above this value. Used only if
82 * CRYPTO_LIMITED_HASH_SUPPORT or CRYPTO_LIMITED_HMAC_SUPPORT is set.
86 int total_threshold_count
;
87 cipher_mechs_threshold_t sl_mechs_threshold
[MAX_NUM_THRESHOLD
];
90 extern CK_ULONG slot_count
;
91 extern kernel_slot_t
**slot_table
;
94 * Function Prototypes.
96 CK_RV
kernel_slottable_init();
102 #endif /* _KERNEL_SLOT_H */