kmsObject.h revision 4f14b0f29aa144cc03efdde5508ae126ae197acf
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _KMSOBJECT_H
#define _KMSOBJECT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "kmsSession.h"
#include "kmsSlot.h"
#define KMSTOKEN_OBJECT_MAGIC 0xECF0B004
#define KMS_CREATE_OBJ 1
#define KMS_GEN_KEY 2
/*
* Secret key Struct
*/
typedef struct secret_key_obj {
void *key_sched;
/*
* This structure is used to hold the attributes in the
* Extra Attribute List.
*/
typedef struct attribute_info {
struct attribute_info *next;
typedef attribute_info_t *CK_ATTRIBUTE_INFO_PTR;
/*
* This is the main structure of the Objects.
*/
typedef struct object {
/* Generic common fields. Always present */
/* Fields for access and arbitration */
/* Extra non-boolean attribute list */
/* For each object, only one object class is presented */
union {
/* Session handle that the object belongs to */
} kms_object_t;
typedef struct find_context {
/*
* The following structure is used to link the to-be-freed session
* objects into a linked list. The objects on this linked list have
* not yet been freed via free() after C_DestroyObject() call; instead
* they are added to this list. The actual free will take place when
* the number of objects queued reaches MAX_OBJ_TO_BE_FREED, at which
* time the first object in the list will be freed.
*/
#define MAX_OBJ_TO_BE_FREED 300
typedef struct obj_to_be_freed_list {
/*
* The following definitions are the shortcuts
*/
/*
* Secret Key Object Attributes
*/
#define OBJ_SEC(o) \
((o)->object_class_u.secret_key)
#define OBJ_SEC_VALUE(o) \
#define OBJ_SEC_VALUE_LEN(o) \
#define OBJ_KEY_SCHED(o) \
#define OBJ_KEY_SCHED_LEN(o) \
/*
* key related attributes with CK_BBOOL data type
*/
#define DERIVE_BOOL_ON 0x00000001
#define LOCAL_BOOL_ON 0x00000002
#define SENSITIVE_BOOL_ON 0x00000004
#define SECONDARY_AUTH_BOOL_ON 0x00000008
#define ENCRYPT_BOOL_ON 0x00000010
#define DECRYPT_BOOL_ON 0x00000020
#define SIGN_BOOL_ON 0x00000040
#define SIGN_RECOVER_BOOL_ON 0x00000080
#define VERIFY_BOOL_ON 0x00000100
#define VERIFY_RECOVER_BOOL_ON 0x00000200
#define WRAP_BOOL_ON 0x00000400
#define UNWRAP_BOOL_ON 0x00000800
#define TRUSTED_BOOL_ON 0x00001000
#define EXTRACTABLE_BOOL_ON 0x00002000
#define ALWAYS_SENSITIVE_BOOL_ON 0x00004000
#define NEVER_EXTRACTABLE_BOOL_ON 0x00008000
#define PRIVATE_BOOL_ON 0x00010000
#define TOKEN_BOOL_ON 0x00020000
#define MODIFIABLE_BOOL_ON 0x00040000
#define SECRET_KEY_DEFAULT (ENCRYPT_BOOL_ON|\
/*
* Flag definitions for obj_delete_sync
*/
/* count to become zero */
/*
* This macro is used to type cast an object handle to a pointer to
* the object struct. Also, it checks to see if the object struct
* is tagged with an object magic number. This is to detect when an
* application passes a bogus object pointer.
* Also, it checks to see if the object is in the deleting state that
* another thread is performing. If not, increment the object reference
* count by one. This is to prevent this object from being deleted by
* other thread.
*/
} else { \
REFCNT_CODE; \
} else { \
} \
} \
}
#define OBJ_REFRELE(object_p) { \
if ((--object_p->obj_refcnt) == 0 && \
} \
}
/*
* Function Prototypes.
*/
kms_session_t *sp);
kms_slot_t *pslot);
kms_object_t *objp);
kms_session_t *sp);
void kms_object_delay_free(kms_object_t *);
void kms_free_object(kms_object_t *);
#ifdef __cplusplus
}
#endif
#endif /* _KMSOBJECT_H */