corePKCS11  v3.2.0
PKCS #11 Cryptoki Library
C_FindObjectsFinal

Finishes an object search operation.

CK_DECLARE_FUNCTION( CK_RV, C_FindObjectsFinal )( CK_SESSION_HANDLE hSession )
{
P11Session_t * pxSession = prvSessionPointerFromHandle( hSession );
CK_RV xResult = prvCheckValidSessionAndModule( pxSession );
/*
* Check parameters.
*/
if( xResult == CKR_OK )
{
if( pxSession->pxFindObjectLabel == NULL )
{
LogError( ( "Failed to end find objects operation. Find operation "
"must be initialized." ) );
xResult = CKR_OPERATION_NOT_INITIALIZED;
}
}
if( xResult == CKR_OK )
{
/*
* Clean-up find objects state.
*/
mbedtls_free( pxSession->pxFindObjectLabel );
pxSession->pxFindObjectLabel = NULL;
pxSession->xFindObjectLabelLen = 0;
}
return xResult;
}
See also
C_FindObjectsInit(), C_FindObjects() which must be called before calling C_FindObjectsFinal().
Note
FindObjects parameters are shared by a session. Calling C_FindObjectsInit(), C_FindObjects(), and C_FindObjectsFinal() with the same session across different tasks may lead to unexpected results.
Parameters
[in]hSessionHandle of a valid PKCS #11 session.
Returns
CKR_OK if successful.
P11Session_t::xFindObjectLabelLen
CK_ULONG xFindObjectLabelLen
Size of current search label.
Definition: core_pkcs11_mbedtls.c:291
C_FindObjectsFinal
CK_RV C_FindObjectsFinal(CK_SESSION_HANDLE hSession)
Finishes an object search operation.
Definition: core_pkcs11_mbedtls.c:3496
prvCheckValidSessionAndModule
static CK_RV prvCheckValidSessionAndModule(const P11Session_t *pxSession)
Helper to check if the current session is initialized and valid.
Definition: core_pkcs11_mbedtls.c:323
CK_DECLARE_FUNCTION
#define CK_DECLARE_FUNCTION(returnType, name)
Macro for defining a PKCS #11 functions.
Definition: core_pkcs11.h:75
prvSessionPointerFromHandle
static P11Session_t * prvSessionPointerFromHandle(CK_SESSION_HANDLE xSession)
Maps an opaque caller session handle into its internal state structure.
Definition: core_pkcs11_mbedtls.c:365
P11Session_t
Session structure.
Definition: core_pkcs11_mbedtls.c:286
P11Session_t::pxFindObjectLabel
CK_BYTE * pxFindObjectLabel
Pointer to the label for the search in progress. Should be NULL if no search in progress.
Definition: core_pkcs11_mbedtls.c:290
LogError
#define LogError(message)
Macro that is called in the corePKCS11 library for logging "Error" level messages.
Definition: core_pkcs11_config_defaults.h:315