commit pcsc-ccid for openSUSE:Factory
Hello community, here is the log from the commit of package pcsc-ccid for openSUSE:Factory checked in at 2014-09-15 17:41:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/pcsc-ccid (Old) and /work/SRC/openSUSE:Factory/.pcsc-ccid.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "pcsc-ccid" Changes: -------- --- /work/SRC/openSUSE:Factory/pcsc-ccid/pcsc-ccid.changes 2014-06-16 21:29:47.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.pcsc-ccid.new/pcsc-ccid.changes 2014-09-15 18:24:55.000000000 +0200 @@ -1,0 +2,17 @@ +Sat Sep 13 18:50:10 UTC 2014 - wr@rosenauer.org + +- Updated to version 1.4.18 + * Add support of + Cherry Cherry TC 1100 + Cherry Smart Card Reader USB + Cherry Smartcard Keyboard G87-1xx44 + FujitsuTechnologySolutions GmbH Keyboard KB SCR2 + Lenovo Lenovo USB Smartcard Keyboard + Yubico Yubikey NEO OTP+U2F+CCID + Yubico Yubikey NEO U2F+CCID + eID_R6 001 X8 + * fix support of Omnikey CardMan 3121 + * reduce memory consumed when configured with --enable-embedded + * prepare the port to UEFI + +------------------------------------------------------------------- Old: ---- ccid-1.4.17.tar.bz2 ccid-1.4.17.tar.bz2.asc New: ---- ccid-1.4.18.tar.bz2 ccid-1.4.18.tar.bz2.asc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ pcsc-ccid.spec ++++++ --- /var/tmp/diff_new_pack.ZHX1Ud/_old 2014-09-15 18:24:56.000000000 +0200 +++ /var/tmp/diff_new_pack.ZHX1Ud/_new 2014-09-15 18:24:56.000000000 +0200 @@ -32,7 +32,7 @@ %if %suse_version > 1220 BuildRequires: gpg-offline %endif -Version: 1.4.17 +Version: 1.4.18 Release: 0 Url: http://pcsclite.alioth.debian.org/ccid.html Summary: PCSC Driver for CCID Based Smart Card Readers and GemPC Twin Serial Reader ++++++ ccid-1.4.17.tar.bz2 -> ccid-1.4.18.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/README new/ccid-1.4.18/README --- old/ccid-1.4.17/README 2014-06-11 14:53:42.000000000 +0200 +++ new/ccid-1.4.18/README 2014-09-13 18:27:13.000000000 +0200 @@ -118,6 +118,20 @@ History: ======== +1.4.18 - 13 September 2014, Ludovic Rousseau + - Add support of + . Cherry Cherry TC 1100 + . Cherry Smart Card Reader USB + . Cherry Smartcard Keyboard G87-1xx44 + . FujitsuTechnologySolutions GmbH Keyboard KB SCR2 + . Lenovo Lenovo USB Smartcard Keyboard + . Yubico Yubikey NEO OTP+U2F+CCID + . Yubico Yubikey NEO U2F+CCID + . eID_R6 001 X8 + - fix support of Omnikey CardMan 3121 + - reduce memory consumed when configured with --enable-embedded + - prepare the port to UEFI + 1.4.17 - 11 June 2014, Ludovic Rousseau - Add support of . Feitian R502 @@ -996,6 +1010,6 @@ - First public release -$Id: README 6915 2014-06-11 13:09:57Z rousseau $ +$Id: README 6982 2014-09-13 16:25:24Z rousseau $ vim:ts=20 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/config.h.in new/ccid-1.4.18/config.h.in --- old/ccid-1.4.17/config.h.in 2014-06-11 14:54:02.000000000 +0200 +++ new/ccid-1.4.18/config.h.in 2014-09-13 18:27:31.000000000 +0200 @@ -42,6 +42,9 @@ /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H +/* Define to 1 if you have the <stdio.h> header file. */ +#undef HAVE_STDIO_H + /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/configure new/ccid-1.4.18/configure --- old/ccid-1.4.17/configure 2014-06-11 14:53:54.000000000 +0200 +++ new/ccid-1.4.18/configure 2014-09-13 18:27:19.000000000 +0200 @@ -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.17. +# Generated by GNU Autoconf 2.69 for ccid 1.4.18. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='ccid' PACKAGE_TARNAME='ccid' -PACKAGE_VERSION='1.4.17' -PACKAGE_STRING='ccid 1.4.17' +PACKAGE_VERSION='1.4.18' +PACKAGE_STRING='ccid 1.4.18' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1362,7 +1362,7 @@ # 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.17 to adapt to many kinds of systems. +\`configure' configures ccid 1.4.18 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1432,7 +1432,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of ccid 1.4.17:";; + short | recursive ) echo "Configuration of ccid 1.4.18:";; esac cat <<\_ACEOF @@ -1568,7 +1568,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -ccid configure 1.4.17 +ccid configure 1.4.18 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1987,7 +1987,7 @@ 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.17, which was +It was created by ccid $as_me 1.4.18, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2851,7 +2851,7 @@ # Define the identity of the package. PACKAGE='ccid' - VERSION='1.4.17' + VERSION='1.4.18' cat >>confdefs.h <<_ACEOF @@ -12384,7 +12384,7 @@ fi -for ac_header in errno.h fcntl.h stdlib.h unistd.h termios.h string.h sys/time.h sys/types.h stdarg.h arpa/inet.h +for ac_header in errno.h fcntl.h stdlib.h unistd.h termios.h string.h sys/time.h sys/types.h stdarg.h arpa/inet.h stdio.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14166,7 +14166,7 @@ # 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.17, which was +This file was extended by ccid $as_me 1.4.18, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14232,7 +14232,7 @@ 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.17 +ccid config.status 1.4.18 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/configure.ac new/ccid-1.4.18/configure.ac --- old/ccid-1.4.17/configure.ac 2014-06-11 14:53:42.000000000 +0200 +++ new/ccid-1.4.18/configure.ac 2014-09-13 18:27:12.000000000 +0200 @@ -1,12 +1,12 @@ # Process this file with autoconf to produce a configure script. # You may need to use autoconf 2.56 or newer -# $Id: configure.ac 6915 2014-06-11 13:09:57Z rousseau $ +# $Id: configure.ac 6982 2014-09-13 16:25:24Z rousseau $ # Require autoconf 2.61 AC_PREREQ([2.69]) -AC_INIT([ccid],[1.4.17]) +AC_INIT([ccid],[1.4.18]) AC_CONFIG_SRCDIR(src/ifdhandler.c) AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE(1.8 dist-bzip2 no-dist-gzip subdir-objects) @@ -69,7 +69,7 @@ # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h sys/time.h sys/types.h stdarg.h arpa/inet.h,, +AC_CHECK_HEADERS(errno.h fcntl.h stdlib.h unistd.h termios.h string.h sys/time.h sys/types.h stdarg.h arpa/inet.h stdio.h,, [AC_MSG_ERROR([some header files not found])]) # Checks for typedefs, structures, and compiler characteristics. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/examples/scardcontrol.c new/ccid-1.4.18/examples/scardcontrol.c --- old/ccid-1.4.17/examples/scardcontrol.c 2014-01-12 19:44:31.000000000 +0100 +++ new/ccid-1.4.18/examples/scardcontrol.c 2014-08-08 18:57:35.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: scardcontrol.c 6818 2014-01-07 10:16:28Z rousseau $ + * $Id: scardcontrol.c 6958 2014-08-08 09:27:50Z rousseau $ */ #include <stdio.h> @@ -547,7 +547,7 @@ goto end; } - /* connect to a reader (even without a card) */ + /* re-connect to a reader (with a card) */ dwActiveProtocol = -1; rv = SCardReconnect(hCard, SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0|SCARD_PROTOCOL_T1, SCARD_LEAVE_CARD, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/readers/supported_readers.txt new/ccid-1.4.18/readers/supported_readers.txt --- old/ccid-1.4.17/readers/supported_readers.txt 2014-06-11 14:53:42.000000000 +0200 +++ new/ccid-1.4.18/readers/supported_readers.txt 2014-09-13 18:27:12.000000000 +0200 @@ -1,6 +1,6 @@ # # List of readers supported by the CCID driver -# Generated: 2014-05-31 +# Generated: 2014-09-02 # # DO NOT EDIT BY HAND @@ -60,7 +60,7 @@ 0x08E6:0x34C0:Gemalto Ezio Shield 0x08E6:0x34C3:Gemalto EZIO CB+ 0x08E6:0x4433:Gemalto Gemplus USB SmartCard Reader 433-Swap -0x08E6:0x5503:Gemalto Prox Dual USB PC LinkReader +0x08E6:0x5503:Gemalto Prox Dual USB PC Link Reader 0x08E6:0x5504:Gemalto Prox SU USB PC LinkReader 0x08E6:0x8000:Gemalto Smart Enterprise Guardian Secure USB Device 0x08E6:0x8141:Gemalto IDBridge K3000 @@ -192,6 +192,10 @@ # charismathics 0x19E7:0x0002:charismathics plug'n'crypt CCID token +# Cherry +0x046A:0x0090:Cherry Smart Card Reader USB +0x046A:0x00A3:Cherry Smartcard Keyboard G87-1xx44 + # Cherry GmbH 0x046A:0x005B:Cherry GmbH SmartBoard XX1X 0x046A:0x0070:Cherry GmbH SmartTerminal XX1X @@ -207,6 +211,9 @@ # DUALi 0x1DB2:0x088B:DUALi DRAGON NFC READER +# eID_R6 001 +0x257B:0xD205:eID_R6 001 X8 + # Feitian 0x096E:0x060D:Feitian R502 0x096E:0x061A:Feitian bR301 @@ -224,6 +231,7 @@ # FujitsuTechnologySolutions GmbH 0x0BF8:0x1017:FujitsuTechnologySolutions GmbH SmartCase KB SCR eSIG +0x0BF8:0x1021:FujitsuTechnologySolutions GmbH Smartcard Keyboard G87-914x # Gemalto 0x08E6:0x2202:Gemalto Gem e-Seal Pro USB Token @@ -319,6 +327,7 @@ # Lenovo 0x17EF:0x6007:Lenovo Lenovo USB Smartcard Keyboard +0x17EF:0x6055:Lenovo Lenovo USB Smartcard Keyboard # Macally 0x08AE:0x0BDF:Macally NFC CCID eNetPad @@ -478,6 +487,8 @@ # Yubico 0x1050:0x0111:Yubico Yubikey NEO OTP+CCID 0x1050:0x0112:Yubico Yubikey NEO CCID +0x1050:0x0115:Yubico Yubikey NEO U2F+CCID +0x1050:0x0116:Yubico Yubikey NEO OTP+U2F+CCID ########################## # section: unsupported @@ -554,6 +565,9 @@ #0x0424:0x1202:Microchip SEC1210 (Microchip_SEC1210.txt) #0x0424:0x1202:Microchip SEC1210 (Microchip_SEC1210.txt_i1) +#0x046A:0x0090:Cherry Smart Card Reader USB (Cherry_Smart_Card_Reader_USB.txt) +#0x046A:0x0090:Cherry Cherry TC 1100 (Cherry_Smart_Card_Reader_USB_2_04.txt) + #0x04E6:0x5291:SCM Microsystems Inc. SCL010 Contactless Reader (SCL010.txt) #0x04E6:0x5291:SCM Microsystems Inc. SCL010 Contactless Reader (SCM_SCL010.txt) @@ -601,8 +615,8 @@ #0x08E6:0x34C0:Gemalto Ezio Shield (Gemalto_Ezio_Shield.txt) #0x08E6:0x34C0:Gemalto Ezio Shield Pro SC (Gemalto_Ezio_Shield_Pro_SC.txt) -#0x08E6:0x5503:Gemalto Prox Dual USB PC LinkReader (GemProxDU.txt) -#0x08E6:0x5503:Gemalto Prox Dual USB PC LinkReader (GemProxDU.txt_i1) +#0x08E6:0x5503:Gemalto Prox Dual USB PC Link Reader (GemProxDU.txt) +#0x08E6:0x5503:Gemalto Prox Dual USB PC Link Reader (GemProxDU.txt_i1) #0x08E6:0x5504:Gemalto Prox SU USB PC LinkReader (GemProxSU.txt) #0x08E6:0x5504:Gemalto Prox SU USB PC LinkReader (GemProxSU.txt_i1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/ccid.c new/ccid-1.4.18/src/ccid.c --- old/ccid-1.4.17/src/ccid.c 2014-05-14 14:36:02.000000000 +0200 +++ new/ccid-1.4.18/src/ccid.c 2014-09-13 18:27:13.000000000 +0200 @@ -18,16 +18,27 @@ */ /* - * $Id: ccid.c 6885 2014-04-11 18:46:19Z rousseau $ + * $Id: ccid.c 6976 2014-09-04 11:35:46Z rousseau $ */ +#include <config.h> + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #include <pcsclite.h> #include <ifdhandler.h> -#include "config.h" #include "debug.h" #include "ccid.h" #include "defs.h" @@ -50,12 +61,6 @@ switch (ccid_descriptor->readerID) { - case CARDMAN3121+1: - /* Reader announces APDU but is in fact TPDU */ - ccid_descriptor->dwFeatures &= ~CCID_CLASS_EXCHANGE_MASK; - ccid_descriptor->dwFeatures |= CCID_CLASS_TPDU; - break; - case MYSMARTPAD: ccid_descriptor->dwMaxIFSD = 254; break; @@ -75,7 +80,7 @@ if (0x0200 == ccid_descriptor->IFD_bcdDevice) { ccid_descriptor->zlp = TRUE; - DEBUG_INFO("ZLP fixup"); + DEBUG_INFO1("ZLP fixup"); } break; @@ -148,7 +153,7 @@ DEBUG_INFO2(" bEntryValidationCondition: 0x%02X", gff->bEntryValidationCondition); - DEBUG_INFO(" Reader supports PC/SCv2 features:"); + DEBUG_INFO1(" Reader supports PC/SCv2 features:"); DEBUG_INFO2(" VerifyPinStart: %s", YESNO(gff->VerifyPinStart)); DEBUG_INFO2(" VerifyPinFinish: %s", YESNO(gff->VerifyPinFinish)); DEBUG_INFO2(" ModifyPinStart: %s", YESNO(gff->ModifyPinStart)); @@ -521,6 +526,7 @@ ****************************************************************************/ void ccid_error(int error, const char *file, int line, const char *function) { +#ifndef NO_LOG const char *text; char var_text[30]; @@ -638,6 +644,7 @@ break; } log_msg(PCSC_LOG_ERROR, "%s:%d:%s %s", file, line, function, text); +#endif } /* ccid_error */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/ccid.h new/ccid-1.4.18/src/ccid.h --- old/ccid-1.4.17/src/ccid.h 2014-02-14 10:22:39.000000000 +0100 +++ new/ccid-1.4.18/src/ccid.h 2014-08-06 15:57:33.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: ccid.h 6845 2014-02-14 09:16:01Z rousseau $ + * $Id: ccid.h 6922 2014-06-16 13:55:33Z rousseau $ */ typedef struct @@ -285,56 +285,56 @@ /* Structure returned by Gemalto readers for the CCID Escape command 0x6A */ struct GEMALTO_FIRMWARE_FEATURES { - UCHAR bLogicalLCDLineNumber; /* Logical number of LCD lines */ - UCHAR bLogicalLCDRowNumber; /* Logical number of characters per LCD line */ - UCHAR bLcdInfo; /* b0 indicates if scrolling is available */ - UCHAR bEntryValidationCondition; /* See PIN_PROPERTIES */ + unsigned char bLogicalLCDLineNumber; /* Logical number of LCD lines */ + unsigned char bLogicalLCDRowNumber; /* Logical number of characters per LCD line */ + unsigned char bLcdInfo; /* b0 indicates if scrolling is available */ + unsigned char bEntryValidationCondition; /* See PIN_PROPERTIES */ /* Here come the PC/SC bit features to report */ - UCHAR VerifyPinStart:1; - UCHAR VerifyPinFinish:1; - UCHAR ModifyPinStart:1; - UCHAR ModifyPinFinish:1; - UCHAR GetKeyPressed:1; - UCHAR VerifyPinDirect:1; - UCHAR ModifyPinDirect:1; - UCHAR Abort:1; - - UCHAR GetKey:1; - UCHAR WriteDisplay:1; - UCHAR SetSpeMessage:1; - UCHAR RFUb1:5; + unsigned char VerifyPinStart:1; + unsigned char VerifyPinFinish:1; + unsigned char ModifyPinStart:1; + unsigned char ModifyPinFinish:1; + unsigned char GetKeyPressed:1; + unsigned char VerifyPinDirect:1; + unsigned char ModifyPinDirect:1; + unsigned char Abort:1; + + unsigned char GetKey:1; + unsigned char WriteDisplay:1; + unsigned char SetSpeMessage:1; + unsigned char RFUb1:5; - UCHAR RFUb2[2]; + unsigned char RFUb2[2]; /* Additional flags */ - UCHAR bTimeOut2:1; - UCHAR bListSupportedLanguages:1; /* Reader is able to indicate + unsigned char bTimeOut2:1; + unsigned char bListSupportedLanguages:1; /* Reader is able to indicate the list of supported languages through CCID-ESC 0x6B */ - UCHAR bNumberMessageFix:1; /* Reader handles correctly shifts + unsigned char bNumberMessageFix:1; /* Reader handles correctly shifts made by bNumberMessage in PIN modification data structure */ - UCHAR bPPDUSupportOverXferBlock:1; /* Reader supports PPDU over + unsigned char bPPDUSupportOverXferBlock:1; /* Reader supports PPDU over PC_to_RDR_XferBlock command */ - UCHAR bPPDUSupportOverEscape:1; /* Reader supports PPDU over + unsigned char bPPDUSupportOverEscape:1; /* Reader supports PPDU over PC_to_RDR_Escape command with abData[0]=0xFF */ - UCHAR RFUb3:3; + unsigned char RFUb3:3; - UCHAR RFUb4[3]; + unsigned char RFUb4[3]; - UCHAR VersionNumber; /* ?? */ - UCHAR MinimumPINSize; /* for Verify and Modify */ - UCHAR MaximumPINSize; + unsigned char VersionNumber; /* ?? */ + unsigned char MinimumPINSize; /* for Verify and Modify */ + unsigned char MaximumPINSize; /* Miscellaneous reader features */ - UCHAR Firewall:1; - UCHAR RFUb5:7; + unsigned char Firewall:1; + unsigned char RFUb5:7; /* The following fields, FirewalledCommand_SW1 and * FirewalledCommand_SW2 are only valid if Firewall=1 * These fields give the SW1 SW2 value used by the reader to * indicate a command has been firewalled */ - UCHAR FirewalledCommand_SW1; - UCHAR FirewalledCommand_SW2; - UCHAR RFUb6[3]; + unsigned char FirewalledCommand_SW1; + unsigned char FirewalledCommand_SW2; + unsigned char RFUb6[3]; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/ccid_serial.c new/ccid-1.4.18/src/ccid_serial.c --- old/ccid-1.4.17/src/ccid_serial.c 2014-02-11 18:47:35.000000000 +0100 +++ new/ccid-1.4.18/src/ccid_serial.c 2014-09-13 18:27:13.000000000 +0200 @@ -20,7 +20,7 @@ */ /* - * $Id: ccid_serial.c 6832 2014-01-28 14:50:43Z rousseau $ + * $Id: ccid_serial.c 6975 2014-09-04 11:33:05Z rousseau $ */ #include <stdio.h> @@ -35,7 +35,7 @@ #include <sys/ioctl.h> #include <ifdhandler.h> -#include "config.h" +#include <config.h> #include "defs.h" #include "ccid_ifdhandler.h" #include "debug.h" @@ -763,7 +763,7 @@ * starts at 9600 bauds, so let's first try this speed */ /* set serial port speed to 9600 bauds */ (void)cfsetspeed(¤t_termios, B9600); - DEBUG_INFO("Set serial port baudrate to 9600 and correct configuration"); + DEBUG_INFO1("Set serial port baudrate to 9600 and correct configuration"); if (tcsetattr(serialDevice[reader_index].fd, TCSANOW, ¤t_termios) == -1) { (void)close(serialDevice[reader_index].fd); @@ -798,7 +798,7 @@ } else { - DEBUG_INFO("CmdEscape to configure 115200 bauds failed"); + DEBUG_INFO1("CmdEscape to configure 115200 bauds failed"); } } /* In case of a failure, reader is probably already at 115200 @@ -808,7 +808,7 @@ /* set serial port speed to 115200 bauds */ (void)cfsetspeed(¤t_termios, B115200); - DEBUG_INFO("Set serial port baudrate to 115200 and correct configuration"); + DEBUG_INFO1("Set serial port baudrate to 115200 and correct configuration"); if (tcsetattr(serialDevice[reader].fd, TCSANOW, ¤t_termios) == -1) { (void)close(serialDevice[reader].fd); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/ccid_usb.c new/ccid-1.4.18/src/ccid_usb.c --- old/ccid-1.4.17/src/ccid_usb.c 2014-05-14 14:36:02.000000000 +0200 +++ new/ccid-1.4.18/src/ccid_usb.c 2014-09-13 18:27:13.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: ccid_usb.c 6890 2014-04-24 13:51:03Z rousseau $ + * $Id: ccid_usb.c 6975 2014-09-04 11:33:05Z rousseau $ */ #define __CCID_USB__ @@ -35,7 +35,7 @@ #include <sys/time.h> #include <ifdhandler.h> -#include "config.h" +#include <config.h> #include "misc.h" #include "ccid.h" #include "debug.h" @@ -188,7 +188,7 @@ if (to_exit) { - DEBUG_INFO("libusb_exit"); + DEBUG_INFO1("libusb_exit"); libusb_exit(ctx); ctx = NULL; } @@ -647,7 +647,7 @@ else { usbDevice[reader_index].ccid.arrayOfSupportedDataRates = NULL; - DEBUG_INFO("bNumDataRatesSupported is 0"); + DEBUG_INFO1("bNumDataRatesSupported is 0"); } usbDevice[reader_index].ccid.bInterfaceProtocol = usb_interface->altsetting->bInterfaceProtocol; usbDevice[reader_index].ccid.bNumEndpoints = usb_interface->altsetting->bNumEndpoints; @@ -701,7 +701,7 @@ close_libusb_if_needed(); if (claim_failed) return STATUS_COMM_ERROR; - DEBUG_INFO("Device not found?"); + DEBUG_INFO1("Device not found?"); return STATUS_NO_SUCH_DEVICE; } @@ -817,7 +817,7 @@ DEBUG_CRITICAL("Too many duplicate frame detected"); return STATUS_UNSUCCESSFUL; } - DEBUG_INFO("Duplicate frame detected"); + DEBUG_INFO1("Duplicate frame detected"); goto read_again; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/commands.c new/ccid-1.4.18/src/commands.c --- old/ccid-1.4.17/src/commands.c 2014-03-23 16:11:21.000000000 +0100 +++ new/ccid-1.4.18/src/commands.c 2014-09-13 18:27:13.000000000 +0200 @@ -19,17 +19,28 @@ */ /* - * $Id: commands.c 6879 2014-03-23 15:11:20Z rousseau $ + * $Id: commands.c 6975 2014-09-04 11:33:05Z rousseau $ */ +#include <config.h> + +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_ERRNO_H #include <errno.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #include <pcsclite.h> #include <ifdhandler.h> #include <reader.h> -#include "config.h" #include "misc.h" #include "commands.h" #include "openct/proto-t1.h" @@ -191,19 +202,19 @@ if ((1 == voltage) && !(bVoltageSupport & 1)) { - DEBUG_INFO("5V requested but not support by reader"); + DEBUG_INFO1("5V requested but not support by reader"); voltage = 2; /* 3V */ } if ((2 == voltage) && !(bVoltageSupport & 2)) { - DEBUG_INFO("3V requested but not support by reader"); + DEBUG_INFO1("3V requested but not support by reader"); voltage = 3; /* 1.8V */ } if ((3 == voltage) && !(bVoltageSupport & 4)) { - DEBUG_INFO("1.8V requested but not support by reader"); + DEBUG_INFO1("1.8V requested but not support by reader"); voltage = 0; /* auto */ } } @@ -258,7 +269,9 @@ /* continue with 3 volts and 5 volts */ if (voltage > 1) { +#ifndef NO_LOG const char *voltage_code[] = { "auto", "5V", "3V", "1.8V" }; +#endif DEBUG_INFO3("Power up with %s failed. Try with %s.", voltage_code[voltage], voltage_code[voltage-1]); @@ -319,7 +332,7 @@ if ((pvs->ulDataLength + 19 == TxLength) && (bei2i((unsigned char*)(&pvs->ulDataLength)) == pvs->ulDataLength)) { - DEBUG_INFO("Reversing order from big to little endian"); + DEBUG_INFO1("Reversing order from big to little endian"); /* If ulDataLength is big endian, assume others are too */ /* reverse the byte order for 3 fields */ pvs->wPINMaxExtraDigit = BSWAP_16(pvs->wPINMaxExtraDigit); @@ -393,7 +406,7 @@ tmp = TxBuffer[6]; TxBuffer[6] = TxBuffer[5]; TxBuffer[5] = tmp; - DEBUG_INFO("Correcting wPINMaxExtraDigit for Dell keyboard"); + DEBUG_INFO1("Correcting wPINMaxExtraDigit for Dell keyboard"); } #endif @@ -653,7 +666,7 @@ if ((pms->ulDataLength + 24 == TxLength) && (bei2i((unsigned char*)(&pms->ulDataLength)) == pms->ulDataLength)) { - DEBUG_INFO("Reversing order from big to little endian"); + DEBUG_INFO1("Reversing order from big to little endian"); /* If ulDataLength is big endian, assume others are too */ /* reverse the byte order for 3 fields */ pms->wPINMaxExtraDigit = BSWAP_16(pms->wPINMaxExtraDigit); @@ -726,7 +739,7 @@ gemalto_modify_pin_bug = has_gemalto_modify_pin_bug(ccid_descriptor); if (gemalto_modify_pin_bug) { - DEBUG_INFO("Gemalto CCID Modify Pin Bug"); + DEBUG_INFO1("Gemalto CCID Modify Pin Bug"); /* The reader requests a value for bMsgIndex2 and bMsgIndex3 * even if they should not be present. So we fake diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/debug.c new/ccid-1.4.18/src/debug.c --- old/ccid-1.4.17/src/debug.c 2013-10-06 12:25:18.000000000 +0200 +++ new/ccid-1.4.18/src/debug.c 2014-09-13 18:27:13.000000000 +0200 @@ -18,11 +18,11 @@ */ /* - * $Id: debug.c 6760 2013-10-01 12:57:50Z rousseau $ + * $Id: debug.c 6975 2014-09-04 11:33:05Z rousseau $ */ -#include "config.h" +#include <config.h> #include "misc.h" #include "debug.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/debug.h new/ccid-1.4.18/src/debug.h --- old/ccid-1.4.17/src/debug.h 2014-01-12 19:44:31.000000000 +0100 +++ new/ccid-1.4.18/src/debug.h 2014-09-13 18:27:13.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: debug.h 6798 2013-11-26 13:49:00Z rousseau $ + * $Id: debug.h 6967 2014-09-02 13:50:50Z rousseau $ */ /* @@ -65,7 +65,7 @@ #define DEBUG_CRITICAL5(fmt, data1, data2, data3, data4) if (LogLevel & DEBUG_LEVEL_CRITICAL) Log5(PCSC_LOG_CRITICAL, fmt, data1, data2, data3, data4) /* DEBUG_INFO */ -#define DEBUG_INFO(fmt) if (LogLevel & DEBUG_LEVEL_INFO) Log1(PCSC_LOG_INFO, fmt) +#define DEBUG_INFO1(fmt) if (LogLevel & DEBUG_LEVEL_INFO) Log1(PCSC_LOG_INFO, fmt) #define DEBUG_INFO2(fmt, data) if (LogLevel & DEBUG_LEVEL_INFO) Log2(PCSC_LOG_INFO, fmt, data) @@ -75,7 +75,7 @@ #define DEBUG_INFO5(fmt, data1, data2, data3, data4) if (LogLevel & DEBUG_LEVEL_INFO) Log5(PCSC_LOG_INFO, fmt, data1, data2, data3, data4) -#define DEBUG_INFO_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_INFO) log_xxd(PCSC_LOG_INFO, msg, buffer, size) +#define DEBUG_INFO_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_INFO) LogXxd(PCSC_LOG_INFO, msg, buffer, size) /* DEBUG_PERIODIC */ #define DEBUG_PERIODIC(fmt) if (LogLevel & DEBUG_LEVEL_PERIODIC) Log1(PCSC_LOG_DEBUG, fmt) @@ -94,7 +94,7 @@ #define DEBUG_COMM4(fmt, data1, data2, data3) if (LogLevel & DEBUG_LEVEL_COMM) Log4(PCSC_LOG_DEBUG, fmt, data1, data2, data3) /* DEBUG_XXD */ -#define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) log_xxd(PCSC_LOG_DEBUG, msg, buffer, size) +#define DEBUG_XXD(msg, buffer, size) if (LogLevel & DEBUG_LEVEL_COMM) LogXxd(PCSC_LOG_DEBUG, msg, buffer, size) #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/defs.h new/ccid-1.4.18/src/defs.h --- old/ccid-1.4.17/src/defs.h 2012-06-08 16:17:11.000000000 +0200 +++ new/ccid-1.4.18/src/defs.h 2014-08-06 15:57:33.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: defs.h 6305 2012-05-19 08:10:08Z rousseau $ + * $Id: defs.h 6926 2014-06-17 09:22:00Z rousseau $ */ #include <pcsclite.h> @@ -31,12 +31,12 @@ * ATR */ int nATRLength; - UCHAR pcATRBuffer[MAX_ATR_SIZE]; + unsigned char pcATRBuffer[MAX_ATR_SIZE]; /* * Card state */ - UCHAR bPowerFlags; + unsigned char bPowerFlags; /* * T=1 Protocol context diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/ifdhandler.c new/ccid-1.4.18/src/ifdhandler.c --- old/ccid-1.4.17/src/ifdhandler.c 2014-01-12 19:44:31.000000000 +0100 +++ new/ccid-1.4.18/src/ifdhandler.c 2014-09-13 18:27:13.000000000 +0200 @@ -17,13 +17,26 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* $Id: ifdhandler.c 6819 2014-01-07 14:12:27Z rousseau $ */ +/* $Id: ifdhandler.c 6977 2014-09-04 11:36:54Z rousseau $ */ +#include <config.h> + +#ifdef HAVE_STDIO_H #include <stdio.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif +#ifdef HAVE_STDLIB_H #include <stdlib.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> -#include "config.h" +#endif + #include "misc.h" #include <pcsclite.h> #include <ifdhandler.h> @@ -656,6 +669,7 @@ unsigned int len; int convention; int reader_index; + int atr_ret; /* Set ccid desc params */ CcidDesc *ccid_slot; @@ -684,8 +698,10 @@ } /* Get ATR of the card */ - (void)ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer, + atr_ret = ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer, ccid_slot->nATRLength); + if (ATR_MALFORMED == atr_ret) + return IFD_PROTOCOL_NOT_SUPPORTED; /* Apply Extra EGT patch for bogus cards */ extra_egt(&atr, ccid_desc, Protocol); @@ -871,8 +887,7 @@ { int default_protocol; - if (ATR_MALFORMED == ATR_GetDefaultProtocol(&atr, &default_protocol)) - return IFD_PROTOCOL_NOT_SUPPORTED; + ATR_GetDefaultProtocol(&atr, &default_protocol, NULL); /* if the requested protocol is not the default one * or a TA1/PPS1 is present */ @@ -892,7 +907,7 @@ #endif if (PPS_Exchange(reader_index, pps, &len, &pps[2]) != PPS_OK) { - DEBUG_INFO("PPS_Exchange Failed"); + DEBUG_INFO1("PPS_Exchange Failed"); return IFD_ERROR_PTS_FAILURE; } @@ -1108,7 +1123,9 @@ RESPONSECODE return_value = IFD_SUCCESS; unsigned char pcbuffer[10+MAX_ATR_SIZE]; int reader_index; +#ifndef NO_LOG const char *actions[] = { "PowerUp", "PowerDown", "Reset" }; +#endif unsigned int oldReadTimeout; _ccid_descriptor *ccid_descriptor; @@ -1276,7 +1293,7 @@ if ((sizeof manufacturer == TxLength) && (memcmp(TxBuffer, manufacturer, sizeof manufacturer) == 0)) { - DEBUG_INFO("IDToken: Manufacturer command"); + DEBUG_INFO1("IDToken: Manufacturer command"); memcpy(RxBuffer, "KOBIL systems\220\0", 15); *RxLength = 15; return IFD_SUCCESS; @@ -1285,7 +1302,7 @@ if ((sizeof product_name == TxLength) && (memcmp(TxBuffer, product_name, sizeof product_name) == 0)) { - DEBUG_INFO("IDToken: Product name command"); + DEBUG_INFO1("IDToken: Product name command"); memcpy(RxBuffer, "IDToken\220\0", 9); *RxLength = 9; return IFD_SUCCESS; @@ -1296,7 +1313,7 @@ { int IFD_bcdDevice = get_ccid_descriptor(reader_index)->IFD_bcdDevice; - DEBUG_INFO("IDToken: Firmware version command"); + DEBUG_INFO1("IDToken: Firmware version command"); *RxLength = sprintf((char *)RxBuffer, "%X.%02X", IFD_bcdDevice >> 8, IFD_bcdDevice & 0xFF); RxBuffer[(*RxLength)++] = 0x90; @@ -1307,7 +1324,7 @@ if ((sizeof driver_version == TxLength) && (memcmp(TxBuffer, driver_version, sizeof driver_version) == 0)) { - DEBUG_INFO("IDToken: Driver version command"); + DEBUG_INFO1("IDToken: Driver version command"); #define DRIVER_VERSION "2012.2.7\220\0" memcpy(RxBuffer, DRIVER_VERSION, sizeof DRIVER_VERSION -1); *RxLength = sizeof DRIVER_VERSION -1; @@ -1389,7 +1406,7 @@ if (!allowed) { - DEBUG_INFO("ifd exchange (Escape command) not allowed"); + DEBUG_INFO1("ifd exchange (Escape command) not allowed"); return_value = IFD_COMMUNICATION_ERROR; } else @@ -1724,7 +1741,7 @@ || (TxBuffer[4] != 0x00) /* Lind */ ) { - DEBUG_INFO("MCT Command refused by driver"); + DEBUG_INFO1("MCT Command refused by driver"); return_value = IFD_COMMUNICATION_ERROR; } else @@ -1865,7 +1882,7 @@ if (ret != IFD_SUCCESS) { - DEBUG_INFO("CmdEscape failed"); + DEBUG_INFO1("CmdEscape failed"); /* simulate a card absent */ res[0] = 0; } @@ -1907,7 +1924,7 @@ int rv; list_t plist, *values; - DEBUG_INFO("Driver version: " VERSION); + DEBUG_INFO1("Driver version: " VERSION); /* Info.plist full patch filename */ (void)snprintf(infofile, sizeof(infofile), "%s/%s/Contents/Info.plist", @@ -2027,7 +2044,7 @@ /* Init TC1 */ atr->ib[0][ATR_INTERFACE_BYTE_TC].present = TRUE; atr->ib[0][ATR_INTERFACE_BYTE_TC].value = 2; - DEBUG_INFO("Extra EGT patch applied"); + DEBUG_INFO1("Extra EGT patch applied"); } if (SCARD_PROTOCOL_T1 == Protocol) @@ -2044,7 +2061,7 @@ /* Init TC1 */ atr->ib[0][ATR_INTERFACE_BYTE_TC].present = TRUE; atr->ib[0][ATR_INTERFACE_BYTE_TC].value = 2; - DEBUG_INFO("Extra EGT patch applied"); + DEBUG_INFO1("Extra EGT patch applied"); /* only the first TBi (i>2) must be used */ break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/buffer.c new/ccid-1.4.18/src/openct/buffer.c --- old/ccid-1.4.17/src/openct/buffer.c 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/openct/buffer.c 2014-09-13 18:27:13.000000000 +0200 @@ -4,12 +4,12 @@ * Copyright (C) 2003, Olaf Kirch <okir@suse.de> */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif -#include <stdlib.h> + +#ifdef HAVE_STRING_H #include <string.h> -#include <unistd.h> +#endif + #include <openct/buffer.h> void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/buffer.h new/ccid-1.4.18/src/openct/buffer.h --- old/ccid-1.4.17/src/openct/buffer.h 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/openct/buffer.h 2014-08-06 15:57:33.000000000 +0200 @@ -11,7 +11,9 @@ extern "C" { #endif +#ifdef HAVE_SYS_TYPES_H #include <sys/types.h> +#endif typedef struct ct_buf { unsigned char * base; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/checksum.c new/ccid-1.4.18/src/openct/checksum.c --- old/ccid-1.4.17/src/openct/checksum.c 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/openct/checksum.c 2014-09-13 18:27:13.000000000 +0200 @@ -5,11 +5,10 @@ * For licensing, see the file LICENCE */ -#include "config.h" +#include <config.h> #ifdef HAVE_STDINT_H #include <stdint.h> #endif -#include <unistd.h> #include "checksum.h" #define min( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/checksum.h new/ccid-1.4.18/src/openct/checksum.h --- old/ccid-1.4.17/src/openct/checksum.h 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/openct/checksum.h 2014-09-13 18:27:13.000000000 +0200 @@ -17,16 +17,18 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* $Id: checksum.h 2974 2008-05-28 18:32:52Z rousseau $ */ +/* $Id: checksum.h 6975 2014-09-04 11:33:05Z rousseau $ */ #ifndef __CHECKSUM_H__ #define __CHECKSUM_H__ -#include "config.h" +#include <config.h> #ifdef HAVE_STDINT_H #include <stdint.h> #endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif extern unsigned int csum_lrc_compute(const uint8_t *, size_t, unsigned char *); extern unsigned int csum_crc_compute(const uint8_t *, size_t, unsigned char *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/proto-t1.c new/ccid-1.4.18/src/openct/proto-t1.c --- old/ccid-1.4.17/src/openct/proto-t1.c 2014-03-23 16:09:48.000000000 +0100 +++ new/ccid-1.4.18/src/openct/proto-t1.c 2014-09-13 18:27:13.000000000 +0200 @@ -7,6 +7,8 @@ * Copyright (C) 2004 Ludovic Rousseau <ludovic.rousseau@free.fr> */ +#include <config.h> + #include <pcsclite.h> #include <ifdhandler.h> #include "commands.h" @@ -17,10 +19,9 @@ #include "ccid.h" -#include <sys/poll.h> -#include <unistd.h> -#include <stdlib.h> +#ifdef HAVE_STRING_H #include <string.h> +#endif /* I block */ #define T1_I_SEQ_SHIFT 6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/openct/proto-t1.h new/ccid-1.4.18/src/openct/proto-t1.h --- old/ccid-1.4.17/src/openct/proto-t1.h 2009-01-28 14:08:41.000000000 +0100 +++ new/ccid-1.4.18/src/openct/proto-t1.h 2014-09-13 18:27:13.000000000 +0200 @@ -17,16 +17,15 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -/* $Id: proto-t1.h 3292 2009-01-26 13:02:58Z rousseau $ */ +/* $Id: proto-t1.h 6975 2014-09-04 11:33:05Z rousseau $ */ #ifndef __PROTO_T1_H__ #define __PROTO_T1_H__ -#include "config.h" +#include <config.h> #ifdef HAVE_STDINT_H #include <stdint.h> #endif -#include <unistd.h> #include "buffer.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/parse.c new/ccid-1.4.18/src/parse.c --- old/ccid-1.4.17/src/parse.c 2013-06-12 13:56:24.000000000 +0200 +++ new/ccid-1.4.18/src/parse.c 2014-08-06 15:57:33.000000000 +0200 @@ -18,7 +18,7 @@ */ /* - * $Id: parse.c 6633 2013-05-22 14:11:37Z rousseau $ + * $Id: parse.c 6929 2014-06-17 15:26:42Z rousseau $ */ #include <stdio.h> @@ -27,6 +27,7 @@ # include <sys/types.h> # endif #include <errno.h> +#include <unistd.h> #include "defs.h" #include "ccid.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/towitoko/atr.c new/ccid-1.4.18/src/towitoko/atr.c --- old/ccid-1.4.17/src/towitoko/atr.c 2013-07-31 19:13:55.000000000 +0200 +++ new/ccid-1.4.18/src/towitoko/atr.c 2014-09-13 18:27:13.000000000 +0200 @@ -20,9 +20,12 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include <config.h> + #include "atr.h" -#include <stdlib.h> +#ifdef HAVE_STRING_H #include <string.h> +#endif #include "debug.h" /* @@ -314,32 +317,47 @@ * It was rewritten by Ludovic Rousseau, 2004 */ #define PROTOCOL_UNSET -1 -int ATR_GetDefaultProtocol(ATR_t * atr, int *protocol) +int ATR_GetDefaultProtocol(ATR_t * atr, int *protocol, int *availableProtocols) { int i; /* default value */ *protocol = PROTOCOL_UNSET; + if (availableProtocols) + *availableProtocols = 0; for (i=0; i<ATR_MAX_PROTOCOLS; i++) - if (atr->ib[i][ATR_INTERFACE_BYTE_TD].present && (PROTOCOL_UNSET == *protocol)) + if (atr->ib[i][ATR_INTERFACE_BYTE_TD].present) { - /* set to the first protocol byte found */ - *protocol = atr->ib[i][ATR_INTERFACE_BYTE_TD].value & 0x0F; - DEBUG_COMM2("default protocol: T=%d", *protocol); + int T = atr->ib[i][ATR_INTERFACE_BYTE_TD].value & 0x0F; + + DEBUG_COMM2("T=%d Protocol Found", T); + if (availableProtocols) + *availableProtocols |= 1 << T; + + if (PROTOCOL_UNSET == *protocol) + { + /* set to the first protocol byte found */ + *protocol = T; + DEBUG_COMM2("default protocol: T=%d", *protocol); + } } /* specific mode if TA2 present */ if (atr->ib[1][ATR_INTERFACE_BYTE_TA].present) { *protocol = atr->ib[1][ATR_INTERFACE_BYTE_TA].value & 0x0F; + if (availableProtocols) + *availableProtocols = 1 << *protocol; DEBUG_COMM2("specific mode found: T=%d", *protocol); } if (PROTOCOL_UNSET == *protocol) { - DEBUG_INFO("no default protocol found in ATR. Using T=0"); + DEBUG_INFO1("no default protocol found in ATR. Using T=0"); *protocol = ATR_PROTOCOL_TYPE_T0; + if (availableProtocols) + *availableProtocols = 1 << *protocol; } return ATR_OK; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/towitoko/atr.h new/ccid-1.4.18/src/towitoko/atr.h --- old/ccid-1.4.17/src/towitoko/atr.h 2009-01-07 00:14:33.000000000 +0100 +++ new/ccid-1.4.18/src/towitoko/atr.h 2014-09-13 18:27:13.000000000 +0200 @@ -101,7 +101,7 @@ /* General smartcard characteristics */ extern int ATR_GetConvention(ATR_t * atr, /*@out@*/ int *convention); -extern int ATR_GetDefaultProtocol(ATR_t * atr, /*@out@*/ int *protocol); +extern int ATR_GetDefaultProtocol(ATR_t * atr, /*@out@*/ int *protocol, int *availableProtocols); /* ATR parameters and integer values */ extern int ATR_GetIntegerValue(ATR_t * atr, int name, BYTE * value); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/towitoko/defines.h new/ccid-1.4.18/src/towitoko/defines.h --- old/ccid-1.4.17/src/towitoko/defines.h 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/towitoko/defines.h 2014-09-13 18:27:13.000000000 +0200 @@ -27,7 +27,7 @@ */ #ifdef HAVE_CONFIG_H -#include "config.h" +#include <config.h> #endif /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/towitoko/pps.c new/ccid-1.4.18/src/towitoko/pps.c --- old/ccid-1.4.17/src/towitoko/pps.c 2008-11-18 22:48:42.000000000 +0100 +++ new/ccid-1.4.18/src/towitoko/pps.c 2014-08-06 15:57:33.000000000 +0200 @@ -22,9 +22,12 @@ #include "pps.h" #include "atr.h" +#ifdef HAVE_STDLIB_H #include <stdlib.h> -#include <stdio.h> +#endif +#ifdef HAVE_STRING_H #include <string.h> +#endif #include <ifdhandler.h> #include "commands.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ccid-1.4.17/src/utils.c new/ccid-1.4.18/src/utils.c --- old/ccid-1.4.17/src/utils.c 2010-09-03 13:55:37.000000000 +0200 +++ new/ccid-1.4.18/src/utils.c 2014-09-13 18:27:13.000000000 +0200 @@ -18,12 +18,12 @@ */ /* - * $Id: utils.c 5185 2010-08-26 08:58:06Z rousseau $ + * $Id: utils.c 6975 2014-09-04 11:33:05Z rousseau $ */ #include <pcsclite.h> -#include "config.h" +#include <config.h> #include "ccid.h" #include "defs.h" #include "ccid_ifdhandler.h" -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@hilbert.suse.de