|
trivial fix: flex init: add a msleep: msg#00016encryption.opensc.devel
We are too fast for windows, the card needs a small sleep in the init function or it will return an error. This fix is for OPENSC_0_9 and also ports back the msleep() code and a similiar sleep that was used for the belpic card. I'd like to add the msleep to head, and the whole diff to OPENSC_0_9 ok? Andreas diff -udrNP opensc-0.9.5/src/libopensc/card.c opensc-0.9.5-aj1/src/libopensc/card.c --- opensc-0.9.5/src/libopensc/card.c 2005-01-12 22:40:08.000000000 +0100 +++ opensc-0.9.5-aj1/src/libopensc/card.c 2005-02-09 11:11:54.000000000 +0100 @@ -251,6 +251,9 @@ if (apdu->sw1 == 0x6C && apdu->resplen == 0) { apdu->resplen = orig_resplen; apdu->le = apdu->sw2; + /* Fix for cards (e.g. belpic) that need a delay on fast readers */ + if (card->wait_resend_apdu != 0) + msleep(card->wait_resend_apdu); r = sc_transceive(card, apdu); if (r != 0) { sc_unlock(card); diff -udrNP opensc-0.9.5/src/libopensc/card-flex.c opensc-0.9.5-aj1/src/libopensc/card-flex.c --- opensc-0.9.5/src/libopensc/card-flex.c 2005-01-12 22:40:08.000000000 +0100 +++ opensc-0.9.5-aj1/src/libopensc/card-flex.c 2005-02-09 17:32:45.000000000 +0100 @@ -222,6 +222,10 @@ _sc_card_add_rsa_alg(card, 2048, flags, 0); } + /* SCardTransmit failed: 8010002f + * this can be solved with a small delay. */ + msleep(100); + /* State that we have an RNG */ card->caps |= SC_CARD_CAP_RNG; diff -udrNP opensc-0.9.5/src/libopensc/opensc.h opensc-0.9.5-aj1/src/libopensc/opensc.h --- opensc-0.9.5/src/libopensc/opensc.h 2005-01-12 22:40:08.000000000 +0100 +++ opensc-0.9.5-aj1/src/libopensc/opensc.h 2005-02-09 11:11:54.000000000 +0100 @@ -179,8 +179,11 @@ /* A 64-bit uint, used in sc_current_time() */ #ifndef _WIN32 typedef unsigned long long sc_timestamp_t; +#define msleep(t) usleep((t) * 1000) #else typedef unsigned __int64 sc_timestamp_t; +#define msleep(t) Sleep(t) +#define sleep(t) Sleep((t) * 1000) #endif /* Event masks for sc_wait_for_event() */ @@ -432,6 +435,7 @@ struct sc_slot_info *slot; unsigned long caps, flags; + unsigned int wait_resend_apdu; /* Delay (msec) before responding to an SW12 = 6CXX */ int cla; u8 atr[SC_MAX_ATR_SIZE]; size_t atr_len; @@ -610,6 +614,8 @@ sc_mutex_t *mutex; unsigned int magic; + + char *profile_dir; }; typedef struct sc_context sc_context_t; -- ---------------------[ Ciphire Signature ]---------------------- From: aj@xxxxxxxxxxxxxxx signed email body (1968 characters) Date: on 02 March 2005 at 23:16:13 UTC To: opensc-devel@xxxxxxxxxx ---------------------------------------------------------------- : Ciphire has secured this email against identity theft. : Free download at www.ciphire.com. The garbled lines : below are the sender's verifiable digital signature. ---------------------------------------------------------------- 00fAAAAAEAAAA9SSZCsAcAACICAAIAAgACACBQ2JmUgw78JvBqhaOBPOsMFbVDS6 UaQIxcChG5IhzQhgEA0eMp7V0xI9MrMhC47uaTDnnuTnqi6z9oLEuev70rCXtd0x d5LZX1hgPISRippleizfiDI5S5tN2F8LB9/e8S2w== ------------------[ End Ciphire Signed Message ]---------------- |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | eToken Pro openSSH: 00016, Boris von Alten Blaskowitz |
|---|---|
| Next by Date: | config file / profile file handling: 00016, Andreas Jellinghaus |
| Previous by Thread: | eToken Pro openSSHi: 00016, Boris von Alten Blaskowitz |
| Next by Thread: | Re: trivial fix: flex init: add a msleep: 00016, Andreas Jellinghaus |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |