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) 2003, 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 _KMSOBJECT_H 26*12720SWyllys.Ingersoll@Sun.COM #define _KMSOBJECT_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 <security/pkcs11t.h> 33*12720SWyllys.Ingersoll@Sun.COM #include "kmsSession.h" 34*12720SWyllys.Ingersoll@Sun.COM #include "kmsSlot.h" 35*12720SWyllys.Ingersoll@Sun.COM 36*12720SWyllys.Ingersoll@Sun.COM #define KMSTOKEN_OBJECT_MAGIC 0xECF0B004 37*12720SWyllys.Ingersoll@Sun.COM 38*12720SWyllys.Ingersoll@Sun.COM #define KMS_CREATE_OBJ 1 39*12720SWyllys.Ingersoll@Sun.COM #define KMS_GEN_KEY 2 40*12720SWyllys.Ingersoll@Sun.COM 41*12720SWyllys.Ingersoll@Sun.COM /* 42*12720SWyllys.Ingersoll@Sun.COM * Secret key Struct 43*12720SWyllys.Ingersoll@Sun.COM */ 44*12720SWyllys.Ingersoll@Sun.COM typedef struct secret_key_obj { 45*12720SWyllys.Ingersoll@Sun.COM CK_BYTE *sk_value; 46*12720SWyllys.Ingersoll@Sun.COM CK_ULONG sk_value_len; 47*12720SWyllys.Ingersoll@Sun.COM void *key_sched; 48*12720SWyllys.Ingersoll@Sun.COM size_t keysched_len; 49*12720SWyllys.Ingersoll@Sun.COM } secret_key_obj_t; 50*12720SWyllys.Ingersoll@Sun.COM 51*12720SWyllys.Ingersoll@Sun.COM /* 52*12720SWyllys.Ingersoll@Sun.COM * This structure is used to hold the attributes in the 53*12720SWyllys.Ingersoll@Sun.COM * Extra Attribute List. 54*12720SWyllys.Ingersoll@Sun.COM */ 55*12720SWyllys.Ingersoll@Sun.COM typedef struct attribute_info { 56*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE attr; 57*12720SWyllys.Ingersoll@Sun.COM struct attribute_info *next; 58*12720SWyllys.Ingersoll@Sun.COM } attribute_info_t; 59*12720SWyllys.Ingersoll@Sun.COM 60*12720SWyllys.Ingersoll@Sun.COM typedef attribute_info_t *CK_ATTRIBUTE_INFO_PTR; 61*12720SWyllys.Ingersoll@Sun.COM 62*12720SWyllys.Ingersoll@Sun.COM /* 63*12720SWyllys.Ingersoll@Sun.COM * This is the main structure of the Objects. 64*12720SWyllys.Ingersoll@Sun.COM */ 65*12720SWyllys.Ingersoll@Sun.COM typedef struct object { 66*12720SWyllys.Ingersoll@Sun.COM boolean_t is_lib_obj; /* default is TRUE */ 67*12720SWyllys.Ingersoll@Sun.COM 68*12720SWyllys.Ingersoll@Sun.COM /* Generic common fields. Always present */ 69*12720SWyllys.Ingersoll@Sun.COM CK_OBJECT_CLASS class; 70*12720SWyllys.Ingersoll@Sun.COM CK_KEY_TYPE key_type; 71*12720SWyllys.Ingersoll@Sun.COM CK_ULONG magic_marker; 72*12720SWyllys.Ingersoll@Sun.COM uint64_t bool_attr_mask; 73*12720SWyllys.Ingersoll@Sun.COM CK_MECHANISM_TYPE mechanism; 74*12720SWyllys.Ingersoll@Sun.COM 75*12720SWyllys.Ingersoll@Sun.COM /* Fields for access and arbitration */ 76*12720SWyllys.Ingersoll@Sun.COM pthread_mutex_t object_mutex; 77*12720SWyllys.Ingersoll@Sun.COM struct object *next; 78*12720SWyllys.Ingersoll@Sun.COM struct object *prev; 79*12720SWyllys.Ingersoll@Sun.COM 80*12720SWyllys.Ingersoll@Sun.COM /* Extra non-boolean attribute list */ 81*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE_INFO_PTR extra_attrlistp; 82*12720SWyllys.Ingersoll@Sun.COM CK_ULONG extra_attrcount; 83*12720SWyllys.Ingersoll@Sun.COM 84*12720SWyllys.Ingersoll@Sun.COM /* For each object, only one object class is presented */ 85*12720SWyllys.Ingersoll@Sun.COM union { 86*12720SWyllys.Ingersoll@Sun.COM secret_key_obj_t *secret_key; 87*12720SWyllys.Ingersoll@Sun.COM } object_class_u; 88*12720SWyllys.Ingersoll@Sun.COM 89*12720SWyllys.Ingersoll@Sun.COM /* Session handle that the object belongs to */ 90*12720SWyllys.Ingersoll@Sun.COM CK_SESSION_HANDLE session_handle; 91*12720SWyllys.Ingersoll@Sun.COM uint32_t obj_refcnt; /* object reference count */ 92*12720SWyllys.Ingersoll@Sun.COM pthread_cond_t obj_free_cond; /* cond variable for signal and wait */ 93*12720SWyllys.Ingersoll@Sun.COM uint32_t obj_delete_sync; /* object delete sync flags */ 94*12720SWyllys.Ingersoll@Sun.COM } kms_object_t; 95*12720SWyllys.Ingersoll@Sun.COM 96*12720SWyllys.Ingersoll@Sun.COM typedef struct find_context { 97*12720SWyllys.Ingersoll@Sun.COM kms_object_t **objs_found; 98*12720SWyllys.Ingersoll@Sun.COM CK_ULONG num_results; 99*12720SWyllys.Ingersoll@Sun.COM CK_ULONG next_result_index; /* next result object to return */ 100*12720SWyllys.Ingersoll@Sun.COM } find_context_t; 101*12720SWyllys.Ingersoll@Sun.COM 102*12720SWyllys.Ingersoll@Sun.COM /* 103*12720SWyllys.Ingersoll@Sun.COM * The following structure is used to link the to-be-freed session 104*12720SWyllys.Ingersoll@Sun.COM * objects into a linked list. The objects on this linked list have 105*12720SWyllys.Ingersoll@Sun.COM * not yet been freed via free() after C_DestroyObject() call; instead 106*12720SWyllys.Ingersoll@Sun.COM * they are added to this list. The actual free will take place when 107*12720SWyllys.Ingersoll@Sun.COM * the number of objects queued reaches MAX_OBJ_TO_BE_FREED, at which 108*12720SWyllys.Ingersoll@Sun.COM * time the first object in the list will be freed. 109*12720SWyllys.Ingersoll@Sun.COM */ 110*12720SWyllys.Ingersoll@Sun.COM #define MAX_OBJ_TO_BE_FREED 300 111*12720SWyllys.Ingersoll@Sun.COM 112*12720SWyllys.Ingersoll@Sun.COM typedef struct obj_to_be_freed_list { 113*12720SWyllys.Ingersoll@Sun.COM kms_object_t *first; /* points to first obj in the list */ 114*12720SWyllys.Ingersoll@Sun.COM kms_object_t *last; /* points to last obj in the list */ 115*12720SWyllys.Ingersoll@Sun.COM uint32_t count; /* current total objs in the list */ 116*12720SWyllys.Ingersoll@Sun.COM pthread_mutex_t obj_to_be_free_mutex; 117*12720SWyllys.Ingersoll@Sun.COM } object_to_be_freed_list_t; 118*12720SWyllys.Ingersoll@Sun.COM 119*12720SWyllys.Ingersoll@Sun.COM extern object_to_be_freed_list_t obj_delay_freed; 120*12720SWyllys.Ingersoll@Sun.COM 121*12720SWyllys.Ingersoll@Sun.COM /* 122*12720SWyllys.Ingersoll@Sun.COM * The following definitions are the shortcuts 123*12720SWyllys.Ingersoll@Sun.COM */ 124*12720SWyllys.Ingersoll@Sun.COM 125*12720SWyllys.Ingersoll@Sun.COM /* 126*12720SWyllys.Ingersoll@Sun.COM * Secret Key Object Attributes 127*12720SWyllys.Ingersoll@Sun.COM */ 128*12720SWyllys.Ingersoll@Sun.COM #define OBJ_SEC(o) \ 129*12720SWyllys.Ingersoll@Sun.COM ((o)->object_class_u.secret_key) 130*12720SWyllys.Ingersoll@Sun.COM #define OBJ_SEC_VALUE(o) \ 131*12720SWyllys.Ingersoll@Sun.COM ((o)->object_class_u.secret_key->sk_value) 132*12720SWyllys.Ingersoll@Sun.COM #define OBJ_SEC_VALUE_LEN(o) \ 133*12720SWyllys.Ingersoll@Sun.COM ((o)->object_class_u.secret_key->sk_value_len) 134*12720SWyllys.Ingersoll@Sun.COM #define OBJ_KEY_SCHED(o) \ 135*12720SWyllys.Ingersoll@Sun.COM ((o)->object_class_u.secret_key->key_sched) 136*12720SWyllys.Ingersoll@Sun.COM #define OBJ_KEY_SCHED_LEN(o) \ 137*12720SWyllys.Ingersoll@Sun.COM ((o)->object_class_u.secret_key->keysched_len) 138*12720SWyllys.Ingersoll@Sun.COM 139*12720SWyllys.Ingersoll@Sun.COM /* 140*12720SWyllys.Ingersoll@Sun.COM * key related attributes with CK_BBOOL data type 141*12720SWyllys.Ingersoll@Sun.COM */ 142*12720SWyllys.Ingersoll@Sun.COM #define DERIVE_BOOL_ON 0x00000001 143*12720SWyllys.Ingersoll@Sun.COM #define LOCAL_BOOL_ON 0x00000002 144*12720SWyllys.Ingersoll@Sun.COM #define SENSITIVE_BOOL_ON 0x00000004 145*12720SWyllys.Ingersoll@Sun.COM #define SECONDARY_AUTH_BOOL_ON 0x00000008 146*12720SWyllys.Ingersoll@Sun.COM #define ENCRYPT_BOOL_ON 0x00000010 147*12720SWyllys.Ingersoll@Sun.COM #define DECRYPT_BOOL_ON 0x00000020 148*12720SWyllys.Ingersoll@Sun.COM #define SIGN_BOOL_ON 0x00000040 149*12720SWyllys.Ingersoll@Sun.COM #define SIGN_RECOVER_BOOL_ON 0x00000080 150*12720SWyllys.Ingersoll@Sun.COM #define VERIFY_BOOL_ON 0x00000100 151*12720SWyllys.Ingersoll@Sun.COM #define VERIFY_RECOVER_BOOL_ON 0x00000200 152*12720SWyllys.Ingersoll@Sun.COM #define WRAP_BOOL_ON 0x00000400 153*12720SWyllys.Ingersoll@Sun.COM #define UNWRAP_BOOL_ON 0x00000800 154*12720SWyllys.Ingersoll@Sun.COM #define TRUSTED_BOOL_ON 0x00001000 155*12720SWyllys.Ingersoll@Sun.COM #define EXTRACTABLE_BOOL_ON 0x00002000 156*12720SWyllys.Ingersoll@Sun.COM #define ALWAYS_SENSITIVE_BOOL_ON 0x00004000 157*12720SWyllys.Ingersoll@Sun.COM #define NEVER_EXTRACTABLE_BOOL_ON 0x00008000 158*12720SWyllys.Ingersoll@Sun.COM #define PRIVATE_BOOL_ON 0x00010000 159*12720SWyllys.Ingersoll@Sun.COM #define TOKEN_BOOL_ON 0x00020000 160*12720SWyllys.Ingersoll@Sun.COM #define MODIFIABLE_BOOL_ON 0x00040000 161*12720SWyllys.Ingersoll@Sun.COM 162*12720SWyllys.Ingersoll@Sun.COM #define SECRET_KEY_DEFAULT (ENCRYPT_BOOL_ON|\ 163*12720SWyllys.Ingersoll@Sun.COM DECRYPT_BOOL_ON|\ 164*12720SWyllys.Ingersoll@Sun.COM SIGN_BOOL_ON|\ 165*12720SWyllys.Ingersoll@Sun.COM VERIFY_BOOL_ON|\ 166*12720SWyllys.Ingersoll@Sun.COM WRAP_BOOL_ON|\ 167*12720SWyllys.Ingersoll@Sun.COM UNWRAP_BOOL_ON|\ 168*12720SWyllys.Ingersoll@Sun.COM EXTRACTABLE_BOOL_ON|\ 169*12720SWyllys.Ingersoll@Sun.COM MODIFIABLE_BOOL_ON) 170*12720SWyllys.Ingersoll@Sun.COM 171*12720SWyllys.Ingersoll@Sun.COM /* 172*12720SWyllys.Ingersoll@Sun.COM * Flag definitions for obj_delete_sync 173*12720SWyllys.Ingersoll@Sun.COM */ 174*12720SWyllys.Ingersoll@Sun.COM #define OBJECT_IS_DELETING 1 /* Object is in a deleting state */ 175*12720SWyllys.Ingersoll@Sun.COM #define OBJECT_REFCNT_WAITING 2 /* Waiting for object reference */ 176*12720SWyllys.Ingersoll@Sun.COM /* count to become zero */ 177*12720SWyllys.Ingersoll@Sun.COM 178*12720SWyllys.Ingersoll@Sun.COM /* 179*12720SWyllys.Ingersoll@Sun.COM * This macro is used to type cast an object handle to a pointer to 180*12720SWyllys.Ingersoll@Sun.COM * the object struct. Also, it checks to see if the object struct 181*12720SWyllys.Ingersoll@Sun.COM * is tagged with an object magic number. This is to detect when an 182*12720SWyllys.Ingersoll@Sun.COM * application passes a bogus object pointer. 183*12720SWyllys.Ingersoll@Sun.COM * Also, it checks to see if the object is in the deleting state that 184*12720SWyllys.Ingersoll@Sun.COM * another thread is performing. If not, increment the object reference 185*12720SWyllys.Ingersoll@Sun.COM * count by one. This is to prevent this object from being deleted by 186*12720SWyllys.Ingersoll@Sun.COM * other thread. 187*12720SWyllys.Ingersoll@Sun.COM */ 188*12720SWyllys.Ingersoll@Sun.COM #define HANDLE2OBJECT_COMMON(hObject, object_p, rv, REFCNT_CODE) { \ 189*12720SWyllys.Ingersoll@Sun.COM object_p = (kms_object_t *)(hObject); \ 190*12720SWyllys.Ingersoll@Sun.COM if ((object_p == NULL) || \ 191*12720SWyllys.Ingersoll@Sun.COM (object_p->magic_marker != KMSTOKEN_OBJECT_MAGIC)) {\ 192*12720SWyllys.Ingersoll@Sun.COM rv = CKR_OBJECT_HANDLE_INVALID; \ 193*12720SWyllys.Ingersoll@Sun.COM } else { \ 194*12720SWyllys.Ingersoll@Sun.COM (void) pthread_mutex_lock(&object_p->object_mutex); \ 195*12720SWyllys.Ingersoll@Sun.COM if (!(object_p->obj_delete_sync & OBJECT_IS_DELETING)) { \ 196*12720SWyllys.Ingersoll@Sun.COM REFCNT_CODE; \ 197*12720SWyllys.Ingersoll@Sun.COM rv = CKR_OK; \ 198*12720SWyllys.Ingersoll@Sun.COM } else { \ 199*12720SWyllys.Ingersoll@Sun.COM rv = CKR_OBJECT_HANDLE_INVALID; \ 200*12720SWyllys.Ingersoll@Sun.COM } \ 201*12720SWyllys.Ingersoll@Sun.COM (void) pthread_mutex_unlock(&object_p->object_mutex); \ 202*12720SWyllys.Ingersoll@Sun.COM } \ 203*12720SWyllys.Ingersoll@Sun.COM } 204*12720SWyllys.Ingersoll@Sun.COM 205*12720SWyllys.Ingersoll@Sun.COM #define HANDLE2OBJECT(hObject, object_p, rv) \ 206*12720SWyllys.Ingersoll@Sun.COM HANDLE2OBJECT_COMMON(hObject, object_p, rv, object_p->obj_refcnt++) 207*12720SWyllys.Ingersoll@Sun.COM 208*12720SWyllys.Ingersoll@Sun.COM #define HANDLE2OBJECT_DESTROY(hObject, object_p, rv) \ 209*12720SWyllys.Ingersoll@Sun.COM HANDLE2OBJECT_COMMON(hObject, object_p, rv, /* no refcnt increment */) 210*12720SWyllys.Ingersoll@Sun.COM 211*12720SWyllys.Ingersoll@Sun.COM 212*12720SWyllys.Ingersoll@Sun.COM #define OBJ_REFRELE(object_p) { \ 213*12720SWyllys.Ingersoll@Sun.COM (void) pthread_mutex_lock(&object_p->object_mutex); \ 214*12720SWyllys.Ingersoll@Sun.COM if ((--object_p->obj_refcnt) == 0 && \ 215*12720SWyllys.Ingersoll@Sun.COM (object_p->obj_delete_sync & OBJECT_REFCNT_WAITING)) { \ 216*12720SWyllys.Ingersoll@Sun.COM (void) pthread_cond_signal(&object_p->obj_free_cond); \ 217*12720SWyllys.Ingersoll@Sun.COM } \ 218*12720SWyllys.Ingersoll@Sun.COM (void) pthread_mutex_unlock(&object_p->object_mutex); \ 219*12720SWyllys.Ingersoll@Sun.COM } 220*12720SWyllys.Ingersoll@Sun.COM 221*12720SWyllys.Ingersoll@Sun.COM 222*12720SWyllys.Ingersoll@Sun.COM /* 223*12720SWyllys.Ingersoll@Sun.COM * Function Prototypes. 224*12720SWyllys.Ingersoll@Sun.COM */ 225*12720SWyllys.Ingersoll@Sun.COM void kms_cleanup_object(kms_object_t *objp); 226*12720SWyllys.Ingersoll@Sun.COM 227*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_add_object(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, 228*12720SWyllys.Ingersoll@Sun.COM CK_ULONG *objecthandle_p, kms_session_t *sp); 229*12720SWyllys.Ingersoll@Sun.COM 230*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_delete_object(kms_session_t *, kms_object_t *, 231*12720SWyllys.Ingersoll@Sun.COM boolean_t, boolean_t); 232*12720SWyllys.Ingersoll@Sun.COM 233*12720SWyllys.Ingersoll@Sun.COM void kms_cleanup_extra_attr(kms_object_t *object_p); 234*12720SWyllys.Ingersoll@Sun.COM 235*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_copy_extra_attr(CK_ATTRIBUTE_INFO_PTR old_attrp, 236*12720SWyllys.Ingersoll@Sun.COM kms_object_t *object_p); 237*12720SWyllys.Ingersoll@Sun.COM 238*12720SWyllys.Ingersoll@Sun.COM void kms_cleanup_object_bigint_attrs(kms_object_t *object_p); 239*12720SWyllys.Ingersoll@Sun.COM 240*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_build_object(CK_ATTRIBUTE_PTR, CK_ULONG, kms_object_t *); 241*12720SWyllys.Ingersoll@Sun.COM 242*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_copy_object(kms_object_t *old_object, 243*12720SWyllys.Ingersoll@Sun.COM kms_object_t **new_object, boolean_t copy_everything, 244*12720SWyllys.Ingersoll@Sun.COM kms_session_t *sp); 245*12720SWyllys.Ingersoll@Sun.COM 246*12720SWyllys.Ingersoll@Sun.COM void kms_merge_object(kms_object_t *old_object, 247*12720SWyllys.Ingersoll@Sun.COM kms_object_t *new_object); 248*12720SWyllys.Ingersoll@Sun.COM 249*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_get_attribute(kms_object_t *object_p, 250*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE_PTR template); 251*12720SWyllys.Ingersoll@Sun.COM 252*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_set_attribute(kms_object_t *, CK_ATTRIBUTE_PTR, boolean_t); 253*12720SWyllys.Ingersoll@Sun.COM 254*12720SWyllys.Ingersoll@Sun.COM void kms_add_object_to_session(kms_object_t *objp, kms_session_t *sp); 255*12720SWyllys.Ingersoll@Sun.COM 256*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_copy_secret_key_attr(secret_key_obj_t *old_secret_key_obj_p, 257*12720SWyllys.Ingersoll@Sun.COM secret_key_obj_t **new_secret_key_obj_p); 258*12720SWyllys.Ingersoll@Sun.COM 259*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_validate_attr(CK_ATTRIBUTE_PTR template, CK_ULONG ulAttrNum, 260*12720SWyllys.Ingersoll@Sun.COM CK_OBJECT_CLASS *class); 261*12720SWyllys.Ingersoll@Sun.COM 262*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_find_objects_init(kms_session_t *sp, 263*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount); 264*12720SWyllys.Ingersoll@Sun.COM 265*12720SWyllys.Ingersoll@Sun.COM void kms_find_objects_final(kms_session_t *sp); 266*12720SWyllys.Ingersoll@Sun.COM 267*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_find_objects(kms_session_t *sp, 268*12720SWyllys.Ingersoll@Sun.COM CK_OBJECT_HANDLE *obj_found, CK_ULONG max_obj_requested, 269*12720SWyllys.Ingersoll@Sun.COM CK_ULONG *found_obj_count); 270*12720SWyllys.Ingersoll@Sun.COM 271*12720SWyllys.Ingersoll@Sun.COM void kms_process_find_attr(CK_OBJECT_CLASS *pclasses, 272*12720SWyllys.Ingersoll@Sun.COM CK_ULONG *num_result_pclasses, CK_ATTRIBUTE_PTR pTemplate, 273*12720SWyllys.Ingersoll@Sun.COM CK_ULONG ulCount); 274*12720SWyllys.Ingersoll@Sun.COM 275*12720SWyllys.Ingersoll@Sun.COM boolean_t kms_find_match_attrs(kms_object_t *obj, 276*12720SWyllys.Ingersoll@Sun.COM CK_OBJECT_CLASS *pclasses, CK_ULONG num_pclasses, 277*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE *tmpl_attr, CK_ULONG num_attr); 278*12720SWyllys.Ingersoll@Sun.COM 279*12720SWyllys.Ingersoll@Sun.COM CK_ATTRIBUTE_PTR get_extra_attr(CK_ATTRIBUTE_TYPE type, kms_object_t *obj); 280*12720SWyllys.Ingersoll@Sun.COM 281*12720SWyllys.Ingersoll@Sun.COM CK_RV get_string_from_template(CK_ATTRIBUTE_PTR dest, CK_ATTRIBUTE_PTR src); 282*12720SWyllys.Ingersoll@Sun.COM 283*12720SWyllys.Ingersoll@Sun.COM void string_attr_cleanup(CK_ATTRIBUTE_PTR template); 284*12720SWyllys.Ingersoll@Sun.COM 285*12720SWyllys.Ingersoll@Sun.COM void kms_add_token_object_to_slot(kms_object_t *objp, 286*12720SWyllys.Ingersoll@Sun.COM kms_slot_t *pslot); 287*12720SWyllys.Ingersoll@Sun.COM 288*12720SWyllys.Ingersoll@Sun.COM void kms_remove_token_object_from_slot(kms_slot_t *pslot, 289*12720SWyllys.Ingersoll@Sun.COM kms_object_t *objp); 290*12720SWyllys.Ingersoll@Sun.COM 291*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_delete_token_object(kms_slot_t *pslot, kms_session_t *sp, 292*12720SWyllys.Ingersoll@Sun.COM kms_object_t *obj, boolean_t lock_held, boolean_t wrapper_only); 293*12720SWyllys.Ingersoll@Sun.COM 294*12720SWyllys.Ingersoll@Sun.COM void kms_cleanup_pri_objects_in_slot(kms_slot_t *pslot, 295*12720SWyllys.Ingersoll@Sun.COM kms_session_t *sp); 296*12720SWyllys.Ingersoll@Sun.COM 297*12720SWyllys.Ingersoll@Sun.COM CK_RV kms_get_object_size(kms_object_t *objp, CK_ULONG_PTR pulSize); 298*12720SWyllys.Ingersoll@Sun.COM 299*12720SWyllys.Ingersoll@Sun.COM void kms_object_delay_free(kms_object_t *); 300*12720SWyllys.Ingersoll@Sun.COM 301*12720SWyllys.Ingersoll@Sun.COM kms_object_t *kms_new_object(); 302*12720SWyllys.Ingersoll@Sun.COM void kms_free_object(kms_object_t *); 303*12720SWyllys.Ingersoll@Sun.COM 304*12720SWyllys.Ingersoll@Sun.COM #ifdef __cplusplus 305*12720SWyllys.Ingersoll@Sun.COM } 306*12720SWyllys.Ingersoll@Sun.COM #endif 307*12720SWyllys.Ingersoll@Sun.COM 308*12720SWyllys.Ingersoll@Sun.COM #endif /* _KMSOBJECT_H */ 309