FM_SetSlotUserData

This function can be used to associate user data with a slot. The data is associated with the slot identified by slotId. The function specified in this call will be called to free the data when the last application using the library finalizes.

If the slot already has associated user data it will be freed, by calling the current free function, before the new data association is created.

Synopsis

#include <objstate.h>
CK_RV FM_SetSlotUserData(FmNumber_t fmNo,
CK_SLOTID slotId,
CK_VOID_PTR userData
CK_VOID(*freeUserData)(CK_VOID_PTR));
Parameter Description
fmNo The fm number of the caller. It must be FM_NUMBER_CUSTOM_FM in this release of the software.
slotId The slot ID of the slot.
userData Address of the memory block that will be associated with the session handle. If it is NULL, the current associated buffer is freed.
freeUserData Address of a function that will be called to free the userData, if the library decides that it should be freed. It must be non-NULL if userData is not NULL.

Return Code

CKR_OK: The operation was successful.

CKR_ARGUMENTS_BAD: freeUserData was NULL, when userData was not NULL, or fmNo was not FM_NUMBER_CUSTOM_FM.

CKR_CRYPTOKI_NOT_INITIALIZED: Cryptoki is not yet initialized.