I'm having trouble initializing the nss soft token when linking against it
directly. The function _NSSUTIL_EvaluateConfigDir (utilpars.c) is segfaulting
when passing the following initialization arguments to C_Initialize:
CK_CHAR * configString = (unsigned char *)
"configdir='/tmp/' certPrefix='prefix1' keyPrefix='prefix2'
secmod='secmod.db' flags='readonly,forceopen' ";
CK_C_INITIALIZE_ARGS ck_init_args;
ck_init_args.CreateMutex = NULL;
ck_init_args.DestroyMutex = NULL;
ck_init_args.LockMutex = NULL;
ck_init_args.UnlockMutex = NULL;
ck_init_args.flags = CKF_OS_LOCKING_OK;
ck_init_args.LibraryParameters=&configString;
ck_init_args.pReserved=NULL;
I'm building against the ubuntu version: 2:3.15.4-1ubuntu6 on an x86_64 machine.
What is the correct formatting of the LibraryParameters string passed via
CK_C_INITIALIZE_ARGS to C_Initialize?
Here's a backtrace:
Program received signal SIGSEGV, Segmentation fault.
_NSSUTIL_EvaluateConfigDir (configdir=configdir@entry=0x0,
pdbType=pdbType@entry=0x7fffffffdaac, appName=appName@entry=0x7fffffffdab8)
at utilpars.c:1011
1011 if (PORT_Strncmp(configdir, MULTIACCESS, sizeof(MULTIACCESS)-1) ==
0) {
#0 _NSSUTIL_EvaluateConfigDir (configdir=configdir@entry=0x0,
pdbType=pdbType@entry=0x7fffffffdaac, appName=appName@entry=0x7fffffffdab8)
at utilpars.c:1011
dbType = NSS_DB_TYPE_LEGACY
#1 0x00007ffff7bbd337 in sftk_DBInit (configdir=0x0, certPrefix=0x0,
keyPrefix=0x0, updatedir=0x0, updCertPrefix=0x0, updKeyPrefix=0x0,
updateID=updateID@entry=0x0, readOnly=0, noCertDB=0, noKeyDB=0,
forceOpen=0, isFIPS=0, certDB=certDB@entry=0x7fffffffdb70,
keyDB=keyDB@entry=0x7fffffffdb78) at sftkdb.c:2595
confdir = <optimized out>
dbType = NSS_DB_TYPE_NONE
appName = 0x0
keySDB = 0x0
certSDB = 0x7fffffffdaef
crv = 0
flags = 4
newInit = 0
needUpdate = 0
#2 0x00007ffff7ba8552 in SFTK_SlotReInit (slot=slot@entry=0x628590,
configdir=configdir@entry=0x0, updatedir=updatedir@entry=0x0,
updateID=updateID@entry=0x0, params=params@entry=0x60cc98,
moduleIndex=moduleIndex@entry=0) at pkcs11.c:2362
certHandle = 0x0
keyHandle = 0x0
needLogin = 1
crv = <optimized out>
#3 0x00007ffff7ba89d6 in SFTK_SlotInit (configdir=0x0, updatedir=0x0,
updateID=0x0, params=0x60cc98, moduleIndex=moduleIndex@entry=0)
at pkcs11.c:2474
i = <optimized out>
slotID = 2
slot = 0x628590
crv = 2
#4 0x00007ffff7ba94cc in nsc_CommonInitialize (
pReserved=pReserved@entry=0x7fffffffdd80, isFIPS=isFIPS@entry=0)
at pkcs11.c:2905
paramStrings = {configdir = 0x0, updatedir = 0x0, updateID = 0x0,
secmodName = 0x0, man = 0x0, libdes = 0x0, readOnly = 0,
noModDB = 0, noCertDB = 0, forceOpen = 0, pwRequired = 0,
optimizeSpace = 0, tokens = 0x60cc20, token_count = 2}
crv = 0
rv = <optimized out>
init_args = 0x7fffffffdd80
i = 1
moduleIndex = 0
#5 0x00007ffff7ba96ea in NSC_Initialize (pReserved=0x7fffffffdd80)
at pkcs11.c:2967
crv = 140737488345976
pReserved = 0x7fffffffdd80
crv = 140737344142976
#6 0x00000000004013bb in crypto::crypto (this=0x7fffffffdf60, pin=0x0)
at test.cpp:54
ck_rv = 0
slotCount = 1
configString = 0x4022a8 "configdir='/tmp/' certPrefix='prefix1'
keyPrefix='prefix2' secmod='secmod.db' flags='readonly,forceopen' "
ck_init_args = {CreateMutex = 0x0, DestroyMutex = 0x0,
LockMutex = 0x0, UnlockMutex = 0x0, flags = 2,
LibraryParameters = 0x7fffffffdd48, pReserved = 0x0}
slotIds = {<std::_Vector_base<unsigned long, std::allocator<unsigned
long> >> = {
_M_impl = {<std::allocator<unsigned long>> =
{<__gnu_cxx::new_allocator<unsigned long>> = {<No data fields>}, <No data
fields>},
_M_start = 0x7ffff7ffe1c8,
_M_finish = 0x7ffff7de4991 <_dl_lookup_symbol_x+305>,
_M_end_of_storage = 0x0}}, <No data fields>}
#7 0x0000000000401ad8 in main () at test.cpp:129
--
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto