Andreas Jellinghaus wrote:
Nils Larsch wrote:
the code in apdu.c should do this automatically unless you explicitly
disable this (but perhaps it would be useful if the iso get_response
implementation would respect the reader limits).
that code doesn't look at max_send/recv_size. if the card tells us
it has 256 bytes, the code tries to get it in one big packet. so
we need to change the code there? or did I misread it?
IMHO we need to change the iso get_response() implementation
(apdu.c around line 473, le is set to 256 bytes and never reduced
before get_response is called)
this is not problem as get_response() can read less, the code in
apdu.c should try to call get_response() until everything is read.
Does the attached patch help ?
Cheers,
Nils
PS: Perhaps we should put max_recv_size in sc_reader_t as this is
a property of the reader ...
Index: src/libopensc/iso7816.c
===================================================================
--- src/libopensc/iso7816.c (Revision 3057)
+++ src/libopensc/iso7816.c (Arbeitskopie)
@@ -581,10 +581,17 @@
{
sc_apdu_t apdu;
int r;
+ size_t rlen;
+ /* request at most max_recv_size bytes */
+ if (*count > card->max_recv_size)
+ rlen = card->max_recv_size;
+ else
+ rlen = *count;
+
sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xC0, 0x00, 0x00);
- apdu.le = *count;
- apdu.resplen = *count;
+ apdu.le = rlen;
+ apdu.resplen = rlen;
apdu.resp = buf;
/* don't call GET RESPONSE recursively */
apdu.flags |= SC_APDU_FLAGS_NO_GET_RESP;
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel