---------------------
PatchSet 2046
Date: 1970/01/01 01:33:25
Author: sth
Branch: HEAD
Tag: (none)
Log:
Have the option add a delay before resending an APDU (after a 6CXX response). Is needed for most current belpic cards on fast readers
Members:
src/include/winconfig.h:1.17->1.18
src/libopensc/card-belpic.c:1.3->1.4
src/libopensc/card.c:1.73->1.74
src/libopensc/opensc.h:1.143->1.144
RCS file: /cvsroot/opensc/src/include/winconfig.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
|
|
|
|
| 54 | 54 | |
| 55 | 55 | #define PATH_MAX _MAX_PATH |
| 56 | 56 | |
| 57 | | #define sleep(t) Sleep((t) * 1000) |
| 58 | | |
| 59 | 57 | #ifndef VERSION |
| 60 | 58 | #define VERSION "0.9.4" |
| 61 | 59 | #endif |
RCS file: /cvsroot/opensc/src/libopensc/card-belpic.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
|
|
|
|
| 1008 | 1008 | SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE, 0); |
| 1009 | 1009 | } |
| 1010 | 1010 | |
| | 1011 | /* V1 applets have a problem: if the card sends a 6C XX (only XX bytes available), |
| | 1012 | * and we resend the command too soon (i.e. the reader is too fast), the card |
| | 1013 | * doesn't respond. So we build in a delay. */ |
| | 1014 | card->wait_resend_apdu = 40; |
| | 1015 | |
| 1011 | 1016 | /* State that we have an RNG */ |
| 1012 | 1017 | card->caps |= SC_CARD_CAP_RNG; |
| 1013 | 1018 | |
RCS file: /cvsroot/opensc/src/libopensc/card.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
|
|
|
|
| 260 | 260 | if (apdu->sw1 == 0x6C && apdu->resplen == 0) { |
| 261 | 261 | apdu->resplen = orig_resplen; |
| 262 | 262 | apdu->le = apdu->sw2; |
| | 263 | /* Fix for cards (e.g. belpic) that need a delay on fast readers */ |
| | 264 | if (card->wait_resend_apdu != 0) |
| | 265 | msleep(card->wait_resend_apdu); |
| 263 | 266 | r = sc_transceive(card, apdu); |
| 264 | 267 | if (r != 0) { |
| 265 | 268 | sc_unlock(card); |
RCS file: /cvsroot/opensc/src/libopensc/opensc.h,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
|
|
|
|
| 179 | 179 | /* A 64-bit uint, used in sc_current_time() */ |
| 180 | 180 | #ifndef _WIN32 |
| 181 | 181 | typedef unsigned long long sc_timestamp_t; |
| | 182 | #define msleep(t) usleep((t) * 1000) |
| 182 | 183 | #else |
| 183 | 184 | typedef unsigned __int64 sc_timestamp_t; |
| | 185 | #define msleep(t) Sleep(t) |
| | 186 | #define sleep(t) Sleep((t) * 1000) |
| 184 | 187 | #endif |
| 185 | 188 | |
| 186 | 189 | /* Event masks for sc_wait_for_event() */ |
| … |
… |
|
| 440 | 443 | struct sc_slot_info *slot; |
| 441 | 444 | |
| 442 | 445 | unsigned long caps, flags; |
| | 446 | unsigned int wait_resend_apdu; /* Delay (msec) before responding to an SW12 = 6CXX */ |
| 443 | 447 | int cla; |
| 444 | 448 | u8 atr[SC_MAX_ATR_SIZE]; |
| 445 | 449 | size_t atr_len; |