diff options
author | Stef Walter <stef@memberwebs.com> | 2007-05-06 15:37:57 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2007-05-06 15:37:57 +0000 |
commit | fba61383772184aff5eae03d21f0381e3a99dc00 (patch) | |
tree | 354b2a8d2a031d7ab23f5d0abe06e20584895d66 /ckcapi-object.c | |
parent | 8ddd21cad4109c44a388acaab72507b8f54e4c35 (diff) |
Internal API cleanup.
Diffstat (limited to 'ckcapi-object.c')
-rw-r--r-- | ckcapi-object.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/ckcapi-object.c b/ckcapi-object.c index 763102c..538e0fa 100644 --- a/ckcapi-object.c +++ b/ckcapi-object.c @@ -5,9 +5,6 @@ #include <memory.h> -#include <wtypes.h> -#include <wincrypt.h> - static CkCapiArray* object_array = NULL; static CkCapiHash* object_hash = NULL; @@ -306,13 +303,12 @@ attribute_data_type(CK_ATTRIBUTE_TYPE type) CK_BBOOL ckcapi_object_data_match_attr(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR match) { - CK_VOID_PTR value; - CK_ULONG len; + CK_ATTRIBUTE attr; CK_RV rv; int dtype; ASSERT(match); - ASSERT(objdata && objdata->data); + ASSERT(objdata); ASSERT(objdata->data_funcs); /* Get the data type of the attribute */ @@ -325,22 +321,23 @@ ckcapi_object_data_match_attr(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR match) return CK_FALSE; /* Only load as much data as is needed */ - value = _alloca(match->ulValueLen > 4 ? match->ulValueLen : 4); - len = match->ulValueLen; + attr.type = match->type; + attr.pValue = _alloca(match->ulValueLen > 4 ? match->ulValueLen : 4); + attr.ulValueLen = match->ulValueLen; switch(dtype) { case DATA_BOOL: - rv = (objdata->data_funcs->get_bool)(objdata->data, match->type, value, &len); + rv = (objdata->data_funcs->get_bool)(objdata, &attr); break; case DATA_ULONG: - rv = (objdata->data_funcs->get_ulong)(objdata->data, match->type, value, &len); + rv = (objdata->data_funcs->get_ulong)(objdata, &attr); break; case DATA_BYTES: - rv = (objdata->data_funcs->get_bytes)(objdata->data, match->type, value, &len); + rv = (objdata->data_funcs->get_bytes)(objdata, &attr); break; case DATA_DATE: - rv = (objdata->data_funcs->get_date)(objdata->data, match->type, value, &len); + rv = (objdata->data_funcs->get_date)(objdata, &attr); break; default: ASSERT(0 && "unrecognized type"); @@ -359,8 +356,8 @@ ckcapi_object_data_match_attr(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR match) if(rv != CKR_OK) return CK_FALSE; - return (match->ulValueLen == len && - memcmp(match->pValue, value, len) == 0); + return (match->ulValueLen == attr.ulValueLen && + memcmp(match->pValue, attr.pValue, attr.ulValueLen) == 0); } CK_BBOOL @@ -385,7 +382,7 @@ ckcapi_object_data_get_attrs(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR attrs, CK_ULONG i; CK_RV rv, ret = CKR_OK; - ASSERT(objdata && objdata->data); + ASSERT(objdata); ASSERT(!count || attrs); for(i = 0; i < count; ++i) @@ -394,20 +391,16 @@ ckcapi_object_data_get_attrs(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR attrs, switch(attribute_data_type(attrs[i].type)) { case DATA_BOOL: - rv = (objdata->data_funcs->get_bool)(objdata->data, attrs[i].type, - attrs[i].pValue, &attrs[i].ulValueLen); + rv = (objdata->data_funcs->get_bool)(objdata, &attrs[i]); break; case DATA_ULONG: - rv = (objdata->data_funcs->get_ulong)(objdata->data, attrs[i].type, - attrs[i].pValue, &attrs[i].ulValueLen); + rv = (objdata->data_funcs->get_ulong)(objdata, &attrs[i]); break; case DATA_BYTES: - rv = (objdata->data_funcs->get_bytes)(objdata->data, attrs[i].type, - attrs[i].pValue, &attrs[i].ulValueLen); + rv = (objdata->data_funcs->get_bytes)(objdata, &attrs[i]); break; case DATA_DATE: - rv = (objdata->data_funcs->get_date)(objdata->data, attrs[i].type, - attrs[i].pValue, &attrs[i].ulValueLen); + rv = (objdata->data_funcs->get_date)(objdata, &attrs[i]); break; case DATA_UNKNOWN: rv = CKR_ATTRIBUTE_TYPE_INVALID; @@ -453,4 +446,4 @@ ckcapi_object_data_get_attrs(CkCapiObjectData* objdata, CK_ATTRIBUTE_PTR attrs, } return ret; -}
\ No newline at end of file +} |