OpenSC не видит токена при использовании opensc-pkcs11.so

Добрый день!

Подскажите пожалуйста в чем дело, почему с одной библиотекой токен виден, а с другой нет?

Исходные данные:
RuToken ECP (Card ATR: 3B 8B 01 52 75 74 6F 6B 65 6E 20 44 53 20 C1)
SlackWare 2.2.0: Linux 2.6.33.2 #2 Thu Apr 22 01:09:42 MSD 2010 i686 Pentium III (Coppermine) GenuineIntel
Софт: OpenSC-0.12.2 + pcsc-lite-1.8.3 + ccid-1.4.6
Параметры сборки:
OpenSC-0.12.2: ./configure --prefix=/usr --sysconfdir=/etc --enable-pcsc --disable-openct --localstatedir=/var
pcsc-lite-1.8.3: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-usbdropdir=/usr/lib/pcsc/drivers --enable-ipcdir=/var/run/pcscd --disable-libudev
ccid-1.4.6: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-usbdropdir=/usr/lib/pcsc/drivers
Дополнительно есть библиотека librtpkcs11ecp.so

Запускаю pcscd
root@shaft:/etc# pcscd -a -f -T --debug

00000000 debuglog.c:269:DebugLogSetLevel() debug level=debug
00000681 configfile.l:298:DBGetReaderList() Parsing conf file: /etc/reader.conf.d
00000081 pcscdaemon.c:518:main() pcsc-lite 1.8.3 daemon ready.
00008264 hotplug_libusb.c:514:HPAddHotPluggable() Adding USB device: 1:17:0
00000107 readerfactory.c:936:RFInitializeReader() Attempting startup of Aktiv Rutoken ECP 00 00 using /usr/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so
00000407 readerfactory.c:826:RFBindFunctions() Loading IFD Handler 3.0
00000180 ifdhandler.c:1768:init_driver() Driver version: 1.4.6
00003686 ifdhandler.c:1785:init_driver() LogLevel: 0x0003
00000057 ifdhandler.c:1796:init_driver() DriverOptions: 0x0000
00000677 ifdhandler.c:83:CreateChannelByNameOrChannel() Lun: 0, device: usb:0a89/0030:libusb-1.0:1:17:0
00003385 ccid_usb.c:245:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau@free.fr)
00000065 ccid_usb.c:246:OpenUSBByName() ifdProductString: Generic CCID driver
00000040 ccid_usb.c:247:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later
00002419 ccid_usb.c:509:OpenUSBByName() Found Vendor/Product: 0A89/0030 (Aktiv Rutoken ECP)
00000053 ccid_usb.c:511:OpenUSBByName() Using USB bus/device: 1/17
00002151 ccid_usb.c:1042:ControlUSB() control failed (1/17): -9 Success
00000036 ccid_usb.c:973:get_data_rates() IFD does not support GET_DATA_RATES request: -9
00005926 ifdhandler.c:353:IFDHGetCapabilities() tag: 0xFB3, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000056 readerfactory.c:291:RFAddReader() Using the pcscd polling thread
00002025 ifdhandler.c:353:IFDHGetCapabilities() tag: 0xFAE, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000040 ifdhandler.c:441:IFDHGetCapabilities() Reader supports 1 slot(s)
00000123 readerfactory.c:1303:RFWaitForReaderInit() Waiting init for reader: Aktiv Rutoken ECP 00 00
00000060 hotplug_libusb.c:421:HPEstablishUSBNotifications() Driver ifd-ccid.bundle does not support IFD_GENERATE_HOTPLUG. Using active polling instead.
00000037 hotplug_libusb.c:430:HPEstablishUSBNotifications() Polling forced every 1 second(s)
00003625 ifdhandler.c:1114:IFDHPowerICC() action: PowerUp, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00002050 eventhandler.c:256:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00000060 Card ATR: 3B 8B 01 52 75 74 6F 6B 65 6E 20 44 53 20 C1
00405831 ifdhandler.c:1114:IFDHPowerICC() action: PowerDown, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00002012 eventhandler.c:446:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED


root@shaft:~# pkcs11-tool --module ./librtpkcs11ecp.so -I
Cryptoki version 2.20
Manufacturer     Aktiv Co.
Library          Rutoken ECP PKCS #11 library (ver 1.0)
Using slot 0 with a present token (0x0)
root@shaft:~#

Дебаг pcscd во время выполнения команды:

62912733 winscard_msg_srv.c:230:ProcessEventsServer() Common channel packet arrival
00000092 winscard_msg_srv.c:242:ProcessEventsServer() ProcessCommonChannelRequest detects: 4
00000032 pcscdaemon.c:93:SVCServiceRunLoop() A new context thread creation is requested: 4
00000280 winscard_svc.c:297:ContextThread() Thread is started: dwClientID=4, threadContext @0x8078698
00000074 winscard_svc.c:315:ContextThread() Received command: CMD_VERSION from client 4
00000054 winscard_svc.c:327:ContextThread() Client is protocol version 4:2
00000033 winscard_svc.c:347:ContextThread() CMD_VERSION rv=0x0 for client 4
00000172 winscard_svc.c:315:ContextThread() Received command: ESTABLISH_CONTEXT from client 4
00000112 winscard.c:193:SCardEstablishContext() Establishing Context: 0x10320ED
00000033 winscard_svc.c:408:ContextThread() ESTABLISH_CONTEXT rv=0x0 for client 4
00000144 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000115 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000467 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000111 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000220 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000058 winscard.c:235:SCardConnect() Attempting Connect to Aktiv Rutoken ECP 00 00 using protocol: 3
00002733 ifdhandler.c:1114:IFDHPowerICC() action: PowerUp, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00001804 winscard.c:309:SCardConnect() power up complete.
00000050 Card ATR: 3B 8B 01 52 75 74 6F 6B 65 6E 20 44 53 20 C1
00000029 winscard.c:328:SCardConnect() powerState: POWER_STATE_INUSE
00000047 prothandler.c:87:PHSetProtocol() Attempting PTS to T=1
00000035 ifdhandler.c:663:IFDHSetProtocolParameters() protocol T=1, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000055 winscard.c:402:SCardConnect() Active Protocol: T=1
00000400 winscard.c:422:SCardConnect() hCard Identity: 13dc0
00000062 winscard_svc.c:449:ContextThread() CONNECT rv=0x0 for client 4
00000343 winscard_svc.c:315:ContextThread() Received command: BEGIN_TRANSACTION from client 4
00000069 winscard.c:1051:SCardBeginTransaction() Status: 0x00000000
00000032 winscard_svc.c:501:ContextThread() BEGIN_TRANSACTION rv=0x0 for client 4
00000112 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000118 winscard_svc.c:315:ContextThread() Received command: STATUS from client 4
00000058 winscard_svc.c:557:ContextThread() STATUS rv=0x0 for client 4
00000153 winscard_svc.c:315:ContextThread() Received command: GET_ATTRIB from client 4
00000066 ifdhandler.c:353:IFDHGetCapabilities() tag: 0x90303, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000037 winscard_svc.c:677:ContextThread() GET_ATTRIB rv=0x0 for client 4
00000123 winscard_svc.c:315:ContextThread() Received command: END_TRANSACTION from client 4
00000060 winscard.c:1188:SCardEndTransaction() Status: 0x00000000
00000031 winscard_svc.c:517:ContextThread() END_TRANSACTION rv=0x0 for client 4
00010482 winscard_svc.c:315:ContextThread() Received command: DISCONNECT from client 4
00000073 winscard.c:820:SCardDisconnect() Active Contexts: 1
00000031 winscard.c:821:SCardDisconnect() dwDisposition: 0
00000035 winscard.c:986:SCardDisconnect() powerState: POWER_STATE_GRACE_PERIOD
00000034 ifdhandler.c:353:IFDHGetCapabilities() tag: 0xFB2, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000036 winscard_svc.c:486:ContextThread() DISCONNECT rv=0x0 for client 4
00000142 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000110 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000174 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000056 winscard.c:235:SCardConnect() Attempting Connect to Aktiv Rutoken ECP 00 00 using protocol: 3
00000033 winscard.c:328:SCardConnect() powerState: POWER_STATE_INUSE
00000029 winscard.c:402:SCardConnect() Active Protocol: T=1
00000032 winscard.c:422:SCardConnect() hCard Identity: 17691
00000036 winscard_svc.c:449:ContextThread() CONNECT rv=0x0 for client 4
00000110 winscard_svc.c:315:ContextThread() Received command: BEGIN_TRANSACTION from client 4
00000059 winscard.c:1051:SCardBeginTransaction() Status: 0x00000000
00000031 winscard_svc.c:501:ContextThread() BEGIN_TRANSACTION rv=0x0 for client 4
00000095 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000102 winscard_svc.c:315:ContextThread() Received command: STATUS from client 4
00000057 winscard_svc.c:557:ContextThread() STATUS rv=0x0 for client 4
00000130 winscard_svc.c:315:ContextThread() Received command: END_TRANSACTION from client 4
00000057 winscard.c:1188:SCardEndTransaction() Status: 0x00000000
00000031 winscard_svc.c:517:ContextThread() END_TRANSACTION rv=0x0 for client 4
00010489 winscard_svc.c:315:ContextThread() Received command: DISCONNECT from client 4
00000071 winscard.c:820:SCardDisconnect() Active Contexts: 1
00000030 winscard.c:821:SCardDisconnect() dwDisposition: 0
00000033 winscard.c:986:SCardDisconnect() powerState: POWER_STATE_GRACE_PERIOD
00000035 ifdhandler.c:353:IFDHGetCapabilities() tag: 0xFB2, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000035 winscard_svc.c:486:ContextThread() DISCONNECT rv=0x0 for client 4
00000107 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000110 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000170 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000055 winscard.c:235:SCardConnect() Attempting Connect to Aktiv Rutoken ECP 00 00 using protocol: 3
00000033 winscard.c:328:SCardConnect() powerState: POWER_STATE_INUSE
00000029 winscard.c:402:SCardConnect() Active Protocol: T=1
00000033 winscard.c:422:SCardConnect() hCard Identity: 14f47
00000035 winscard_svc.c:449:ContextThread() CONNECT rv=0x0 for client 4
00000209 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000104 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000155 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000101 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000136 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000057 winscard.c:235:SCardConnect() Attempting Connect to  using protocol: 3
00000030 winscard.c:241:SCardConnect() Reader  Not Found
00000029 winscard_svc.c:449:ContextThread() CONNECT rv=0x80100009 for client 4
00000182 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000104 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000135 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000101 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000137 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000054 winscard.c:235:SCardConnect() Attempting Connect to  using protocol: 3
00000030 winscard.c:241:SCardConnect() Reader  Not Found
00000029 winscard_svc.c:449:ContextThread() CONNECT rv=0x80100009 for client 4
00000172 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000103 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000139 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000101 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000135 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000055 winscard.c:235:SCardConnect() Attempting Connect to  using protocol: 3
00000030 winscard.c:241:SCardConnect() Reader  Not Found
00000029 winscard_svc.c:449:ContextThread() CONNECT rv=0x80100009 for client 4
00000174 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000101 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000137 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000100 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000136 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000055 winscard.c:235:SCardConnect() Attempting Connect to  using protocol: 3
00000031 winscard.c:241:SCardConnect() Reader  Not Found
00001052 winscard_svc.c:449:ContextThread() CONNECT rv=0x80100009 for client 4
00000712 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000121 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000150 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000308 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000157 winscard_svc.c:315:ContextThread() Received command: CONNECT from client 4
00000058 winscard.c:235:SCardConnect() Attempting Connect to Aktiv Rutoken ECP 00 00 using protocol: 3
00000034 winscard.c:328:SCardConnect() powerState: POWER_STATE_INUSE
00000030 winscard.c:402:SCardConnect() Active Protocol: T=1
00000035 winscard.c:422:SCardConnect() hCard Identity: 19544
00000042 winscard_svc.c:449:ContextThread() CONNECT rv=0x0 for client 4
00000112 winscard_svc.c:315:ContextThread() Received command: BEGIN_TRANSACTION from client 4
00000061 winscard.c:1051:SCardBeginTransaction() Status: 0x00000000
00000032 winscard_svc.c:501:ContextThread() BEGIN_TRANSACTION rv=0x0 for client 4
00000093 winscard_svc.c:315:ContextThread() Received command: CMD_GET_READERS_STATE from client 4
00000103 winscard_svc.c:315:ContextThread() Received command: STATUS from client 4
00000057 winscard_svc.c:557:ContextThread() STATUS rv=0x0 for client 4
00000110 winscard_svc.c:315:ContextThread() Received command: GET_ATTRIB from client 4
00000064 ifdhandler.c:353:IFDHGetCapabilities() tag: 0x90303, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000037 winscard_svc.c:677:ContextThread() GET_ATTRIB rv=0x0 for client 4
00000104 winscard_svc.c:315:ContextThread() Received command: END_TRANSACTION from client 4
00000059 winscard.c:1188:SCardEndTransaction() Status: 0x00000000
00000030 winscard_svc.c:517:ContextThread() END_TRANSACTION rv=0x0 for client 4
00004597 winscard_svc.c:315:ContextThread() Received command: DISCONNECT from client 4
00000077 winscard.c:820:SCardDisconnect() Active Contexts: 2
00000030 winscard.c:821:SCardDisconnect() dwDisposition: 0
00000039 winscard_svc.c:486:ContextThread() DISCONNECT rv=0x0 for client 4
00105220 winscard_svc.c:315:ContextThread() Received command: RELEASE_CONTEXT from client 4
00000071 winscard.c:204:SCardReleaseContext() Releasing Context: 0x10320ED
00000044 winscard.c:820:SCardDisconnect() Active Contexts: 1
00000028 winscard.c:821:SCardDisconnect() dwDisposition: 0
00000031 winscard.c:986:SCardDisconnect() powerState: POWER_STATE_GRACE_PERIOD
00000035 ifdhandler.c:353:IFDHGetCapabilities() tag: 0xFB2, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00000038 winscard_svc.c:423:ContextThread() RELEASE_CONTEXT rv=0x0 for client 4
00001719 winscard_svc.c:307:ContextThread() Client die: 4
00000072 winscard_svc.c:918:MSGCleanupClient() Thread is stopping: dwClientID=4, threadContext @0x8078698
00000032 winscard_svc.c:924:MSGCleanupClient() Freeing SCONTEXT @0x8078698
00368508 eventhandler.c:458:EHStatusHandlerThread() powerState: POWER_STATE_POWERED
00406553 ifdhandler.c:1114:IFDHPowerICC() action: PowerDown, usb:0a89/0030:libusb-1.0:1:17:0 (lun: 0)
00002108 eventhandler.c:446:EHStatusHandlerThread() powerState: POWER_STATE_UNPOWERED

Перестартовываю pcscd  с теми-же параметрами, запускаю
root@shaft:~# pkcs11-tool --module /usr/lib/opensc-pkcs11.so -I
Cryptoki version 2.20
Manufacturer     OpenSC (www.opensc-project.org)
Library          Smart card PKCS#11 API (ver 0.0)
No slot with a token was found.
Segmentation fault
root@shaft:~#

Во время выполнения команды pcscd не выводит никакой информации вообще.

в opensc.conf debug установлен в 9

содержимое лога для 1-й и второй попыток

0xb75006c0 15:38:53.351 [opensc-pkcs11] ctx.c:659:sc_context_create: ===================================
0xb75006c0 15:38:53.352 [opensc-pkcs11] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb75006c0 15:38:53.352 [opensc-pkcs11] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb75006c0 15:38:53.353 [opensc-pkcs11] reader-pcsc.c:870:pcsc_detect_readers: called
0xb75006c0 15:38:53.353 [opensc-pkcs11] reader-pcsc.c:1023:pcsc_detect_readers: returning with: -1101 (No readers found)
0xb75006c0 15:38:53.353 [opensc-pkcs11] misc.c:323:load_pkcs11_parameters: PKCS#11 options: plug_and_play=1 max_virtual_slots=16 slots_per_card=4 hide_empty_tokens=1 lock_login=0 pin_unblock_style=0 zero_ckaid_for_ca_certs=0
0xb75006c0 15:38:53.353 [opensc-pkcs11] slot.c:90:create_slot: Creating slot with id 0x0
0xb75006c0 15:38:53.353 [opensc-pkcs11] pkcs11-global.c:259:C_Initialize: C_Initialize() = CKR_OK
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:375:C_GetSlotList: C_GetSlotList(token=0, plug-n-play)
0xb75006c0 15:38:53.354 [opensc-pkcs11] reader-pcsc.c:870:pcsc_detect_readers: called
0xb75006c0 15:38:53.354 [opensc-pkcs11] reader-pcsc.c:1023:pcsc_detect_readers: returning with: -1101 (No readers found)
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:411:C_GetSlotList: was only a size inquiry (1)
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:375:C_GetSlotList: C_GetSlotList(token=0, refresh)
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:428:C_GetSlotList: returned 1 slots
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:479:C_GetSlotInfo: C_GetSlotInfo(0xffffffff)
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:501:C_GetSlotInfo: C_GetSlotInfo(0xffffffff) = CKR_OK
0xb75006c0 15:38:53.354 [opensc-pkcs11] pkcs11-global.c:290:C_Finalize: C_Finalize()
0xb75006c0 15:38:53.354 [opensc-pkcs11] ctx.c:714:sc_cancel: called
0xb75006c0 15:38:53.354 [opensc-pkcs11] reader-pcsc.c:591:pcsc_cancel: called
0xb735a6c0 15:45:26.419 [opensc-pkcs11] ctx.c:659:sc_context_create: ===================================
0xb735a6c0 15:45:26.419 [opensc-pkcs11] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb735a6c0 15:45:26.419 [opensc-pkcs11] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb735a6c0 15:45:26.420 [opensc-pkcs11] reader-pcsc.c:870:pcsc_detect_readers: called
0xb735a6c0 15:45:26.421 [opensc-pkcs11] reader-pcsc.c:1023:pcsc_detect_readers: returning with: -1101 (No readers found)
0xb735a6c0 15:45:26.421 [opensc-pkcs11] misc.c:323:load_pkcs11_parameters: PKCS#11 options: plug_and_play=1 max_virtual_slots=16 slots_per_card=4 hide_empty_tokens=1 lock_login=0 pin_unblock_style=0 zero_ckaid_for_ca_certs=0
0xb735a6c0 15:45:26.421 [opensc-pkcs11] slot.c:90:create_slot: Creating slot with id 0x0
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:259:C_Initialize: C_Initialize() = CKR_OK
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:329:C_GetInfo: C_GetInfo()
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:375:C_GetSlotList: C_GetSlotList(token=0, plug-n-play)
0xb735a6c0 15:45:26.421 [opensc-pkcs11] reader-pcsc.c:870:pcsc_detect_readers: called
0xb735a6c0 15:45:26.421 [opensc-pkcs11] reader-pcsc.c:1023:pcsc_detect_readers: returning with: -1101 (No readers found)
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:411:C_GetSlotList: was only a size inquiry (1)
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:375:C_GetSlotList: C_GetSlotList(token=0, refresh)
0xb735a6c0 15:45:26.421 [opensc-pkcs11] pkcs11-global.c:428:C_GetSlotList: returned 1 slots
0xb735a6c0 15:45:26.422 [opensc-pkcs11] pkcs11-global.c:479:C_GetSlotInfo: C_GetSlotInfo(0xffffffff)
0xb735a6c0 15:45:26.422 [opensc-pkcs11] pkcs11-global.c:501:C_GetSlotInfo: C_GetSlotInfo(0xffffffff) = CKR_OK
0xb735a6c0 15:45:26.422 [opensc-pkcs11] pkcs11-global.c:290:C_Finalize: C_Finalize()
0xb735a6c0 15:45:26.422 [opensc-pkcs11] ctx.c:714:sc_cancel: called
0xb735a6c0 15:45:26.422 [opensc-pkcs11] reader-pcsc.c:591:pcsc_cancel: called

Подскажите пожалуйста в чем дело, почему с одной библиотекой токен виден, а с другой нет?

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Здравствуйте.
Это похоже на особенности работы библиотеки в вашем дистрибутиве. В Ubuntu 12.04 та же версия OpenSC работает нормально.
А pkcs11-tool на всех операциях с использованием opensc-pkcs11.so падает с сегфолтом?

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Как я понимаю это должно быть связано с версиями окружения (ядро, libc и т.п.). Нет ли у Вас информации в каком окружении точно работает связка OpenSC-0.12.2 + pcsc-lite-1.8.3 + ccid-1.4.6, или какой набор версий OpenSС pcsc-lite ccid работает у Вас и в каком окружении с использованием библиотеки opensc-pkcs11.so без ошибок.

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Во-первых, тут возможно влияет pcsc-lite версии 1.8.3 - не зря его не стали включать в новую Ubuntu, там сейчас 1.7.4. Если есть возможность, то не мешало бы попробовать на старой версии.
По поводу окружения: основной дистрибутив у нас Ubuntu, в ней таких проблем не было на всех релизах с 10.04 по 12.04. Обычно поступаем так: берется pcsc-lite и libccid из репозитория, а OpenSC собирается из исходного кода (обычно версии 0.12.2).
Сейчас на мой взгляд самая стабильная конфигурация такова:

  • opensc 0.12.2

  • pcscd 1.7.4

  • libccid 1.4.5

Да, чтобы увидеть больше информации от pcscd, его лучше запускать так:

$ pcscd -afdddd

В этом случае можно видеть, как он обращается к токену при работе с библиотекой.

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Попробовал в предлагаемой конфигурации opensc 0.12.2 + pcscd 1.7.4 + libccid 1.4.5

Тоже самое, а до pcscd дело не доходит падает на библиотеке libopensc.so.3.0.0
dmesg | grep pkcs11-tool
pkcs11-tool[18553]: segfault at 4 ip b7612da9 sp bfadff20 error 4 in libopensc.so.3.0.0[b75e3000+fa000]
pkcs11-tool[18554]: segfault at 4 ip b75cdda9 sp bf819fe0 error 4 in libopensc.so.3.0.0[b759e000+fa000]
pkcs11-tool[18827]: segfault at 4 ip b74cbda9 sp bfeb75f0 error 4 in libopensc.so.3.0.0[b749c000+fa000]
pkcs11-tool[19388]: segfault at 4 ip b7597da9 sp bfd8ae10 error 4 in libopensc.so.3.0.0[b7568000+fa000]


Но дело даже может быть не в этом, меня удивляет почему в логах сообщение -1101 (No readers found), может быть я как-то не так собрал opensc, хотя куда уж проще:
./configure --prefix=/usr --sysconfdir=/etc --enable-pcsc --disable-openct --localstatedir=/var;make;make install;

Запустил
root@shaft:/etc# pcscd -afdddd

дал команду
root@shaft:~# opensc-tool -a
No smart card readers found.

в логах

0xb735c6c0 12:59:26.066 [opensc-tool] ctx.c:659:sc_context_create: ===================================
0xb735c6c0 12:59:26.066 [opensc-tool] ctx.c:660:sc_context_create: opensc version: 0.12.2
0xb735c6c0 12:59:26.066 [opensc-tool] reader-pcsc.c:657:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1
0xb735c6c0 12:59:26.068 [opensc-tool] reader-pcsc.c:870:pcsc_detect_readers: called
0xb735c6c0 12:59:26.068 [opensc-tool] reader-pcsc.c:1023:pcsc_detect_readers: returning with: -1101 (No readers found)
0xb735c6c0 12:59:26.068 [opensc-tool] ctx.c:737:sc_release_context: called
0xb735c6c0 12:59:26.068 [opensc-tool] reader-pcsc.c:736:pcsc_finish: called

Тоесть opensc всетаки успевает понять что ридера нет, причем происходит это следующим образом:

static int pcsc_detect_readers(sc_context_t *ctx)
{
        struct pcsc_global_private_data *gpriv = (struct pcsc_global_private_data *) ctx->reader_drv_data;
        DWORD active_proto, reader_buf_size = 0;
        SCARDHANDLE card_handle;
        LONG rv;
        char *reader_buf = NULL, *reader_name;
        const char *mszGroups = NULL;
        int ret = SC_ERROR_INTERNAL;

        SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); //строка 870

        if (!gpriv) {
                /* FIXME: this is not the correct error */
                ret = SC_ERROR_NO_READERS_FOUND;  //строка 1023
                goto out;
        }
...........................................
out:

        if (reader_buf != NULL)
                free (reader_buf);

        SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, ret);
}

То есть функция на входе получает структуру с указателем на reader_drv_data который (указатель) не инициализирован.

Может быть у Вас есть какие-нибудь идеи относительно такого положения дел?
Нет ли у Вас информации чем и где должна заполняться структура reader_drv_data?

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Сходу про внутренности OpenSC не скажу, а что при таком вызове говорит pcscd? Советую использовать команду opensc-tool -l, которая как раз выводит список считывателей. Мне сейчас кажется, что opensc не может добраться до pcscd.

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Мне, тоже, но только я не могу понять причину по которой он не видит его:

root@shaft:~# opensc-tool -l
No smart card readers found.
root@shaft:~#

А pcscd молчит, вообще ничего не выводит

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Manul пишет:

А pcscd молчит, вообще ничего не выводит

В этом и проблема. Он весьма много дебажной информации выводить должен. Выходит, OpenSC даже не пытается его вызвать.

Здесь я могу посоветовать вычистить все по-максимуму, включая конфиги, а затем заново поставить pcscd и opensc. OpenSC я обычно собираю с такими параметрами:

$ ./configure --prefix=/usr

остальное по умолчанию.

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Пробовал, не помогает, однако добавил дебажной информации в код reader-pcsc.c, получилась следующая штука:

0xb74626c0 18:02:48.591 [opensc-tool] reader-pcsc.c:658:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 provider_library=/usr/lib/pkcs11/opensc-pkcs11.so

0xb74626c0 18:02:48.592 [opensc-tool] reader-pcsc.c:716:pcsc_init: Can't load apropriate pkcs11 functins: liSCardReleaseContext=0, SCardConnect=0, SCardReconnect=0, SCardDisconnect=0, SCardBeginTransaction=0, SCardEndTransaction=0, SCardStatus=0, SCardGetStatusChange=0, SCardCancel=0, SCardControl=0, SCardControlOLD=0, SCardTransmit=0, SCardListReaders=0

pcsc_init не может найти соответствующие функции, вместо нулей должны быть указатели на функции, как я понимаю это интерфейсные функции библиотеки. А теперь интересный фокус:

root@shaft:~# for i in SCardReleaseContext SCardConnect SCardReconnect SCardDisconnect SCardBeginTransaction SCardEndTransaction SCardStatus SCardGetStatusChange SCardCancel SCardControl SCardControlOLD SCardTransmit SCardListReaders; do grep $i librtpkcs11ecp.so; done;
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Binary file librtpkcs11ecp.so matches
Press any key to continue...


root@shaft:/usr/lib# for i in SCardReleaseContext SCardConnect SCardReconnect SCardDisconnect SCardBeginTransaction SCardEndTransaction SCardStatus SCardGetStatusChange SCardCancel SCardControl SCardControlOLD SCardTransmit SCardListReaders; do grep $i opensc-pkcs11.so; done;
Press any key to continue...

В библиотеке opensc-pkcs11.so нет ни одной функции стандарта PC/SC, значит криво собралось?

Странно как-то все это, более того идем в исходники opensc-0.12.2/src/pkcs11
root@shaft:opensc-0.12.2/src/pkcs11# egrep -r "SCardReleaseContext|SCardConnect|SCardReconnect|SCardDisconnect|SCardBeginTransaction|SCardEndTransaction|SCardStatus|SCardGetStatusChange|SCardCancel|SCardControl|SCardControlOLD|SCardTransmit|SCardListReaders" *
pkcs11-global.c:        /* FIXME: add proper checking into build to check correct pcsc-lite version for SCardStatusChange/SCardCancel */
root@shaft:opensc-0.12.2/src/pkcs11#

Я вообще не понимаю, где функции ...

Берем библиотеку из виндов, функции есть, берем из 5-го RHEL функций нет

Очищаем конфиг /etc/opensc.conf, смотрим в лог

0xb743f6c0 20:01:02.933 [opensc-tool] reader-pcsc.c:658:pcsc_init: PC/SC options: connect_exclusive=0 disconnect_action=1 transaction_end_action=0 reconnect_action=0 enable_pinpad=1 provider_library=libpcsclite.so.1

в качестве провайдера используется библиотека libpcsclite.so.1

Моя ошибка была в том что модуль, который указывается pkcs11-tool --module ... я счел провайдером pkcs11 указываемым в /etc/opensc.conf, однако что-же такое --module?

Re: OpenSC не видит токена при использовании opensc-pkcs11.so

Провайдер pkcs11 не указывается в конфигурации opensc, там под провайдером понимается библиотека pcsc-lite.
А параметр --module действительно задает путь к библиотеке PKCS#11.

Все функции по работе со смарт-картами как раз живут в libpcsclite.so, в opensc-pkcs11.so им делать нечего.