FM_SetAppUserData

This function can be used to associate user data with the calling application. The data is associated with the PID of the calling application. The function specified in this call will be called to free the data when the last application using the library finalizes (e.g. when it calls C_Finalize()).

If the application 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_SetAppUserData(FmNumber_t fmNo,
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.
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.