Hello,

Bug (Rutoken S, Rutoken ECP):
$ pkcs15-init -E -C
$ pkcs15-init -E -C
$ opensc-explorer
OpenSC [3F00]> cat 2f00
00000000: 61 1F 4F 0C A0 00 00 00 63 50 4B 43 53 2D 31 35 a.O. ...cPKCS-15
00000010: 50 09 52 75 74 6F 6B 65 6E 20 53 51 04 3F 00 50 P.Rutoken SQ.?.P
00000020: 15 61 1F 4F 0C A0 00 00 00 63 50 4B 43 53 2D 31 .a.O. ...cPKCS-1
00000030: 35 50 09 52 75 74 6F 6B 65 6E 20 53 51 04 3F 00 5P.Rutoken SQ.?.
00000040: 50 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 P...............
00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
OpenSC [3F00]>

Could you please add attached patch?
Thanks
diff -u -r opensc-trunk-r3708/src/pkcs15init/pkcs15-rtecp.c 
new/opensc-trunk-r3708/src/pkcs15init/pkcs15-rtecp.c
--- opensc-trunk-r3708/src/pkcs15init/pkcs15-rtecp.c    2009-07-17 
15:25:51.000000000 +0400
+++ new/opensc-trunk-r3708/src/pkcs15init/pkcs15-rtecp.c        2009-07-17 
15:34:12.000000000 +0400
@@ -39,9 +39,14 @@
  */
 static int rtecp_erase(sc_profile_t *profile, sc_card_t *card)
 {
+       int r;
+
        if (!profile || !card)
                return SC_ERROR_INVALID_ARGUMENTS;
-       return sc_card_ctl(card, SC_CARDCTL_RTECP_INIT, NULL);
+       r = sc_card_ctl(card, SC_CARDCTL_RTECP_INIT, NULL);
+       if (r == SC_SUCCESS)
+               sc_free_apps(card);
+       return r;
 }
 
 static int create_sysdf(sc_profile_t *profile, sc_card_t *card, const char 
*name)
diff -u -r opensc-trunk-r3708/src/pkcs15init/pkcs15-rutoken.c 
new/opensc-trunk-r3708/src/pkcs15init/pkcs15-rutoken.c
--- opensc-trunk-r3708/src/pkcs15init/pkcs15-rutoken.c  2009-02-01 
11:28:51.000000000 +0300
+++ new/opensc-trunk-r3708/src/pkcs15init/pkcs15-rutoken.c      2009-07-17 
15:28:59.000000000 +0400
@@ -465,6 +465,8 @@
        }
        if (ret != SC_SUCCESS)
                sc_error(card->ctx, "Failed to erase: %s\n", sc_strerror(ret));
+       else
+               sc_free_apps(card);
        return ret;
 }
 
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to