Thanks for your answer!
But in this example (rsa security) it looks like it could be used without a
pointer...or am I wrong?
Example:
CK_INFO info;
CK_RV rv;
CK_C_INITIALIZE_ARGS InitArgs;
InitArgs.CreateMutex = &MyCreateMutex;
InitArgs.DestroyMutex = &MyDestroyMutex;
InitArgs.LockMutex = &MyLockMutex;
InitArgs.UnlockMutex = &MyUnlockMutex;
InitArgs.flags = CKF_OS_LOCKING_OK;
InitArgs.pReserved = NULL_PTR;
rv = C_Initialize((CK_VOID_PTR)&InitArgs);
assert(rv == CKR_OK);
rv = C_GetInfo(&info);
assert(rv == CKR_OK);
if(info.version.major == 2) {
/* Do lots of interesting cryptographic things with the token */
.
.
.
}
rv = C_Finalize(NULL_PTR);
assert(rv == CKR_OK);
Nelson B wrote:
> Carla Schaffner wrote:
>
>> To test cryptoki / access to smart card we have the code below.
>> Does anyone know why the function C_Initialize from the cryptoki header
>> file is not accessible?
> [snip]
>> ----------- Error---------------------
>> ReadCert.c: In function `main':
>> /tmp/ccvfY2Ep.o(.text+0x16): In function `main':
>> : undefined reference to `C_Initialize'
>> /tmp/ccvfY2Ep.o(.text+0x3c): In function `main':
>> : undefined reference to `C_Finalize'
>
> I'm not familiar with opensc's header files, but as I recall, in PKCS11
> v2.0 and later, C_Initialize is the name of a pointer to a function.
> That pointer is a member of struct CK_FUNCTION_LIST. You get the module's
> function list pointer by calling C_GetFunctionList. Then you call the
> other C_* function through the pointers in that table. C_GetFunctionList
> is often the only function exported directly from a PKCS11 v2.x module.
>