From: Iain M. <mu...@ds...> - 2006-03-26 21:02:33
|
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'. Length Modifiers The length modifiers and their meanings are: hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies to an argument with type pointer to signed char or unsigned char. ~Iain |