Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,13 @@ static CK_RV NewObject(WP11_Session* session, CK_KEY_TYPE keyType,
if (ret != 0)
return CKR_FUNCTION_FAILED;

/* Now that object class is set, allocate type-specific data */
ret = wp11_Object_AllocateTypeData(obj);
if (ret == MEMORY_E)
return CKR_DEVICE_MEMORY;
if (ret != 0)
return CKR_FUNCTION_FAILED;

rv = SetAttributeValue(session, obj, pTemplate, ulCount, CK_TRUE);
if (rv != CKR_OK) {
WP11_Object_Free(obj);
Expand Down Expand Up @@ -1141,6 +1148,18 @@ CK_RV C_CopyObject(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject,
if (ret != 0)
return CKR_FUNCTION_FAILED;

/* Set the object class from the original object */
ret = WP11_Object_SetClass(newObj, WP11_Object_GetClass(obj));
if (ret != 0)
return CKR_FUNCTION_FAILED;

/* Now that object class is set, allocate type-specific data */
ret = wp11_Object_AllocateTypeData(newObj);
if (ret == MEMORY_E)
return CKR_DEVICE_MEMORY;
if (ret != 0)
return CKR_FUNCTION_FAILED;

/* Use get and set attribute value to fill in object. */
rv = C_GetAttributeValue(hSession, hObject, pTemplate, ulCount);
if (rv != CKR_OK) {
Expand Down
Loading
Loading