patch to Oberthur SC: 'list file' command changed

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

patch to Oberthur SC: 'list file' command changed

Tarasov Viktor
Hello,

there is a patch proposal for the Oberthur smartcard support.

Starting from the Oberthur card 'CosmopolIC v5.2' the applet 'AuthentIC 2.2'
has been slightly changed. Now, when the command 'list file' is applied
to the empty
DF, the answer is 256 bytes of 0x00. In the previous version the answer
length was zero.

This patch, includes also the ATRs of the new card.

Kind wishes,
Viktor.





diff -NaurbB ../opensc-0.9.6.orig/src/libopensc/card-oberthur.c ../opensc-0.9.6/src/libopensc/card-oberthur.c
--- ../opensc-0.9.6.orig/src/libopensc/card-oberthur.c 2005-04-14 11:02:15.000000000 +0200
+++ ../opensc-0.9.6/src/libopensc/card-oberthur.c 2005-08-08 15:23:17.000000000 +0200
@@ -67,6 +67,9 @@
  { "Oberthur 64k v5/2.2.0", ATR_OBERTHUR_64K, 18,
   "\x3B\x7D\x11\x00\x00\x00\x31\x80\x71\x8E\x64\x77\xE3\x02\x00\x82\x90\x00"
  },
+ { "Oberthur 64k CosmopolIC v5.2/2.2", ATR_OBERTHUR_64K, 16,
+  "\x3B\x7B\x18\x00\x00\x00\x31\xC0\x64\x77\xE3\x03\x00\x82\x90\x00"
+ },
  { NULL, 0, 0, NULL }
 };
 
@@ -791,6 +794,9 @@
  rv = sc_check_sw(card, apdu.sw1, apdu.sw2);
  SC_TEST_RET(card->ctx, rv, "Card returned error");
 
+    if (apdu.resplen == 0x100 && rbuf[0]==0 && rbuf[1]==0)
+ return 0;
+
  buflen = buflen < apdu.resplen ? buflen : apdu.resplen;
  memcpy(buf, rbuf, buflen);
 

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Nils Larsch
Tarasov Viktor wrote:
> Hello,
>
> there is a patch proposal for the Oberthur smartcard support.

both committed, please test the current svn trunk.

Thanks,
Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Tarasov Viktor
Nils Larsch wrote:

> Tarasov Viktor wrote:
>
>> Hello,
>>
>> there is a patch proposal for the Oberthur smartcard support.
>
>
> both committed, please test the current svn trunk.

Thank you.

It's 'almost' OK  ;-) .

It's working if I do not use the new style pin command 'pin_cmd'.
This implementation appeared in Oberthur libopensc driver, AFAIS,
in the trunk version and is not yet completely functional.
I will correct it.




Maximal PIN length of the Oberthur card is 64 bytes.
That's why this little patch:
--- ./trunk/src/tools/opensc-explorer.c.orig    2005-08-09
15:05:22.000000000 +0200
+++ ./trunk/src/tools/opensc-explorer.c 2005-08-09 15:06:09.000000000 +0200
@@ -595,7 +595,7 @@
                { NULL,         SC_AC_NONE      }
        };
        int r, tries_left = -1;
-       u8 buf[30];
+       u8 buf[0x40];
        const char *s;
        size_t buflen = sizeof(buf), i;
        struct sc_pin_cmd_data data;

Best regards,
Viktor.


>
> Thanks,
> Nils
>
>

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Nils Larsch
Tarasov Viktor wrote:
...
> It's working if I do not use the new style pin command 'pin_cmd'.
> This implementation appeared in Oberthur libopensc driver, AFAIS,
> in the trunk version and is not yet completely functional.
> I will correct it.

what's the problem ?

> Maximal PIN length of the Oberthur card is 64 bytes.
> That's why this little patch:
> --- ./trunk/src/tools/opensc-explorer.c.orig    2005-08-09
> 15:05:22.000000000 +0200
> +++ ./trunk/src/tools/opensc-explorer.c 2005-08-09 15:06:09.000000000 +0200
> @@ -595,7 +595,7 @@
>                 { NULL,         SC_AC_NONE      }
>         };
>         int r, tries_left = -1;
> -       u8 buf[30];
> +       u8 buf[0x40];
>         const char *s;
>         size_t buflen = sizeof(buf), i;
>         struct sc_pin_cmd_data data;

ok, committed (in decimal notation).

Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Tarasov Viktor
Nils Larsch wrote:

> Tarasov Viktor wrote:
> ...
>
>> It's working if I do not use the new style pin command 'pin_cmd'.
>> This implementation appeared in Oberthur libopensc driver, AFAIS,
>> in the trunk version and is not yet completely functional.
>> I will correct it.
>
>
> what's the problem ?

It works when using PIN, but not when using SOPIN.

Viktor.

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Nils Larsch
Tarasov Viktor wrote:

> Nils Larsch wrote:
>
>
>>Tarasov Viktor wrote:
>>...
>>
>>
>>>It's working if I do not use the new style pin command 'pin_cmd'.
>>>This implementation appeared in Oberthur libopensc driver, AFAIS,
>>>in the trunk version and is not yet completely functional.
>>>I will correct it.
>>
>>
>>what's the problem ?
>
>
> It works when using PIN, but not when using SOPIN.

and what's the problem when verifying a sopin ? ;-)

Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: patch to Oberthur SC: 'list file' command changed

Tarasov Viktor
Nils Larsch wrote:

> Tarasov Viktor wrote:
>
>> Nils Larsch wrote:
>>
>>
>>> Tarasov Viktor wrote:
>>> ...
>>>
>>>
>>>> It's working if I do not use the new style pin command 'pin_cmd'.
>>>> This implementation appeared in Oberthur libopensc driver, AFAIS,
>>>> in the trunk version and is not yet completely functional.
>>>> I will correct it.
>>>
>>>
>>>
>>> what's the problem ?
>>
>>
>>
>> It works when using PIN, but not when using SOPIN.
>
>
> and what's the problem when verifying a sopin ? ;-)

Sorry,

in Oberthur card support, both PIN and SOPIN have CHV type.
The difference is in 'reference'.
The actual implementation of 'pin_cmd' have a fixed (to the PIN ref.)
reference value.

Trunk version of Oberthur's 'pin_cmd' use finally the iso7816 procedures.
Actual Oberthur's libopensc use rather specific PIN control.
(I agree, it's not quite good and this driver can be changed to use
standard procedures, but )
For 'historical' reasons (mostly because I need to keep compatibility
with native Oberthur middleware),
the xPIN codes are always padded with 0xFF until the
maximal possible length (64 bytes). Now this padding is done by Oberthur
libopensc driver.
Strictly speaking, PIN padding is not a problem for the pkcs15-*
applications,
but for the other ones (like opensc-explorer) it's a little bit
cumbersome to use explicit PIN padding.

Then, there is some 'exotic' ACLs like 'PIN or SOPIN', 'PIN or
OneTime-PIN', and so on.
That's why, for a moment, I prefere the card specific PIN control.

Kind wishes,
Viktor.


>
> Nils
>
>

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel