List Info

Thread: T1 protocol implementation for > 256 byte response




T1 protocol implementation for > 256 byte response
user name
2006-09-27 03:32:36
I tried new ifd-eutron.c with 2048 bit key decryption and
ran into an 
issue in t1-proto.c.

Please take a look at the following patch. It restores
regression 
introduced by new Eutron driver for decryption with 2048 bit
key. 
Without this change the code bellow fails with "receive
buffer too 
small". This is because Eutron driver now sets T1
protocol.

It seems to me that values 0-254 are valid inclusively for
T1 
information field. The constant T1_BUFFER_SIZE defined in
this file 
agrees with this change.

Am I correct in the following change? Thank you.

[andreytcm openct-cvs]$ diff -up -U 10 src/ifd/proto-t1.c 
src/ifd/proto-t1.c-fixed
--- src/ifd/proto-t1.c  2006-09-26 20:12:32.000000000 -0700
+++ src/ifd/proto-t1.c-fixed    2006-09-26
20:12:24.000000000 -0700
 -555,21
+555,21  int t1_xcv(t1_state_t * t1, unsigned cha
                         m = block[2] + 3 + t1->rc_bytes;
                         if (m < n)
                                 n = m;
                 }
         } else {
                 /* Get the header */
                 if (ifd_recv_response(prot, block, 3,
timeout) < 0)
                         return -1;

                 n = block[2] + t1->rc_bytes;
-               if (n + 3 > rmax || block[2] >= 254) {
+               if (n + 3 > rmax || block[2] > 254) {
                         ct_error("receive buffer too
small");
                         return -1;
                 }

                 /* Now get the rest */
                 if (ifd_recv_response(prot, block + 3, n,
t1->timeout) < 0)
                         return -1;

                 n += 3;
         }
_______________________________________________
opensc-devel mailing list
opensc-devellists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc
-devel
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )