Hi.

Correct, this is a bug. I've never used GLP PINs and apparently no one  
else tried them either until now.

Fixed in [3664]

Thanks,
Martin

On 11.03.2009, at 20:45, Alon Bar-Lev wrote:

> Great work!
> Can someone confirm current hardware still works?
> I never had PINPAD reader to play with.
>
> Alon.
>
> On Wed, Mar 11, 2009 at 11:13 AM, Fleblanc <francois.lebl...@cev-sa.com 
> > wrote:
>>
>> Hi there,
>>
>> I can confirm now, it's an issue (see below), it must be
>>
>> tmp |= 0x08 << 3;
>>
>> since the pin code start 8 bits after lc ...
>>
>> The same apply for 'part10_build_modify_pin_block'
>>
>> line 1164, must be tmp |= 0x04 << 3;
>>
>> and line 1189 must be
>>
>> pin_modify->bInsertionOffsetNew = 0x08;  /* bOffsetNew */
>>
>> pin_modify->bInsertionOffsetNew = 0x00;  /* bOffsetNew */
>>
>> Perhaps bInsertionOffsetNew = 0x08 only for SC_PIN_ENCODING_GLP ...
>>
>> Regards
>>
>> François Leblanc.
>>
>>
>>
>> Fleblanc a écrit :
>>>
>>> After testing I'm happy with SCardControl it's work fine now, but  
>>> I have
>>> possibly an another
>>>
>>> issue in  "reader-pcsc.c"  in "part10_build_verify_pin_block"  
>>> function in
>>> line 1073, the code is
>>>
>>>   } else if (data->pin1.encoding == SC_PIN_ENCODING_GLP) {
>>>       /* see comment about GLP pins in sec.c */
>>>       tmp |= SC_CCID_PIN_ENCODING_BCD;
>>>       tmp |= 0x04 << 3;
>>>   } else
>>>       return SC_ERROR_NOT_SUPPORTED;
>>>
>>> in order to set 'bmFormatString'  of PIN_VERIFY_STRUCTURE this  
>>> field is
>>> defined in
>>>
>>> http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.pdf
>>>
>>> and Bit 6 – 3 Define the PIN position after format in the APDU  
>>> command
>>> (relative to the first data after Lc).
>>> The position is based on the system units’ type indicator  
>>> (maximum1111 for
>>> fifteen system units).
>>>
>>> So for SC_PIN_ENCODING_GLP you get tthe value:
>>>
>>> 0x04 << 3  | SC_CCID_PIN_ENCODING_BCD = 0x21
>>>
>>> and I think it should be 0x41 because the pin position after lc is  
>>> 8 bits
>>>
>>> ex: pin GPL 5432 is  24:54:32:FF:FF:FF:FF:FF
>>>
>>> apdu to verify will be:
>>>
>>> 00 20 00 00 08 24 54 32 FF FF FF FF FF
>>>
>>> so pin start at lc + 8 bits...
>>>
>>> This, the code should be:
>>>
>>> tmp |= 0x08 << 3;
>>>
>>> Of course I've a reader that work with bmFormatString = 0x41 and  
>>> not with
>>> bmFormatString = 0x21
>>>
>>> but it maybe an error on the firmware of this reader, I have only  
>>> one king
>>> of reader for testing ...
>>>
>>> What do you think about this?
>>>
>>> Regards
>>>
>>> François Leblanc.
>>>
>>>
>>> Fleblanc a écrit :
>>>>
>>>> Thank you , I will try it ...
>>>>
>>>> François Leblanc.
>>>>
>>>> Alon Bar-Lev a écrit :
>>>>
>>>>>
>>>>> Thank you, fixed in r3662.
>>>>> And build-004 was released with this fix.
>>>>>
>>>>> Alon.
>>>>>
>>>>> On Wed, Feb 25, 2009 at 11:27 AM, Fleblanc <francois.lebl...@cev-sa.com 
>>>>> >
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Opensc release 0.11.6
>>>>>>
>>>>>> Platform Windows XP
>>>>>>
>>>>>> Reader XIRING CCID with pinpad
>>>>>>
>>>>>>
>>>>>> Two things:
>>>>>>
>>>>>> First when I connect this reader and other  PCSC readers when I  
>>>>>> use
>>>>>> pkcs15-tool  I have the message "Card not present"
>>>>>>
>>>>>> In other word, the XIRING reader with pinpad must be alone to  
>>>>>> work...
>>>>>>
>>>>>> Second, I have absolutly no idea why but SCardControl fail with  
>>>>>> code 1
>>>>>> ...
>>>>>>
>>>>>> I have a look to the code all seems good but...
>>>>>>
>>>>>> I've tryed sample program and it's working fine but in opensc  
>>>>>> not, it's
>>>>>> amazing:
>>>>>>
>>>>>> [westcos-tool.exe] reader-pcsc.c:565:pcsc_connect: Requesting  
>>>>>> reader
>>>>>> features ...
>>>>>> [westcos-tool.exe] reader-pcsc.c:618:pcsc_connect: SCardControl  
>>>>>> failed
>>>>>> 1
>>>>>>
>>>>>> Does anyone have some problem too with pcsc on windows?
>>>>>>
>>>>>> Regards.
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>
>>
>> --- reader-pcsc.c       2009-02-01 09:28:52.000000000 +0100
>> +++ new_reader-pcsc.c   2009-03-11 10:03:18.000000000 +0100
>> @@ -1070,7 +1070,7 @@
>>        } else if (data->pin1.encoding == SC_PIN_ENCODING_GLP) {
>>                /* see comment about GLP pins in sec.c */
>>                tmp |= SC_CCID_PIN_ENCODING_BCD;
>> -               tmp |= 0x04 << 3;
>> +               tmp |= 0x08 << 3;
>>        } else
>>                return SC_ERROR_NOT_SUPPORTED;
>>
>> @@ -1161,7 +1161,7 @@
>>        } else if (data->pin1.encoding == SC_PIN_ENCODING_GLP) {
>>                /* see comment about GLP pins in sec.c */
>>                tmp |= SC_CCID_PIN_ENCODING_BCD;
>> -               tmp |= 0x04 << 3;
>> +               tmp |= 0x08 << 3;
>>        } else
>>                return SC_ERROR_NOT_SUPPORTED;
>>
>> @@ -1185,9 +1185,15 @@
>>        }
>>        pin_modify->bmPINLengthFormat = tmp;    /* bmPINLengthFormat  
>> */
>>
>> -       pin_modify->bInsertionOffsetOld = 0x00;  /* bOffsetOld */
>> -       pin_modify->bInsertionOffsetNew = 0x00;  /* bOffsetNew */
>> -
>> +       if (data->pin1.encoding == SC_PIN_ENCODING_GLP) {
>> +               pin_modify->bInsertionOffsetOld = 0x00;  /*  
>> bOffsetOld */
>> +               pin_modify->bInsertionOffsetNew = 0x08;  /*  
>> bOffsetNew */
>> +       }
>> +       else {
>> +               pin_modify->bInsertionOffsetOld = 0x00;  /*  
>> bOffsetOld */
>> +               pin_modify->bInsertionOffsetNew = 0x00;  /*  
>> bOffsetNew */
>> +       }
>> +
>>        if (!data->pin1.min_length || !data->pin1.max_length)
>>                return SC_ERROR_INVALID_ARGUMENTS;
>>
>>
>> _______________________________________________
>> 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

-- 
Martin Paljak
http://martin.paljak.pri.ee
+372.515.6495




_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to