From 3d895c8b7cc1b09de00a9bf78a408097f94de9a7 Mon Sep 17 00:00:00 2001 From: Ludovic Rousseau Date: Mon, 30 Aug 2021 11:27:00 +0200 Subject: [PATCH] New upstream version 1.4.36 --- ChangeLog | 102 +++++++++++++++++++++++++++++++++- README.md | 9 +++ configure | 20 +++---- configure.ac | 2 +- readers/supported_readers.txt | 9 ++- src/ccid.c | 22 ++++---- src/ccid_serial.c | 16 +++--- src/commands.c | 64 ++++++++++----------- src/debug.c | 20 +++---- src/ifdhandler.c | 38 ++++++------- src/parse.c | 43 +++++++------- src/utils.c | 20 +++---- 12 files changed, 240 insertions(+), 125 deletions(-) diff --git a/ChangeLog b/ChangeLog index 53fa625..6451316 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,100 @@ -commit c0c84311c47fcae11ab34ec7b1f70f9518e37931 (HEAD -> master, zotac/master) +commit 74642f87f9e1a937e807acd3a7d2ef600b8d151c (HEAD -> master, zotac/master, origin/master, origin/HEAD) +Author: Ludovic Rousseau +Date: Mon Aug 30 11:14:49 2021 +0200 + + Release 1.4.36 + + Signed-off-by: Ludovic Rousseau + + README.md | 9 +++++++++ + configure.ac | 2 +- + 2 files changed, 10 insertions(+), 1 deletion(-) + +commit abaca4dd1403c0962afb1f24ca80638f7f091d80 +Author: Ludovic Rousseau +Date: Mon Aug 30 10:28:19 2021 +0200 + + Add SafeNet eToken 5110+ FIPS + + readers/SafeNet_eToken_5110+_FIPS.txt | 97 +++++++++++++++++++++++++++++++++++ + readers/supported_readers.txt | 3 +- + 2 files changed, 99 insertions(+), 1 deletion(-) + +commit 3bb2c30d05d8f883e17f82a03a59a19c14df858d +Author: Ludovic Rousseau +Date: Thu Aug 26 18:59:10 2021 +0200 + + Add SafeNet eToken 5300 C + + readers/SafeNet_eToken_5300_C.txt | 97 +++++++++++++++++++++++++++++++++++++++ + readers/supported_readers.txt | 3 +- + 2 files changed, 99 insertions(+), 1 deletion(-) + +commit 36213a896116b3472868565cb8f55beacd2d5dfb +Author: Ludovic Rousseau +Date: Thu Aug 26 11:49:30 2021 +0200 + + parse: fix check when bNumDataRatesSupported = 0 + + If bNumDataRatesSupported is zero then we should accept the returned + size and do not expect 256 values (maximum value). + + The fix removes the message: + Got 50 data rates but was expecting 256 + when the token declares bNumDataRatesSupported = 0 and returns 50 value. + + src/parse.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +commit 5881da0965ba78eb2010b28c9d5d380e1672a307 +Author: Ludovic Rousseau +Date: Sat Aug 7 22:38:40 2021 +0200 + + Add REINER SCT tanJack USB + + readers/ReinerSCT_tanJack_USB.txt | 53 +++++++++++++++++++++++++++++++++++++++ + readers/supported_readers.txt | 3 ++- + 2 files changed, 55 insertions(+), 1 deletion(-) + +commit 48cec5bcdf12092c30110582baf0469c779a50f1 +Author: Ludovic Rousseau +Date: Fri Jul 30 18:53:34 2021 +0200 + + Code reformat: replace 4 spaces by 1 tab + + Thanks to Godfrey Chung for the bug report + https://github.com/LudovicRousseau/CCID/commit/2c600f55b351f524c27511e3303db690df41abca + + src/ccid.c | 22 +++++++++---------- + src/ccid_serial.c | 18 ++++++++-------- + src/commands.c | 64 +++++++++++++++++++++++++++---------------------------- + src/debug.c | 24 ++++++++++----------- + src/ifdhandler.c | 38 ++++++++++++++++----------------- + src/parse.c | 36 +++++++++++++++---------------- + src/utils.c | 24 ++++++++++----------- + 7 files changed, 113 insertions(+), 113 deletions(-) + +commit 38fc829a72cc42e53126e11a8bdb6c0081d7383f +Author: Ludovic Rousseau +Date: Fri Jul 30 18:31:14 2021 +0200 + + Add jSolutions s.r.o. Multi SIM card reader 4/8 + + readers/jSolutions_Multi_SIM_card_reader_8.txt | 51 ++++++++++++++++++++++++++ + readers/supported_readers.txt | 5 ++- + 2 files changed, 55 insertions(+), 1 deletion(-) + +commit c9575ccbcb42118d9e639eaf097149993def2d1f +Author: Ludovic Rousseau +Date: Tue Jul 27 17:05:51 2021 +0200 + + Add Lenovo Lenovo Smartcard Wired Keyboard II + + readers/Lenovo_Smartcard_Wired_Keyboard_II.txt | 58 ++++++++++++++++++++++++++ + readers/supported_readers.txt | 3 +- + 2 files changed, 60 insertions(+), 1 deletion(-) + +commit c0c84311c47fcae11ab34ec7b1f70f9518e37931 (tag: 1.4.35, github/master) Author: Ludovic Rousseau Date: Sun Jul 25 16:00:35 2021 +0200 @@ -55,7 +151,7 @@ Date: Fri Jul 9 21:36:46 2021 +0200 src/ccid_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -commit 6f7e48e4ef90bcba24351cd86bc4ec84f761a2ab (origin/master, origin/HEAD, github/master) +commit 6f7e48e4ef90bcba24351cd86bc4ec84f761a2ab Author: Ludovic Rousseau Date: Sat Jul 3 18:50:41 2021 +0200 @@ -2060,7 +2156,7 @@ Date: Wed Apr 15 11:21:15 2020 +0200 src/ccid_usb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -commit 4c8c809751211d35f4d417e1b086a554a79fd6e6 (usb) +commit 4c8c809751211d35f4d417e1b086a554a79fd6e6 (zotac/usb, usb) Author: Stephan Guilloux (home) Date: Tue Apr 14 13:19:45 2020 +0200 diff --git a/README.md b/README.md index a95fbd3..9fc8640 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,15 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. History: ======== +1.4.36 - 30 August 2021, Ludovic Rousseau + - Add support of + - Lenovo Lenovo Smartcard Wired Keyboard II + - REINER SCT tanJack USB + - SafeNet eToken 5110+ FIPS + - SafeNet eToken 5300 C + - jSolutions s.r.o. Multi SIM card reader 4/8 + - parse: fix check when bNumDataRatesSupported = 0 + 1.4.35 - 25 July 2021, Ludovic Rousseau - Add support of - ArkSigner Connect2Sign diff --git a/configure b/configure index fbb5b97..a0686cc 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for ccid 1.4.35. +# Generated by GNU Autoconf 2.69 for ccid 1.4.36. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='ccid' PACKAGE_TARNAME='ccid' -PACKAGE_VERSION='1.4.35' -PACKAGE_STRING='ccid 1.4.35' +PACKAGE_VERSION='1.4.36' +PACKAGE_STRING='ccid 1.4.36' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1377,7 +1377,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures ccid 1.4.35 to adapt to many kinds of systems. +\`configure' configures ccid 1.4.36 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1448,7 +1448,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ccid 1.4.35:";; + short | recursive ) echo "Configuration of ccid 1.4.36:";; esac cat <<\_ACEOF @@ -1595,7 +1595,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ccid configure 1.4.35 +ccid configure 1.4.36 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2014,7 +2014,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by ccid $as_me 1.4.35, which was +It was created by ccid $as_me 1.4.36, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2873,7 +2873,7 @@ fi # Define the identity of the package. PACKAGE='ccid' - VERSION='1.4.35' + VERSION='1.4.36' cat >>confdefs.h <<_ACEOF @@ -14765,7 +14765,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by ccid $as_me 1.4.35, which was +This file was extended by ccid $as_me 1.4.36, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14831,7 +14831,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -ccid config.status 1.4.35 +ccid config.status 1.4.36 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 7a9c182..1bf2f32 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ # Require autoconf 2.61 AC_PREREQ([2.69]) -AC_INIT([ccid],[1.4.35]) +AC_INIT([ccid],[1.4.36]) AC_CONFIG_SRCDIR(src/ifdhandler.c) AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip subdir-objects foreign) diff --git a/readers/supported_readers.txt b/readers/supported_readers.txt index f3339a2..05871b9 100644 --- a/readers/supported_readers.txt +++ b/readers/supported_readers.txt @@ -1,6 +1,6 @@ # # List of readers supported by the CCID driver -# Generated: 2021-06-22 +# Generated: 2021-08-30 # # DO NOT EDIT BY HAND @@ -559,6 +559,9 @@ # IonIDe 0x076B:0x3B01:IonIDe Smartcard Reader +# jSolutions s.r.o. +0x04D8:0xEB61:jSolutions s.r.o. Multi SIM card reader 4/8 + # KACST 0x2A18:0x5000:KACST HSID Reader 0x2A18:0x5001:KACST HSID Reader Single Storage @@ -593,6 +596,7 @@ # Lenovo 0x17EF:0x6007:Lenovo Lenovo USB Smartcard Keyboard 0x17EF:0x6055:Lenovo Lenovo USB Smartcard Keyboard +0x17EF:0x6111:Lenovo Lenovo Smartcard Wired Keyboard II # Liteon 0x03F0:0x164A:Liteon HP SC Keyboard - Apollo (Liteon) @@ -691,6 +695,7 @@ # REINER SCT 0x0C4B:0x0504:REINER SCT cyberJack go 0x0C4B:0x0520:REINER SCT tanJack Bluetooth +0x0C4B:0x0551:REINER SCT tanJack USB 0x0C4B:0x0580:REINER SCT cyberJack one 0x0C4B:0x9102:REINER SCT cyberJack RFID basis @@ -704,6 +709,8 @@ 0x0529:0x0602:SafeNet eToken 7300 0x0529:0x0620:SafeNet eToken 5100 0x08E6:0x34CC:SafeNet eToken 5300 +0x08E6:0x34CE:SafeNet eToken 5300 C +0x08E6:0x34CF:SafeNet eToken 5110+ FIPS # SafeTech 0x24A2:0x0102:SafeTech SafeTouch diff --git a/src/ccid.c b/src/ccid.c index 18b9581..efef240 100644 --- a/src/ccid.c +++ b/src/ccid.c @@ -1,16 +1,16 @@ /* - ccid.c: CCID common code - Copyright (C) 2003-2010 Ludovic Rousseau + ccid.c: CCID common code + Copyright (C) 2003-2010 Ludovic Rousseau - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, @@ -226,7 +226,7 @@ static void set_gemalto_firmware_features(unsigned int reader_index) ret = CmdEscapeCheck(reader_index, cmd, sizeof cmd, (unsigned char*)gf_features, &len_features, 0, TRUE); if ((IFD_SUCCESS == ret) && - (len_features == sizeof *gf_features)) + (len_features == sizeof *gf_features)) { /* Command is supported if it succeeds at CCID level */ /* and returned size matches our expectation */ diff --git a/src/ccid_serial.c b/src/ccid_serial.c index ee51220..dd8e0e2 100644 --- a/src/ccid_serial.c +++ b/src/ccid_serial.c @@ -4,15 +4,15 @@ * * Thanks to Niki W. Waibel for a prototype version * - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, diff --git a/src/commands.c b/src/commands.c index 9774fcc..3b7a808 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1,17 +1,17 @@ /* - commands.c: Commands sent to the card - Copyright (C) 2003-2010 Ludovic Rousseau - Copyright (C) 2005 Martin Paljak + commands.c: Commands sent to the card + Copyright (C) 2003-2010 Ludovic Rousseau + Copyright (C) 2005 Martin Paljak - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, @@ -243,7 +243,7 @@ again: if (buffer[STATUS_OFFSET] & CCID_COMMAND_FAILED) { - ccid_error(PCSC_LOG_ERROR, buffer[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + ccid_error(PCSC_LOG_ERROR, buffer[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ if (0xBB == buffer[ERROR_OFFSET] && /* Protocol error in EMV mode */ ((GEMPC433 == ccid_descriptor->readerID) @@ -1040,7 +1040,7 @@ time_request: { /* mayfail: the error may be expected and not fatal */ ccid_error(mayfail ? PCSC_LOG_INFO : PCSC_LOG_ERROR, - cmd_out[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + cmd_out[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ return_value = IFD_COMMUNICATION_ERROR; } @@ -1145,7 +1145,7 @@ RESPONSECODE CmdPowerOff(unsigned int reader_index) if (cmd[STATUS_OFFSET] & CCID_COMMAND_FAILED) { - ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ return_value = IFD_COMMUNICATION_ERROR; } @@ -1271,7 +1271,7 @@ again_status: && (buffer[ERROR_OFFSET] != 0xFE)) { return_value = IFD_COMMUNICATION_ERROR; - ccid_error(PCSC_LOG_ERROR, buffer[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + ccid_error(PCSC_LOG_ERROR, buffer[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ } return return_value; @@ -1560,7 +1560,7 @@ time_request: if (cmd[STATUS_OFFSET] & CCID_COMMAND_FAILED) { - ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ switch (cmd[ERROR_OFFSET]) { case 0xEF: /* cancel */ @@ -1937,26 +1937,26 @@ static RESPONSECODE T0ProcACK(unsigned int reader_index, #ifdef O2MICRO_OZ776_PATCH if((0 != remain_len) && (0 == (remain_len + 10) % 64)) { - /* special hack to avoid a command of size modulo 64 - * we send two commands instead */ - ret_len = 1; - return_value = CCID_Transmit(reader_index, 0, *snd_buf, ret_len, 0); - if (return_value != IFD_SUCCESS) + /* special hack to avoid a command of size modulo 64 + * we send two commands instead */ + ret_len = 1; + return_value = CCID_Transmit(reader_index, 0, *snd_buf, ret_len, 0); + if (return_value != IFD_SUCCESS) return return_value; - return_value = CCID_Receive(reader_index, &ret_len, tmp_buf, NULL); - if (return_value != IFD_SUCCESS) + return_value = CCID_Receive(reader_index, &ret_len, tmp_buf, NULL); + if (return_value != IFD_SUCCESS) return return_value; - ret_len = remain_len - 1; - return_value = CCID_Transmit(reader_index, 0, *snd_buf, ret_len, 0); - if (return_value != IFD_SUCCESS) + ret_len = remain_len - 1; + return_value = CCID_Transmit(reader_index, 0, *snd_buf, ret_len, 0); + if (return_value != IFD_SUCCESS) return return_value; - return_value = CCID_Receive(reader_index, &ret_len, &tmp_buf[1], - NULL); - if (return_value != IFD_SUCCESS) + return_value = CCID_Receive(reader_index, &ret_len, &tmp_buf[1], + NULL); + if (return_value != IFD_SUCCESS) return return_value; - ret_len += 1; + ret_len += 1; } else #endif @@ -2333,7 +2333,7 @@ RESPONSECODE SetParameters(unsigned int reader_index, char protocol, if (cmd[STATUS_OFFSET] & CCID_COMMAND_FAILED) { - ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ + ccid_error(PCSC_LOG_ERROR, cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */ if (0x00 == cmd[ERROR_OFFSET]) /* command not supported */ return IFD_NOT_SUPPORTED; else @@ -2374,7 +2374,7 @@ static void i2dw(int value, unsigned char buffer[]) /***************************************************************************** * -* bei2i (big endian integer to host order interger) +* bei2i (big endian integer to host order interger) * ****************************************************************************/ diff --git a/src/debug.c b/src/debug.c index 9a8d3be..954796c 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,16 +1,16 @@ /* - debug.c: log (or not) messages - Copyright (C) 2003-2011 Ludovic Rousseau + debug.c: log (or not) messages + Copyright (C) 2003-2011 Ludovic Rousseau - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, diff --git a/src/ifdhandler.c b/src/ifdhandler.c index 294e7e5..fa76312 100644 --- a/src/ifdhandler.c +++ b/src/ifdhandler.c @@ -1,16 +1,16 @@ /* - ifdhandler.c: IFDH API - Copyright (C) 2003-2010 Ludovic Rousseau + ifdhandler.c: IFDH API + Copyright (C) 2003-2010 Ludovic Rousseau - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, @@ -788,7 +788,7 @@ EXTERNAL RESPONSECODE IFDHSetProtocolParameters(DWORD Lun, DWORD Protocol, } } - /* Do not send CCID command SetParameters or PPS to the CCID + /* Do not send CCID command SetParameters or PPS to the CCID * The CCID will do this himself */ if (ccid_desc->dwFeatures & CCID_CLASS_AUTO_PPS_PROP) { @@ -1508,7 +1508,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_VERIFY_PIN_DIRECT; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_FEATURE_VERIFY_PIN_DIRECT)); + htonl(IOCTL_FEATURE_VERIFY_PIN_DIRECT)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1519,7 +1519,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_MODIFY_PIN_DIRECT; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_FEATURE_MODIFY_PIN_DIRECT)); + htonl(IOCTL_FEATURE_MODIFY_PIN_DIRECT)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1531,7 +1531,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_IFD_PIN_PROPERTIES; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_FEATURE_IFD_PIN_PROPERTIES)); + htonl(IOCTL_FEATURE_IFD_PIN_PROPERTIES)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1543,7 +1543,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_MCT_READER_DIRECT; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_FEATURE_MCT_READER_DIRECT)); + htonl(IOCTL_FEATURE_MCT_READER_DIRECT)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1552,7 +1552,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_GET_TLV_PROPERTIES; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_FEATURE_GET_TLV_PROPERTIES)); + htonl(IOCTL_FEATURE_GET_TLV_PROPERTIES)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1562,7 +1562,7 @@ EXTERNAL RESPONSECODE IFDHControl(DWORD Lun, DWORD dwControlCode, pcsc_tlv -> tag = FEATURE_CCID_ESC_COMMAND; pcsc_tlv -> length = 0x04; /* always 0x04 */ set_U32(&pcsc_tlv -> value, - htonl(IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE)); + htonl(IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE)); pcsc_tlv++; iBytesReturned += sizeof(PCSC_TLV_STRUCTURE); @@ -1888,7 +1888,7 @@ EXTERNAL RESPONSECODE IFDHICCPresence(DWORD Lun) ccid_descriptor = get_ccid_descriptor(reader_index); if ((GEMCORESIMPRO == ccid_descriptor->readerID) - && (ccid_descriptor->IFD_bcdDevice < 0x0200)) + && (ccid_descriptor->IFD_bcdDevice < 0x0200)) { /* GemCore SIM Pro firmware 2.00 and up features * a full independant second slot */ @@ -2182,7 +2182,7 @@ static unsigned int T1_card_timeout(double f, double d, int TC1, /* Timeout applied on ISO in + ISO out card exchange * - * Timeout is the sum of: + * Timeout is the sum of: * - ISO in delay between leading edge of the first character sent by the * interface device and the last one (NAD PCB LN APDU CKS) = 260 EGT, * - delay between ISO in and ISO out = BWT, diff --git a/src/parse.c b/src/parse.c index 8c507d4..6aa9276 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1,16 +1,16 @@ /* - parse.c: parse CCID structure - Copyright (C) 2003-2010 Ludovic Rousseau + parse.c: parse CCID structure + Copyright (C) 2003-2010 Ludovic Rousseau - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 @@ -75,15 +75,15 @@ int main(int argc, char *argv[]) if (r < 0) { (void)printf("libusb_init() failed: %s\n", libusb_error_name(r)); - return r; + return r; } cnt = libusb_get_device_list(NULL, &devs); - if (cnt < 0) + if (cnt < 0) { (void)printf("libusb_get_device_list() failed: %s\n", libusb_error_name(r)); - return (int)cnt; + return (int)cnt; } /* for every device */ @@ -114,18 +114,18 @@ int main(int argc, char *argv[]) } r = libusb_get_device_descriptor(dev, &desc); - if (r < 0) + if (r < 0) { - (void)fprintf(stderr, + (void)fprintf(stderr, BRIGHT_RED "failed to get device descriptor: %s" NORMAL, libusb_error_name(r)); - return 1; - } + return 1; + } (void)fprintf(stderr, "Parsing USB bus/device: %04X:%04X (bus %d, device %d)\n", desc.idVendor, desc.idProduct, - libusb_get_bus_number(dev), libusb_get_device_address(dev)); + libusb_get_bus_number(dev), libusb_get_device_address(dev)); (void)fprintf(stderr, " idVendor: 0x%04X", desc.idVendor); r = libusb_get_string_descriptor_ascii(handle, desc.iManufacturer, @@ -474,10 +474,13 @@ static int ccid_parse_interface_descriptor(libusb_device_handle *handle, bNumDataRatesSupported ? "" : " (will use whatever is returned)"); { int n; + int n_max; if (0 == bNumDataRatesSupported) /* read up to the buffer size */ - bNumDataRatesSupported = sizeof(buffer) / sizeof(int); + n_max = sizeof(buffer) / sizeof(int); + else + n_max = bNumDataRatesSupported; /* See CCID 5.3.3 page 24 */ n = libusb_control_transfer(handle, @@ -486,7 +489,7 @@ static int ccid_parse_interface_descriptor(libusb_device_handle *handle, 0x00, /* value */ usb_interface_descriptor->bInterfaceNumber, /* interface */ buffer, - bNumDataRatesSupported * sizeof(int), + n_max * sizeof(int), 2 * 1000); /* we got an error? */ diff --git a/src/utils.c b/src/utils.c index d8e07ab..ba7d46d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,16 +1,16 @@ /* - utils.c: - Copyright (C) 2003-2008 Ludovic Rousseau + utils.c: + Copyright (C) 2003-2008 Ludovic Rousseau - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation,