Peter Koch wrote:
Hi Martin!
2010/9/13 Martin Paljak <mar...@paljak.pri.ee
<mailto:mar...@paljak.pri.ee>>
> Should I set card->max_recv_size and card->max_send_size
> in tcos_init()?
>
No. Sorry, this place was erroneously left untouched and is fixed
in SVN trunk. Please verify that it works as expected.
Not yet! I had to replace line 122 of iso7816.c
> assert(count <= card->max_recv_size);
by
> assert(count <= card->max_recv_size>0 ? card->max_recv_size : 256);
And then everything worked as expected.
The same concerns 'max_send_size'.
Attached diff that 'works for me' for the 'update_binary' operation.
Peter
------------------------------------------------------------------------
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel
--
Viktor Tarasov <viktor.tara...@opentrust.com>
Index: src/libopensc/card.c
===================================================================
--- src/libopensc/card.c (révision 4720)
+++ src/libopensc/card.c (copie de travail)
@@ -489,12 +489,11 @@
int sc_update_binary(sc_card_t *card, unsigned int idx,
const u8 *buf, size_t count, unsigned long flags)
{
- size_t max_lc = card->max_send_size;
+ size_t max_lc = card->max_send_size > 0 ? card->max_send_size : 255;
int r;
assert(card != NULL && card->ops != NULL && buf != NULL);
- sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,
- "called; %d bytes at index %d\n", count, idx);
+ sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "called; %d bytes at index
%d\n", count, idx);
if (count == 0)
return 0;
if (card->ops->update_binary == NULL)
Index: src/libopensc/iso7816.c
===================================================================
--- src/libopensc/iso7816.c (révision 4720)
+++ src/libopensc/iso7816.c (copie de travail)
@@ -119,7 +119,7 @@
return SC_ERROR_OFFSET_TOO_LARGE;
}
- assert(count <= card->max_recv_size);
+ assert(count <= (card->max_recv_size > 0 ? card->max_recv_size : 256));
sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xB0,
(idx >> 8) & 0x7F, idx & 0xFF);
apdu.le = count;
@@ -247,7 +247,7 @@
sc_apdu_t apdu;
int r;
- assert(count <= card->max_send_size);
+ assert(count <= (card->max_send_size > 0 ? card->max_send_size : 255));
if (idx > 0x7fff) {
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "invalid EF offset:
0x%X > 0x7FFF", idx);
@@ -274,7 +274,7 @@
sc_apdu_t apdu;
int r;
- assert(count <= card->max_send_size);
+ assert(count <= (card->max_send_size > 0 ? card->max_send_size : 255));
if (idx > 0x7fff) {
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "invalid EF offset:
0x%X > 0x7FFF", idx);
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel