summaryrefslogtreecommitdiff
path: root/ckcapi.h
diff options
context:
space:
mode:
Diffstat (limited to 'ckcapi.h')
-rw-r--r--ckcapi.h81
1 files changed, 51 insertions, 30 deletions
diff --git a/ckcapi.h b/ckcapi.h
index e1a0301..d6ee27b 100644
--- a/ckcapi.h
+++ b/ckcapi.h
@@ -18,6 +18,9 @@
struct _CkCapiObject;
struct _CkCapiSession;
+typedef struct _CkCapiObject CkCapiObject;
+typedef struct _CkCapiSession CkCapiSession;
+
/* ------------------------------------------------------------------
* cryptoki-capi.c
*/
@@ -30,6 +33,32 @@ void ckcapi_lock_global(void);
void ckcapi_unlock_global(void);
CK_RV ckcapi_winerr_to_ckr (DWORD werr);
+/* object data ------------------- */
+
+typedef CK_RV (*CkCapiGetAttribute)(void* obj, CK_ATTRIBUTE_TYPE type,
+ CK_VOID_PTR data, CK_ULONG_PTR len);
+
+typedef void (*CkCapiRelease)(void* value);
+
+typedef struct _CkCapiObjectDataVtable
+{
+ CkCapiGetAttribute get_bool;
+ CkCapiGetAttribute get_ulong;
+ CkCapiGetAttribute get_bytes;
+ CkCapiGetAttribute get_date;
+ CkCapiRelease release;
+}
+CkCapiObjectDataVtable;
+
+typedef struct _CkCapiObjectData
+{
+ CK_OBJECT_HANDLE object;
+ void* data;
+ CkCapiObjectDataVtable data_funcs;
+}
+CkCapiObjectData;
+
+
/* ------------------------------------------------------------------
* cryptoki-capi-session.c
*/
@@ -52,6 +81,8 @@ typedef struct _CkCapiSession
void* operation_data; /* Data for this operation */
CkCapiSessionCancel operation_cancel; /* Callback to cancel operation when necessary */
+ CkCapiHash* object_data;
+
CK_NOTIFY notify_callback; /* Application specified callback */
CK_VOID_PTR user_data; /* Argument for above */
@@ -75,6 +106,22 @@ CK_RV ckcapi_session_find (CkCapiSession* sess, CK_OBJECT_HANDLE_PTR objects
CK_ULONG max_object_count, CK_ULONG_PTR object_count);
CK_RV ckcapi_session_find_final (CkCapiSession* sess);
+CK_RV ckcapi_session_get_object_data (CkCapiSession* sess, CkCapiObject* obj,
+ CkCapiObjectData** objdata);
+
+CK_RV ckcapi_session_get_object_data_for (CkCapiSession* sess, CK_OBJECT_HANDLE hand,
+ CkCapiObjectData** objdata);
+
+CK_RV ckcapi_session_set_object_data (CkCapiSession* sess, CkCapiObject* obj,
+ const CkCapiObjectData* objdata);
+
+void ckcapi_session_clear_object_data (CkCapiSession* sess, CkCapiObject* obj);
+
+typedef void (*CkCapiEnumObjectData)(CkCapiSession* sess, CkCapiObject* obj, CkCapiObjectData* data, void* arg);
+
+void ckcapi_session_enum_object_data (CkCapiSession* sess, CkCapiEnumObjectData enum_func, void* arg);
+
+
/* ------------------------------------------------------------------
* ckcapi-object.c
*/
@@ -86,27 +133,6 @@ enum
OBJECT_BUILTIN = 2
};
-typedef CK_RV (*CkCapiGetAttribute)(void* obj, CK_ATTRIBUTE_TYPE type,
- CK_VOID_PTR data, CK_ULONG_PTR len);
-
-typedef void (*CkCapiRelease)(void* value);
-
-typedef struct _CkCapiObjectDataVtable
-{
- CkCapiGetAttribute get_bool;
- CkCapiGetAttribute get_ulong;
- CkCapiGetAttribute get_bytes;
- CkCapiGetAttribute get_date;
- CkCapiRelease release;
-}
-CkCapiObjectDataVtable;
-
-typedef struct _CkCapiObjectData
-{
- void* data;
- CkCapiObjectDataVtable data_funcs;
-}
-CkCapiObjectData;
typedef CK_RV (*CkCapiPurge)(struct _CkCapiObject* obj);
typedef CK_RV (*CkCapiLoadData)(struct _CkCapiObject* obj, CkCapiObjectData* objdata);
@@ -138,7 +164,7 @@ CkCapiObjectVtable;
#define UNIQUE_KEY_VAR_LEN(obj, first, last, len) \
((((char*)&((obj->last))) - ((char*)&((obj->first)))) + (len))
-typedef struct _CkCapiObject
+struct _CkCapiObject
{
CK_OBJECT_HANDLE id;
@@ -146,22 +172,19 @@ typedef struct _CkCapiObject
CkCapiObjectVtable obj_funcs;
void* unique_key;
size_t unique_len;
-}
-CkCapiObject;
+};
#define DBGO(obj, msg) \
ckcapi_debug("O%d: %s", (obj) ? (obj)->id : 0, (msg))
+CK_OBJECT_HANDLE ckcapi_object_get_max_handle (void);
+
CkCapiObject* ckcapi_object_lookup (CkCapiSession* sess, CK_OBJECT_HANDLE obj);
CK_RV ckcapi_object_register (CkCapiSession* sess, CkCapiObject* obj);
void ckcapi_object_clear_all (void);
-CK_RV ckcapi_object_load_data (CkCapiObject* obj, CkCapiObjectData* objdata);
-
-CK_RV ckcapi_object_load_data_for (CkCapiSession* sess, CK_OBJECT_HANDLE hand,
- CkCapiObjectData* objdata);
CK_BBOOL ckcapi_object_data_match (CkCapiObjectData* objdata,
CK_ATTRIBUTE_PTR matches, CK_ULONG count);
@@ -172,8 +195,6 @@ CK_BBOOL ckcapi_object_data_match_attr (CkCapiObjectData* objdata,
CK_RV ckcapi_object_data_get_attrs (CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR attrs,
CK_ULONG count);
-void ckcapi_object_data_release (CkCapiObjectData* objdata);
-
/* -------------------------------------------------------------------
* ckcapi-cert.c
*/