10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 54072Skrishna * Common Development and Distribution License (the "License"). 64072Skrishna * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*11304SJanie.Lu@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _KERNEL_SLOT_H 270Sstevel@tonic-gate #define _KERNEL_SLOT_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include "kernelSession.h" 340Sstevel@tonic-gate #include <sys/crypto/ioctl.h> 350Sstevel@tonic-gate 360Sstevel@tonic-gate #define CKU_PUBLIC 2 /* default session auth. state */ 370Sstevel@tonic-gate 384841Shaimay typedef struct cipher_mechs_threshold { 394841Shaimay int mech_type; 404841Shaimay uint32_t mech_threshold; 414841Shaimay } cipher_mechs_threshold_t; 424841Shaimay 434072Skrishna /* 444072Skrishna * This slot has limited hash support. It can not do multi-part 45*11304SJanie.Lu@Sun.COM * hashing (updates). 464072Skrishna */ 474072Skrishna #define CRYPTO_LIMITED_HASH_SUPPORT 0x00000001 484072Skrishna 49*11304SJanie.Lu@Sun.COM /* 50*11304SJanie.Lu@Sun.COM * This slot has limited hmac support. It can not do multi-part 51*11304SJanie.Lu@Sun.COM * hmac (updates). 52*11304SJanie.Lu@Sun.COM */ 53*11304SJanie.Lu@Sun.COM #define CRYPTO_LIMITED_HMAC_SUPPORT 0x00000002 54*11304SJanie.Lu@Sun.COM 550Sstevel@tonic-gate typedef struct kernel_slot { 560Sstevel@tonic-gate CK_SLOT_ID sl_provider_id; /* kernel provider ID */ 570Sstevel@tonic-gate crypto_function_list_t sl_func_list; /* function list */ 580Sstevel@tonic-gate kernel_session_t *sl_sess_list; /* all open sessions */ 590Sstevel@tonic-gate CK_USER_TYPE sl_state; /* session's auth. state */ 600Sstevel@tonic-gate struct object *sl_tobj_list; /* token object list */ 610Sstevel@tonic-gate pthread_mutex_t sl_mutex; 624072Skrishna /* 634072Skrishna * The valid values are defined above. 644072Skrishna */ 654072Skrishna uint32_t sl_flags; 664072Skrishna 674072Skrishna /* 684072Skrishna * The maximum input data that can be digested by this slot. 694072Skrishna * Used only if CRYPTO_LIMITED_HASH_SUPPORT is set in sl_flags. 704072Skrishna */ 71*11304SJanie.Lu@Sun.COM int sl_hash_max_inlen; 72*11304SJanie.Lu@Sun.COM 73*11304SJanie.Lu@Sun.COM /* 74*11304SJanie.Lu@Sun.COM * The maximum input data that can be hmac'ed by this slot. 75*11304SJanie.Lu@Sun.COM * Used only if CRYPTO_LIMITED_HMAC_SUPPORT is set in sl_flags. 76*11304SJanie.Lu@Sun.COM */ 77*11304SJanie.Lu@Sun.COM int sl_hmac_max_inlen; 784072Skrishna 794072Skrishna /* 804072Skrishna * The threshold for input data size. We use this slot 814072Skrishna * only if data size is at or above this value. Used only if 82*11304SJanie.Lu@Sun.COM * CRYPTO_LIMITED_HASH_SUPPORT or CRYPTO_LIMITED_HMAC_SUPPORT is set. 834072Skrishna */ 844072Skrishna int sl_threshold; 854841Shaimay 864841Shaimay int total_threshold_count; 874841Shaimay cipher_mechs_threshold_t sl_mechs_threshold[MAX_NUM_THRESHOLD]; 880Sstevel@tonic-gate } kernel_slot_t; 890Sstevel@tonic-gate 900Sstevel@tonic-gate extern CK_ULONG slot_count; 910Sstevel@tonic-gate extern kernel_slot_t **slot_table; 920Sstevel@tonic-gate 930Sstevel@tonic-gate /* 940Sstevel@tonic-gate * Function Prototypes. 950Sstevel@tonic-gate */ 960Sstevel@tonic-gate CK_RV kernel_slottable_init(); 970Sstevel@tonic-gate 980Sstevel@tonic-gate #ifdef __cplusplus 990Sstevel@tonic-gate } 1000Sstevel@tonic-gate #endif 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate #endif /* _KERNEL_SLOT_H */ 103