Am Sonntag 28 März 2010 22:26:57 schrieb Ludovic Rousseau: > Hello, > > In src/tools/cardos-tool.c line 1157 the function cardos_format() is > called as: if ((err = cardos_format(opt_startkey))) { > > But the definitions of cardos_format() are > line 502 with OpenSSL > static int cardos_format() > > line 843 without OpenSSL > static int cardos_format() > > cardos_format() is called with a startkey parameter but this parameter > is not used. What is the correct solution? > I think cardos_format() should check the parameter and use it as > startkey instead of the default startkey.
attached is a patch to accept the parameter and abort ("not implemented"). the correct solution of course would be to accept the parameter and evaluate it: the user needs to specify a one byte index value "ii" in hex (and we need to verify the current startkey has that value), and a 16 byte startkey in hex (and we need to use that instead of the 16 byte 0xff default we have). Regards, Andreas
Index: src/tools/cardos-tool.c =================================================================== --- src/tools/cardos-tool.c (revision 4187) +++ src/tools/cardos-tool.c (working copy) @@ -499,19 +499,28 @@ #endif #ifdef ENABLE_OPENSSL -static int cardos_format() +static int cardos_format(const char *opt_startkey) {) { - unsigned const char startkey[] = { + unsigned char startkey[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; sc_apdu_t apdu; u8 rbuf[256]; int r; + + if (opt_startkey) { + fprintf(stderr,"startkey option not implemented yet, aborting!\n"); + return 1; + /* TODO: instead validate/parse opt_startkey into startkey */ + /* format would be ii:vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv */ + /* with "ii" the startkey index as hex number and */ + /* "vv" the 16 byte value in hex (32 chars) */ + } if (verbose) { printf ("StartKey:\n"); util_hex_dump_asc(stdout, startkey, 16, -1); - } + } /* use GET DATA for version - 00 ca 01 82 * returns e.g. c8 09 for 4.2B @@ -840,7 +849,7 @@ return 0; } # else /* ENABLE_OPENSSL */ -static int cardos_format() +static int cardos_format(const char *opt_startkey) { printf("this code needs to be compiled with openssl support enabled.\n"); printf("aborting\n");
_______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel