From: Iain M. <mu...@ds...> - 2006-03-26 21:17:33
|
Iain MacDonnell wrote on 03/26/06 01:02 PM: > > > Karsten Ohme wrote on 03/24/06 10:14 PM: >> Karsten Ohme wrote: >>> Karsten Ohme wrote: >>> >>>> Iain MacDonnell wrote: >>> >>>>>> BTW, I've run into what appears to be a bigger problem - have you >>>>>> ever >>>>>> tried this stuff on a big-endian machine? >>>>>> >>>>>> # /opt/ITmuscle/bin/gpshell list-cflex.txt >>>>>> mode_201 >>>>>> enable_trace >>>>>> establish_context >>>>>> card_connect >>>>>> select -AID a0000000030000 >>>>>> --> 00A404000700000000000000 >>>>> >>>>> Note that the AID is not showing in this APDU... compared to below.... >>>> >>>> Mmmh, this is a bigger problem. I will see to fix the conversion >>>> routines, if something like this is used, I'm not sure. >> >> This could be the guilty routine (?): >> >> It scans two bytes interpreted as a hex byte: >> >> while (sscanf (&(dummy[i*2]), "%02x", &(pOptionStr->AID[i])) > 0) { >> i++; >> } > > I think it's a length issue - changing that to: > > while (sscanf (&(dummy[i*2]), "%02hhx", &(pOptionStr->AID[i])) > 0) > > seems to fix it (for 'select') - the subsequent 'open_sc' fails, but > I'm sure the fix needs to be applied to all of the other sscanf() > calls - eg for '-mac_key'. PS. With all the other sscanf()s updated, it works: # /opt/ITmuscle/bin/gpshell list-cflex.txt mode_201 enable_trace establish_context card_connect * reader name Sun Blade Internal Reader 00 00 select -AID a0000000030000 dummy contains: a0000000030000 Scanned: 0xffffffa0 Scanned: 0x00 Scanned: 0x00 Scanned: 0x00 Scanned: 0x03 Scanned: 0x00 Scanned: 0x00 before call to select_application(), AID contains: 0xffffffa0 0x00 0x00 0x00 0x03 0x00 0x00 --> 00A4040007A0000000030000 <-- 6F188407A0000000030000A50D9F6E060005020201009F6501FF9000 open_sc -security 1 -keyind 0 -keyver 0 -mac_key 404142434445464748494a4b4c4d4e4f -enc_key 404142434445464748494a4b4c4d4e4f // Open secure channel --> 8050000008FD52267414E5D74B00 <-- 000012010000111401020101231A0475140D188F9ED8361696BFA3BD9000 --> 84820100100FA8513CBB26A89266FF1C959343E004 <-- 9000 get_status -element e0 --> 80F2E000024F0000 <-- 07A0000000030000070007A0000000620001010007A0000000620101010007A0000000620102010007A0000000620201010007A0000000030000010005A000000001010006A0000000010107009000 OP201_get_status() returned 8 items List of applets (AID state privileges) a0000000030000 7 0 a0000000620001 1 0 a0000000620101 1 0 a0000000620102 1 0 a0000000620201 1 0 a0000000030000 1 0 a000000001 1 0 a00000000101 7 0 card_disconnect release_context # Really leaving now :) ~Iain |