![]() | Cryptographic Token Interface Standard |
PKCS#11 |
The types in this section are provided solely for applications which need to access Cryptoki from multiple threads simultaneously. Applications which will not do this need not use any of these types.
typedef CK_CALLBACK_FUNCTION(CK_RV, CK_CREATEMUTEX)( CK_VOID_PTR_PTR ppMutex );
Calling a CK_CREATEMUTEX function returns the pointer to the new mutex object in the location pointed to by ppMutex. Such a function should return one of the following values: CKR_OK, CKR_GENERAL_ERROR, CKR_HOST_MEMORY.
typedef CK_CALLBACK_FUNCTION(CK_RV, CK_DESTROYMUTEX)( CK_VOID_PTR pMutex );
The argument to a CK_DESTROYMUTEX function is a pointer to the mutex object to be destroyed. Such a function should return one of the following values: CKR_OK, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MUTEX_BAD.
typedef CK_CALLBACK_FUNCTION(CK_RV, CK_LOCKMUTEX)( CK_VOID_PTR pMutex );
The argument to a CK_LOCKMUTEX function is a pointer to the mutex object to be locked. Such a function should return one of the following values: CKR_OK, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MUTEX_BAD.
CK_UNLOCKMUTEX is defined as follows:
typedef CK_CALLBACK_FUNCTION(CK_RV, CK_UNLOCKMUTEX)( CK_VOID_PTR pMutex );
The argument to a CK_UNLOCKMUTEX function is a pointer to the mutex object to be unlocked. Such a function should return one of the following values: CKR_OK, CKR_GENERAL_ERROR, CKR_HOST_MEMORY, CKR_MUTEX_BAD, CKR_MUTEX_NOT_LOCKED.
typedef struct CK_C_INITIALIZE_ARGS { CK_CREATEMUTEX CreateMutex; CK_DESTROYMUTEX DestroyMutex; CK_LOCKMUTEX LockMutex; CK_UNLOCKMUTEX UnlockMutex; CK_FLAGS flags; CK_VOID_PTR pReserved; } CK_C_INITIALIZE_ARGS;
CreateMutex | pointer to a function to use for creating mutex objects |
DestroyMutex | pointer to a function to use for destroying mutex objects |
LockMutex | pointer to a function to use for locking mutex objects |
UnlockMutex | pointer to a function to use for unlocking mutex objects |
flags | bit flags specifying options for '''C_Initialize'''; the flags are defined below |
pReserved | reserved for future use. Should be NULL_PTR for this version of Cryptoki |
The following table defines the flags field:
Table 14, C_Initialize Parameter Flags
Bit Flag | Mask | Meaning |
CKF_LIBRARY_CANT_CREATE_OS_THREADS | 0x00000001 | True if application threads which are executing calls to the library may not use native operating system calls to spawn new threads; false if they may |
CKF_OS_LOCKING_OK | 0x00000002 | True if the library can use the native operation system threading model for locking; false otherwise |
CK_C_INITIALIZE_ARGS_PTR is a pointer to a CK_C_INITIALIZE_ARGS.