Ticket #181 (new defect)

Opened 2 months ago

Last modified 2 months ago

pkcs11 C_GetMechanismList segfaults if not card in slot

Reported by: dengert Owned by: opensc-devel@…
Priority: normal Milestone:
Component: opensc Version: trunk
Severity: normal Keywords:
Cc:

Description

I am trying to use opensc-pkcs11.so on Solaris 10, as a plugin for the Solaris 10 /usr/lib/libpkcs11.so. This is done using the the cryptoadm install command.

The cryptoadm list -v will try and call the C_GetMechanismList for every slot. If there is no card in the slot, opensc-pkcs11 may segfault.

The attached patch gets around this.

Attachments

opensc.mechanism.patch (404 bytes) - added by dengert 2 months ago.
patch to src/pkcs11/mechanism.c

Change History

Changed 2 months ago by dengert

patch to src/pkcs11/mechanism.c

Changed 2 months ago by ludovic

You should have a CKR_TOKEN_NOT_PRESENT error instead.

C_GetMechanismList() first calls the internal function slot_get_token() and do not call sc_pkcs11_get_mechanism_list() if slot_get_token() fails (as it should if not card is present).

What version of OpenSC are you using?

I think the problem is elsewhere. What is the result of C_GetTokenInfo() with no card in the slot?

Note: See TracTickets for help on using tickets.