FreeRTOS: PKCS11
PKCS11 Cryptoki Library
Return to main page ↑
C_GetSlotList

Obtains a list of slots in the system.

CK_DECLARE_FUNCTION( CK_RV, C_GetSlotList )( CK_BBOOL tokenPresent,
CK_SLOT_ID_PTR pSlotList,
CK_ULONG_PTR pulCount )
{
CK_RV xResult = CKR_OK;
/* Since the mbedTLS implementation of PKCS#11 does not depend
* on a physical token, this parameter is ignored. */
( void ) ( tokenPresent );
/* See explanation in prvCheckValidSessionAndModule for this exception. */
/* coverity[misra_c_2012_rule_10_5_violation] */
if( xP11Context.xIsInitialized != ( CK_BBOOL ) CK_TRUE )
{
xResult = CKR_CRYPTOKI_NOT_INITIALIZED;
}
if( NULL == pulCount )
{
xResult = CKR_ARGUMENTS_BAD;
}
if( xResult == CKR_OK )
{
if( NULL == pSlotList )
{
*pulCount = 1;
}
else
{
if( 0u == *pulCount )
{
xResult = CKR_BUFFER_TOO_SMALL;
}
else
{
pSlotList[ 0 ] = pkcs11SLOT_ID;
*pulCount = 1;
}
}
}
return xResult;
}

This port does not implement the concept of separate slots/tokens.

Parameters
[in]tokenPresentThis parameter is unused by this port.
[in]pSlotListPointer to an array of slot IDs. At this time, only 1 slot is implemented.
[in,out]pulCountLength of the slot list pxSlotList. Updated to contain the actual number of slots written to the list.
Returns
CKR_OK if successful. Else, see PKCS #11 specification for more information.
CK_DECLARE_FUNCTION
#define CK_DECLARE_FUNCTION(returnType, name)
Macro for defining a PKCS #11 functions.
Definition: iot_pkcs11.h:66
P11Struct_t::xIsInitialized
CK_BBOOL xIsInitialized
Indicates whether PKCS #11 module has been initialized with a call to C_Initialize.
Definition: iot_pkcs11_mbedtls.c:202
C_GetSlotList
CK_RV C_GetSlotList(CK_BBOOL tokenPresent, CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount)
Obtains a list of slots in the system.
Definition: iot_pkcs11_mbedtls.c:1519
pkcs11SLOT_ID
#define pkcs11SLOT_ID
The slot ID to be returned by this PKCS #11 implementation.
Definition: iot_pkcs11_mbedtls.c:147
xP11Context
static P11Struct_t xP11Context
The global PKCS #11 module object. Entropy/randomness and object lists are shared across PKCS #11 ses...
Definition: iot_pkcs11_mbedtls.c:238