(did not press "reply all")

Begin forwarded message:

> From: Martin Paljak <mar...@paljak.pri.ee>
> Date: September 24, 2010 2:43:32 PM GMT+03:00
> To: Douglas E. Engert <deeng...@anl.gov>
> Subject: Re: [opensc-devel] card->max_recv_size problem
> 
> Hello,
> 
> On Sep 23, 2010, at 6:28 PM, Douglas E. Engert wrote:
>> I two ran in to a problem with the card-piv.c because of this.
>> It now appears that max_recv_size = 0 implies unlimited length, but
>> should depend on if the card supports extened APDUs and an extended APDU is 
>> being requested,
>> What I would think it should mean is 256 for short APDUs and 65536 for 
>> extened.
> 
> max_recv_size=0 should imply that the card or its driver is not broken and 
> can handle Lc=255 and Le=256 for short APDU-s
> If your card driver does not need it, do not use or set card_max_recv size at 
> all in the driver.
> 
> max_recv_size was introduced and is only set by cards to values < 256, which 
> can't handle the default short APDU default lengths for some reason.
> It should not be used by default, and should only be used to limit it values 
> below 256.
> 
>> Code in card-piv.c which used to have:
>>     apdu.le = (card->max_recv_size <= rbuflen)? card->max_recv_size : 
>> rbuflen;
>>     apdu.resplen = rbuflen;
>> 
>> Was changed to:
>>     apdu.le = (card->max_recv_size > 0 && card->max_recv_size  <= rbuflen)? 
>> card->max_recv_size : rbuflen;
>>     apdu.resplen = rbuflen;
>> But this would then set apdu.le = rbuflen even if > 256.
> 
> Remove the checks from card-piv.c. They should not be needed.
> 
>> Newer cards can support APDUs, (I don't have one to try) so the code
>> will need to be changed again to use extened APDUs.
> 
> I don't know a reliable cross-platform method for checking extended APDU 
> support in the reader, so that libopensc could match SC_CARD_CAP_APDU_EXT 
> against a similar flag in the reader.
> 
> The setting should not affect extended APDU-s, if the logic is mistaken 
> somewhere, it should be fixed.
> 
> -- 
> @MartinPaljak.net
> +3725156495
> 



-- 
@MartinPaljak.net
+3725156495

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

Reply via email to