diff options
Diffstat (limited to 'ckcapi-trust.c')
-rw-r--r-- | ckcapi-trust.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/ckcapi-trust.c b/ckcapi-trust.c index 8519464..3faa4b2 100644 --- a/ckcapi-trust.c +++ b/ckcapi-trust.c @@ -47,9 +47,6 @@ typedef struct _TrustObject { CkCapiObject obj; - - /* Together these form the unique key. Must be contiguous */ - unsigned int otype; CK_OBJECT_HANDLE cert_obj; } TrustObject; @@ -266,6 +263,18 @@ trust_date_attribute(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR attr) return CKR_ATTRIBUTE_TYPE_INVALID; } +static unsigned int +trust_hash_func(CkCapiObject* obj) +{ + return ckcapi_hash_integer(((TrustObject*)obj)->cert_obj); +} + +static int +trust_equal_func(CkCapiObject* a, CkCapiObject* b) +{ + return ((TrustObject*)a)->cert_obj == ((TrustObject*)b)->cert_obj; +} + static void trust_release(void* data) { @@ -440,6 +449,8 @@ trust_object_release(void* data) static const CkCapiObjectVtable trust_object_vtable = { trust_load_data, + trust_hash_func, + trust_equal_func, trust_object_release, }; @@ -453,13 +464,10 @@ register_trust_object(CkCapiSession* sess, CkCapiObject* cert, CkCapiObject** ob if(!tobj) return CKR_HOST_MEMORY; - tobj->otype = OBJECT_TRUST; tobj->cert_obj = cert->id; tobj->obj.id = 0; tobj->obj.obj_funcs = &trust_object_vtable; - tobj->obj.unique_key = UNIQUE_KEY_AT(tobj, otype); - tobj->obj.unique_len = UNIQUE_KEY_LEN(tobj, otype, cert_obj); ret = ckcapi_token_register_object(sess->slot, &(tobj->obj)); if(ret != CKR_OK) |