Re: [opensc-devel] OpenSC svn build on Windows rutoken issues - fix
On 4/25/08, Aktiv Co. Aleksey Samsonov [EMAIL PROTECTED] wrote: This is not required. Right, current trunk is already true. So what caused the need to apply this in the first place? Is there an issue to fix? Should I apply the winconfig.h.in fixup? Alon. ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
[opensc-devel] OpenCT SIGSEGV mmap - fix
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1210038592 (LWP 2240)] 0xb7e6e5b4 in memset () from /lib/tls/libc.so.6 (gdb) backtrace #0 0xb7e6e5b4 in memset () from /lib/tls/libc.so.6 #1 0xb7f4c28e in ct_status_alloc_slot (num=0xbffaed24) at status.c:144 #2 0x0804a5ac in main (argc=5, argv=Cannot access memory at address 0x5 ) at ifdhandler.c:119 openct/src/ct/status.c: ct_map_status: 55: addr = mmap(NULL, *size, prot, MAP_SHARED, fd, 0); !!! *size == 0 ct_status_alloc_slot: 108:info = (ct_info_t *) ct_map_status(O_RDWR, size); 109:if (info == NULL) 110:return NULL; !!! Linux-2.6.x: info == -1 // (info == MAP_FAILED) !!! Linux-2.4.x: info == NULL 143:memset(info[*num], 0, sizeof(ct_info_t)); !!! SIGSEGV http://www.opengroup.org/onlinepubs/95399/functions/mmap.html : RETURN VALUE Upon successful completion, the mmap() function shall return the address at which the mapping was placed ( pa); otherwise, it shall return a value of MAP_FAILED and set errno to indicate the error. linux/mm/mmap.c: do_mmap_pgoff: Linux-2.4.36: 414: if (!len) 415: return addr; http://git.kernel.org/?p=linux/kernel/git/wtarreau/linux-2.4.git;a=blob;f=mm/mmap.c;h=536510a249374f4b1cc0753a0dfb4cb44c741eff;hb=89daf14f822d33ecb1ea5681fd968bd6a46cfc8c#l415 Linux-2.6.25: 917: if (!len) 918: return -EINVAL; http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=mm/mmap.c;h=a32d28ce31cda697aff68fdc6c939560096e3a50;hb=4b119e21d0c66c22e8ca03df05d9de623d0eb50f#l918 diff -u -r openct-0.6.14/src/ct/status.c new/openct-0.6.14/src/ct/status.c --- openct-0.6.14/src/ct/status.c 2007-05-26 01:11:46.0 +0400 +++ new/openct-0.6.14/src/ct/status.c 2007-11-08 14:54:54.0 +0300 @@ -53,6 +53,8 @@ prot |= PROT_WRITE; addr = mmap(NULL, *size, prot, MAP_SHARED, fd, 0); + if (addr == MAP_FAILED) + addr = NULL; done:close(fd); return addr; ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC svn build on Windows rutoken issues - fix
On 4/25/08, Aktiv Co. Aleksey Samsonov [EMAIL PROTECTED] wrote: Alon Bar-Lev: So what caused the need to apply this in the first place? I have not looked through change in winconfig.h.in and used http://www.opensc-project.org/opensc/browser/trunk/src/tools/pkcs11-tool.c?rev=3489#L961 as a basis. Oh... I fixed pkcs11-tool Do you sure you not require O_BINARY in rutoken-tool? Alon ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
[opensc-devel] [PATCH] Fix BSD support of USB devices (somewhat)
With attached patch I can use Omnikey CardMan 1021 in DragonFly BSD with ifdhandler. The problem is that you can't open bulk-in endpoint for writing and bulk-out endpoint for reading - AFAICS all BSD's have similar code in their stacks. USB_SET_SHORT_XFER is also required at least in DragonFly. In progress I also fixed header problem with DragonFly and one duplicate line in configure.ac. Polling card status still doesn't work though. Seems that the BSD stack doesn't like this open/close/open/etc dance on interrupt endpoint. Not sure why etc. -- Hasso Tepper Index: configure.ac === --- configure.ac (revision 1032) +++ configure.ac (working copy) @@ -439,7 +439,6 @@ api doc support: ${enable_api_doc} usb support: ${enable_usb} pcsc support:${enable_pcsc} -doc support: ${enable_doc} Host:${host} Compiler:${CC} Index: src/ifd/sys-bsd.c === --- src/ifd/sys-bsd.c (revision 1032) +++ src/ifd/sys-bsd.c (working copy) @@ -13,7 +13,11 @@ #include internal.h #if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #include sys/types.h +#if defined(__DragonFly__) +#include bus/usb/usb.h +#else #include dev/usb/usb.h +#endif #include sys/stat.h #include sys/ioctl.h #include sys/poll.h @@ -91,14 +95,28 @@ int direction = (ep IFD_USB_ENDPOINT_DIR_MASK) == IFD_USB_ENDPOINT_IN ? 1 : 0; int endpoint = (ep ~IFD_USB_ENDPOINT_DIR_MASK); + int one = 1; + int ret; ct_debug(ifd_sysdep_usb_bulk: endpoint=%d direction=%d, endpoint, direction); - if (open_ep(dev-name, 0, endpoint, O_RDWR | O_NONBLOCK)) { + + if (direction) + ret = open_ep(dev-name, 0, endpoint, O_RDONLY | O_NONBLOCK); + else + ret = open_ep(dev-name, 0, endpoint, O_WRONLY | O_NONBLOCK); + + if (ret) { ct_debug(ifd_sysdep_usb_bulk: opening endpoint failed); return -1; } if (direction) { + if (ioctl(interfaces[0][endpoint].ep_fd, USB_SET_SHORT_XFER, + one) 0) { + ifd_debug(6, ifd_sysdep_usb_bulk: USB_SET_SHORT_XFER + failed: %s, strerror(errno)); + ct_error(usb_bulk read failed: %s, strerror(errno)); + } if ((bytes_to_process = read(interfaces[0][endpoint].ep_fd, buffer, len)) 0) { ifd_debug(6, ifd_sysdep_usb_bulk: read failed: %s, ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] openct and ccid-1.10
Hello, Is there a reason why openct supoprt only ccid-1.00? Is it difficult to update it to support newer version? openct only supports 1.00 because that was the spec that was available when I originally wrote the code. I have tried to read the 1.10 spec and see what changed, but I haven't been able to figure it out. Here's a patch I sent to someone that contacted me directly about ccid-1.10 support. It just relaxes the bcdCCID check (and will report proper bcdCCID values in the future) Index: ifd-ccid.c === --- ifd-ccid.c (revision 1029) +++ ifd-ccid.c (working copy) @@ -649,9 +649,9 @@ return -1; } - if (ccid.bcdCCID != 0x100) { + if (ccid.bcdCCID != 0x100 ccid.bcdCCID != 0x110) { ct_error(ccid: unknown ccid version %d.%d, ccid.bcdCCID 8, -ccid.bcdCCID 0xf); +ccid.bcdCCID 0xff); ifd_device_close(dev); return -1; } ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] openct and ccid-1.10
Thanks! I tried this... Does not seem to work. Alon. On 4/25/08, Chaskiel M Grundman [EMAIL PROTECTED] wrote: Hello, Is there a reason why openct supoprt only ccid-1.00? Is it difficult to update it to support newer version? openct only supports 1.00 because that was the spec that was available when I originally wrote the code. I have tried to read the 1.10 spec and see what changed, but I haven't been able to figure it out. Here's a patch I sent to someone that contacted me directly about ccid-1.10 support. It just relaxes the bcdCCID check (and will report proper bcdCCID values in the future) Index: ifd-ccid.c === --- ifd-ccid.c (revision 1029) +++ ifd-ccid.c (working copy) @@ -649,9 +649,9 @@ return -1; } - if (ccid.bcdCCID != 0x100) { + if (ccid.bcdCCID != 0x100 ccid.bcdCCID != 0x110) { ct_error(ccid: unknown ccid version %d.%d, ccid.bcdCCID 8, -ccid.bcdCCID 0xf); +ccid.bcdCCID 0xff); ifd_device_close(dev); return -1; } ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenCT SIGSEGV mmap - fix
On Fri, Apr 25, 2008 at 03:51:59PM +0400, Aktiv Co. Aleksey Samsonov wrote: !!! Linux-2.6.x: info == -1 // (info == MAP_FAILED) !!! Linux-2.4.x: info == NULL Oh yay. addr = mmap(NULL, *size, prot, MAP_SHARED, fd, 0); + if (addr == MAP_FAILED) + addr = NULL; Nice. Thanks! //Peter ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC svn build on Windows rutoken issues - fix
Alon, On Thu, Apr 24, 2008 at 07:43:59PM +0300, Alon Bar-Lev wrote: +++ src/include/winconfig.h.in(working copy) @@ -67,11 +67,17 @@ #endif #ifndef S_IRUSR +#ifdef S_IREAD #define S_IRUSR S_IREAD +#else +#define S_IRUSR _S_IREAD #endif #ifndef S_IWUSR +#ifdef S_IWRITE #define S_IWUSR S_IWRITE +#else +#define S_IWUSR _S_IWRITE #endif I think two #endif:s are missing. //Peter ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] OpenSC svn build on Windows rutoken issues - fix
Thanks. I did not commit this. :) On 4/25/08, Peter Stuge [EMAIL PROTECTED] wrote: Alon, On Thu, Apr 24, 2008 at 07:43:59PM +0300, Alon Bar-Lev wrote: +++ src/include/winconfig.h.in(working copy) @@ -67,11 +67,17 @@ #endif #ifndef S_IRUSR +#ifdef S_IREAD #define S_IRUSR S_IREAD +#else +#define S_IRUSR _S_IREAD #endif #ifndef S_IWUSR +#ifdef S_IWRITE #define S_IWUSR S_IWRITE +#else +#define S_IWUSR _S_IWRITE #endif I think two #endif:s are missing. //Peter ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel
Re: [opensc-devel] openct and ccid-1.10
On 4/25/08, Chaskiel M Grundman [EMAIL PROTECTED] wrote: On Fri, 25 Apr 2008, Alon Bar-Lev wrote: Thanks! I tried this... Does not seem to work. What's your device? What does ifdhandler log? can you dump the usb descriptors and send them? Attached. Look for @ALON. 1. plugin 2. pkcs15-tool --dump I use: Bus 002 Device 055: ID 0dc3:1004 Athena Smartcard Solutions, Inc. Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x0dc3 Athena Smartcard Solutions, Inc. idProduct 0x1004 bcdDevice5.05 iManufacturer 1 Athena iProduct2 ASEDrive CCID iSerial 0 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 93 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 6 ASE016 bmAttributes 0xa0 (Bus Powered) Remote Wakeup MaxPower 100mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 3 bInterfaceClass11 Chip/SmartCard bInterfaceSubClass 0 bInterfaceProtocol 0 iInterface 4 ASEDrive CCID ChipCard Interface Descriptor: bLength54 bDescriptorType33 bcdCCID 1.10 (Warning: Only accurate for version 1.0) nMaxSlotIndex 0 bVoltageSupport 7 5.0V 3.0V 1.8V dwProtocols 3 T=0 T=1 dwDefaultClock 4000 dwMaxiumumClock 4000 bNumClockSupported 0 dwDataRate 10752 bps dwMaxDataRate 33 bps bNumDataRatesSupp. 0 dwMaxIFSD 252 dwSyncProtocols dwMechanical dwFeatures 00010330 Auto clock change Auto baud rate change CCID can set ICC in clock stop mode NAD value other than 0x00 accpeted TPDU level exchange dwMaxCCIDMsgLen 271 bClassGetResponse 00 bClassEnvelope 00 wlcdLayout none bPINSupport 0 bMaxCCIDBusySlots 1 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x81 EP 1 IN bmAttributes3 Transfer TypeInterrupt Synch Type None Usage Type Data wMaxPacketSize 0x0008 1x 8 bytes bInterval 255 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x02 EP 2 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x82 EP 2 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0040 1x 64 bytes bInterval 0 Device Status: 0x (Bus Powered) openct.log.gz Description: GNU Zip compressed data ___ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel