corePKCS11  V3.0.0
PKCS #11 Cryptoki Library
C_Finalize
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;
}
CK_DECLARE_FUNCTION
#define CK_DECLARE_FUNCTION(returnType, name)
Macro for defining a PKCS #11 functions.
Definition: core_pkcs11.h:72