corePKCS11  v3.2.0
PKCS #11 Cryptoki Library
C_Finalize

Clean up miscellaneous Cryptoki-associated resources.

CK_DECLARE_FUNCTION( CK_RV, C_Finalize )( CK_VOID_PTR pReserved )
{
CK_RV xResult = CKR_OK;
if( pReserved != NULL )
{
xResult = CKR_ARGUMENTS_BAD;
LogError( ( "Failed to un-initialize PKCS #11. Received bad arguments. "
"Parameters must be NULL, but were not." ) );
}
if( xResult == CKR_OK )
{
/* See explanation in prvCheckValidSessionAndModule for this exception. */
/* coverity[misra_c_2012_rule_10_5_violation] */
if( xP11Context.xIsInitialized == ( CK_BBOOL ) CK_FALSE )
{
xResult = CKR_CRYPTOKI_NOT_INITIALIZED;
LogWarn( ( "PKCS #11 was already uninitialized." ) );
}
}
if( xResult == CKR_OK )
{
mbedtls_entropy_free( &xP11Context.xMbedEntropyContext );
mbedtls_ctr_drbg_free( &xP11Context.xMbedDrbgCtx );
mbedtls_mutex_free( &xP11Context.xObjectList.xMutex );
mbedtls_mutex_free( &xP11Context.xSessionMutex );
/* See explanation in prvCheckValidSessionAndModule for this exception. */
/* coverity[misra_c_2012_rule_10_5_violation] */
xP11Context.xIsInitialized = ( CK_BBOOL ) CK_FALSE;
LogInfo( ( "PKCS #11 was successfully uninitialized." ) );
}
return xResult;
}
C_Finalize
CK_RV C_Finalize(CK_VOID_PTR pReserved)
Clean up miscellaneous Cryptoki-associated resources.
Definition: core_pkcs11_mbedtls.c:1414
P11Struct_t::xIsInitialized
CK_BBOOL xIsInitialized
Indicates whether PKCS #11 module has been initialized with a call to C_Initialize.
Definition: core_pkcs11_mbedtls.c:272
P11Struct_t::xObjectList
P11ObjectList_t xObjectList
List of PKCS #11 objects that have been found/created since module initialization....
Definition: core_pkcs11_mbedtls.c:276
xP11Context
static P11Struct_t xP11Context
The global PKCS #11 module object. Entropy/randomness and object lists are shared across PKCS #11 ses...
Definition: core_pkcs11_mbedtls.c:313
LogInfo
#define LogInfo(message)
Macro that is called in the corePKCS11 library for logging "Info" level messages.
Definition: core_pkcs11_config_defaults.h:355
P11Struct_t::xSessionMutex
mbedtls_threading_mutex_t xSessionMutex
Mutex that protects write operations to the pxSession array.
Definition: core_pkcs11_mbedtls.c:275
P11Struct_t::xMbedDrbgCtx
mbedtls_ctr_drbg_context xMbedDrbgCtx
CTR-DRBG context for PKCS #11 module - used to generate pseudo-random numbers.
Definition: core_pkcs11_mbedtls.c:273
LogWarn
#define LogWarn(message)
Macro that is called in the corePKCS11 library for logging "Warning" level messages.
Definition: core_pkcs11_config_defaults.h:335
CK_DECLARE_FUNCTION
#define CK_DECLARE_FUNCTION(returnType, name)
Macro for defining a PKCS #11 functions.
Definition: core_pkcs11.h:75
LogError
#define LogError(message)
Macro that is called in the corePKCS11 library for logging "Error" level messages.
Definition: core_pkcs11_config_defaults.h:315
P11ObjectList_t::xMutex
mbedtls_threading_mutex_t xMutex
Mutex that protects write operations to the xObjects array.
Definition: core_pkcs11_mbedtls.c:262
P11Struct_t::xMbedEntropyContext
mbedtls_entropy_context xMbedEntropyContext
Entropy context for PKCS #11 module - used to collect entropy for RNG.
Definition: core_pkcs11_mbedtls.c:274