Martin Paljak wrote:
> Hello,
> On Sep 7, 2010, at 12:45 PM, Viktor TARASOV wrote:
>   
>> in r4668 the APDU validity condition
>> 'apdu->le > 256' was replaced by 'apdu->le > card->max_recv_size'.
>>
>> It's comprehensible but revealed the ambiguity of the 'max_recv_size'.
>> The unique card's max_recv_size cannot be used to validate all the APDUs 
>> of card.
>>
>> For example, not all the cards accept Le = 256 for the 'READ BINARY' 
>> command,
>> but the same card returns 256 bytes of the signature with RSA key 2048bit.
>>     
>
> Do you mean Le encoding of 0x00 == 256 and "If Le=0x00, within the limit of 
> 256 for a short Le field , all the available bytes should be returned."
>   

In the 'init' of some card drivers there is something like 
"card->max_recv_size = 255", for example MyEID .
This card has to return 256 bytes of signature computed with 2048 bit key,
but cannot, because APDU do not pass the "apdu->le > 
card->max_recv_size" control.

>> My question is,
>> should the test 'apdu->le > card->max_recv_size' be removed from the 
>> APDU validity control,
>> or in each card driver, that can be sensible to this problem, the (for 
>> ex.) 'compute_signature' command have
>> to enveloped by change/restore of 'max_recv_size'.
>>     
>
>
> Cards that misbehave are usually exceptions. At the same time, a long time 
> ago I used to have a serial reader that could only do 24X something in one 
> go. 
>
> If a card driver limits the maximum receive size, the encoding of 0x00 would 
> mean that the card driver author knows that Le coding of "all available 
> bytes" (0x00) from the card will not be between 0..256 bytes but between 
> 0..max_recv_size bytes.
>   


-- 
Viktor Tarasov  <viktor.tara...@opentrust.com>

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to