Closes a session.
{
CK_RV xResult = CKR_OK;
{
xResult = CKR_CRYPTOKI_NOT_INITIALIZED;
LogError( (
"Could not close a session. PKCS #11 must be initialized "
"before any operations." ) );
}
else if( pxSession == NULL )
{
xResult = CKR_SESSION_HANDLE_INVALID;
LogError( (
"Could not close a session. The PKCS #11 session handle "
"was invalid." ) );
}
else if( pxSession->
xOpened == ( CK_BBOOL ) CK_TRUE )
{
mbedtls_pk_free( &pxSession->
xSignKey );
LogInfo( (
"Successfully closed PKCS #11 session." ) );
}
else
{
}
return xResult;
}
#define CK_DECLARE_FUNCTION(returnType, name)
Macro for defining a PKCS #11 functions.
Definition: core_pkcs11.h:77
#define LogInfo(message)
Macro that is called in the corePKCS11 library for logging "Info" level messages.
Definition: core_pkcs11_config_defaults.h:357
#define LogError(message)
Macro that is called in the corePKCS11 library for logging "Error" level messages.
Definition: core_pkcs11_config_defaults.h:317
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:326
static P11Session_t * prvSessionPointerFromHandle(CK_SESSION_HANDLE xSession)
Maps an opaque caller session handle into its internal state structure.
Definition: core_pkcs11_mbedtls.c:382
CK_RV C_CloseSession(CK_SESSION_HANDLE hSession)
Closes a session.
Definition: core_pkcs11_mbedtls.c:1953
Session structure.
Definition: core_pkcs11_mbedtls.c:299
CK_OBJECT_HANDLE xSignKeyHandle
Object handle to the signing key.
Definition: core_pkcs11_mbedtls.c:311
mbedtls_threading_mutex_t xVerifyMutex
Protects the verification key from being modified while in use.
Definition: core_pkcs11_mbedtls.c:306
mbedtls_sha256_context xSHA256Context
Context for in progress digest operation.
Definition: core_pkcs11_mbedtls.c:313
mbedtls_pk_context xVerifyKey
Verification key. Set during C_VerifyInit.
Definition: core_pkcs11_mbedtls.c:308
CK_BBOOL xOpened
Set to CK_TRUE upon opening PKCS #11 session.
Definition: core_pkcs11_mbedtls.c:301
CK_OBJECT_HANDLE xVerifyKeyHandle
Object handle to the verification key.
Definition: core_pkcs11_mbedtls.c:307
mbedtls_threading_mutex_t xSignMutex
Protects the signing key from being modified while in use.
Definition: core_pkcs11_mbedtls.c:310
mbedtls_pk_context xSignKey
Signing key. Set during C_SignInit.
Definition: core_pkcs11_mbedtls.c:312
CK_BBOOL xIsInitialized
Indicates whether PKCS #11 module has been initialized with a call to C_Initialize.
Definition: core_pkcs11_mbedtls.c:285