pkcs11-tool: ignore CRYPTOKI_ALREADY_INITIALIZED error
https://github.com/OpenSC/OpenSC/pull/118 Print warning and ignore 'Cryptoki library has already been initialized' error returned by C_Initialize().
This commit is contained in:
parent
8e95abf326
commit
a24ecd0733
|
@ -655,7 +655,9 @@ int main(int argc, char * argv[])
|
|||
util_fatal("Failed to load pkcs11 module");
|
||||
|
||||
rv = p11->C_Initialize(NULL);
|
||||
if (rv != CKR_OK)
|
||||
if (rv == CKR_CRYPTOKI_ALREADY_INITIALIZED)
|
||||
printf("\n*** Cryptoki library has already been initialized ***\n");
|
||||
else if (rv != CKR_OK)
|
||||
p11_fatal("C_Initialize", rv);
|
||||
|
||||
if (do_show_info)
|
||||
|
@ -4273,7 +4275,9 @@ static void test_kpgen_certwrite(CK_SLOT_ID slot, CK_SESSION_HANDLE session)
|
|||
util_fatal("Failed to load pkcs11 module");
|
||||
|
||||
rv = p11->C_Initialize(NULL);
|
||||
if (rv != CKR_OK)
|
||||
if (rv == CKR_CRYPTOKI_ALREADY_INITIALIZED)
|
||||
printf("\n*** Cryptoki library has already been initialized ***\n");
|
||||
else if (rv != CKR_OK)
|
||||
p11_fatal("C_Initialize", rv);
|
||||
|
||||
rv = p11->C_OpenSession(opt_slot, CKF_SERIAL_SESSION| CKF_RW_SESSION,
|
||||
|
|
Loading…
Reference in New Issue