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 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #ifndef _KERNEL_SLOT_H 27 #define _KERNEL_SLOT_H 28 29 #pragma ident "%Z%%M% %I% %E% SMI" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif 34 35 #include "kernelSession.h" 36 #include <sys/crypto/ioctl.h> 37 38 #define CKU_PUBLIC 2 /* default session auth. state */ 39 40 /* 41 * This slot has limited hash support. It can not do multi-part 42 * hashing (updates) and it can not hash input data of size 43 * greater than sl_max_inlen. 44 */ 45 #define CRYPTO_LIMITED_HASH_SUPPORT 0x00000001 46 47 typedef struct kernel_slot { 48 CK_SLOT_ID sl_provider_id; /* kernel provider ID */ 49 crypto_function_list_t sl_func_list; /* function list */ 50 kernel_session_t *sl_sess_list; /* all open sessions */ 51 CK_USER_TYPE sl_state; /* session's auth. state */ 52 struct object *sl_tobj_list; /* token object list */ 53 pthread_mutex_t sl_mutex; 54 /* 55 * The valid values are defined above. 56 */ 57 uint32_t sl_flags; 58 59 /* 60 * The maximum input data that can be digested by this slot. 61 * Used only if CRYPTO_LIMITED_HASH_SUPPORT is set in sl_flags. 62 */ 63 int sl_max_inlen; 64 65 /* 66 * The threshold for input data size. We use this slot 67 * only if data size is at or above this value. Used only if 68 * CRYPTO_LIMITED_HASH_SUPPORT is set. 69 */ 70 int sl_threshold; 71 } kernel_slot_t; 72 73 extern CK_ULONG slot_count; 74 extern kernel_slot_t **slot_table; 75 76 /* 77 * Function Prototypes. 78 */ 79 CK_RV kernel_slottable_init(); 80 81 #ifdef __cplusplus 82 } 83 #endif 84 85 #endif /* _KERNEL_SLOT_H */ 86