Use static args for C_Initialize(), OpenSC does not get a copy of the pointers
This commit is contained in:
@@ -806,12 +806,15 @@ static bool initialize(private_pkcs11_library_t *this, char *name, char *file,
|
|||||||
CK_C_GetFunctionList pC_GetFunctionList;
|
CK_C_GetFunctionList pC_GetFunctionList;
|
||||||
CK_INFO info;
|
CK_INFO info;
|
||||||
CK_RV rv;
|
CK_RV rv;
|
||||||
CK_C_INITIALIZE_ARGS args = {
|
static CK_C_INITIALIZE_ARGS args = {
|
||||||
.CreateMutex = CreateMutex,
|
.CreateMutex = CreateMutex,
|
||||||
.DestroyMutex = DestroyMutex,
|
.DestroyMutex = DestroyMutex,
|
||||||
.LockMutex = LockMutex,
|
.LockMutex = LockMutex,
|
||||||
.UnlockMutex = UnlockMutex,
|
.UnlockMutex = UnlockMutex,
|
||||||
};
|
};
|
||||||
|
static CK_C_INITIALIZE_ARGS args_os = {
|
||||||
|
.flags = CKF_OS_LOCKING_OK,
|
||||||
|
};
|
||||||
|
|
||||||
pC_GetFunctionList = dlsym(this->handle, "C_GetFunctionList");
|
pC_GetFunctionList = dlsym(this->handle, "C_GetFunctionList");
|
||||||
if (!pC_GetFunctionList)
|
if (!pC_GetFunctionList)
|
||||||
@@ -836,9 +839,8 @@ static bool initialize(private_pkcs11_library_t *this, char *name, char *file,
|
|||||||
}
|
}
|
||||||
if (rv == CKR_CANT_LOCK)
|
if (rv == CKR_CANT_LOCK)
|
||||||
{ /* fallback to OS locking */
|
{ /* fallback to OS locking */
|
||||||
memset(&args, 0, sizeof(args));
|
os_locking = TRUE;
|
||||||
args.flags = CKF_OS_LOCKING_OK;
|
rv = this->public.f->C_Initialize(&args_os);
|
||||||
rv = this->public.f->C_Initialize(&args);
|
|
||||||
}
|
}
|
||||||
if (rv != CKR_OK)
|
if (rv != CKR_OK)
|
||||||
{
|
{
|
||||||
@@ -865,7 +867,7 @@ static bool initialize(private_pkcs11_library_t *this, char *name, char *file,
|
|||||||
DBG1(DBG_CFG, " %s: %s v%d.%d",
|
DBG1(DBG_CFG, " %s: %s v%d.%d",
|
||||||
info.manufacturerID, info.libraryDescription,
|
info.manufacturerID, info.libraryDescription,
|
||||||
info.libraryVersion.major, info.libraryVersion.minor);
|
info.libraryVersion.major, info.libraryVersion.minor);
|
||||||
if (args.flags & CKF_OS_LOCKING_OK)
|
if (os_locking)
|
||||||
{
|
{
|
||||||
DBG1(DBG_CFG, " uses OS locking functions");
|
DBG1(DBG_CFG, " uses OS locking functions");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user