On 7/28/2010 4:59 PM, Roger Brown wrote:
But the CCID specifications appear to want little endian, which get complicated 
as it is not clear where something like the wPINMaxExtraDigit USHORT should get 
converted from one to the other The Omnikey 3821 reader I have wants the bytes 
in the order max then min, i.e. little endian.

The Solaris Sparc and Solaris Intel, MacOSX PPC and MacOSX Intel treat the 
integers used with the API itself ( eg buffer lengths and flags ) in host order.

Byte ordering of contents of APDUs etc are down to the cards you are talking 
to, control codes to talk to specific devices should ideally be hidden behind 
the API.


The situation I was running into is with the ccid-1.3.13/src/commands.c
The SecurePINVerify routine takes a TxBuffer described in PCSC part10 section
2.5.2 PIN_VERIFY. Section 2.5.1 say the structures in section 2.5 will be:
"Byte ordering is decided by machine architecture". The routine then copies
parts of the PIN_VERIFY to what USB CCID describes in section 6.1.11.2 "PIN
Verification Data Structure"  This needs to use little endian. No conversion
from machine to CCID ordering is done during the copy.

The problem is the SecurePINVerify is expecting the caller to provide the
wPINMaxExtraDigit, wLangid and ulDataLength in little endian.

The way I read pcsc part 10 is that wPINMaxExtraDigit, wLangid and ulDataLength
and any other USHORT or ULONG in any of the structures in 2.5 should be passed
in machine order, and the SecurePINVerify while copying these fields should do
the byte ordering conversion. The caller to SecurePINVerify should not be doing 
this.

The way I ran into this is the OpenSC was not doing the conversion correctly,
(and it should not have had to do it at all.) This situation only fails on big
endian machine trying to use a PIN Pad reader.

Since SecurePINVerify use a dw2i() routine to convert ulDataLength,  for testing
the length, this bug is sort of related to the topic of what is the size of a
DWORD on 64 bit machines.


_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle



--

 Douglas E. Engert  <[email protected]>
 Argonne National Laboratory
 9700 South Cass Avenue
 Argonne, Illinois  60439
 (630) 252-5444
_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to