Apple Bug not resolved, retry more than once (up to 100 times); refs #34
This commit is contained in:
		
							
								
								
									
										24
									
								
								src/pcsc.hxx
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								src/pcsc.hxx
									
									
									
									
									
								
							| @@ -320,22 +320,28 @@ namespace pcsc { | ||||
|                          reconnect, first transaction (SCardTransmit) | ||||
|                          fails with SCARD_W_RESET_CARD | ||||
|                          (0x80100068). */ | ||||
|                 if (_state==SCARD_W_RESET_CARD) { // just resend once | ||||
|                 for (int bugCnt(0); | ||||
|                      bugCnt<100 && _state==SCARD_W_RESET_CARD; | ||||
|                      ++bugCnt) { // just try to resend | ||||
|                   CRYPTOLOG("Mac OS X 10.10 implementation bug: " | ||||
|                             "On Mac OSX 10.10 there is a bug in " | ||||
|                             "PCSC: After a reconnect, first " | ||||
|                             "transaction (SCardTransmit) fails " | ||||
|                             "with SCARD_W_RESET_CARD (0x80100068). " | ||||
|                             "Retry once."); | ||||
|                   check(SCardTransmit(_id, &rPci, | ||||
|                                       (LPCBYTE)in.c_str(), | ||||
|                                       in.size(), | ||||
|                                       0, buff, &len), | ||||
|                         "smartcard transmit message "+crypto::hex(in)); | ||||
|                             "Retry Nr. "<<bugCnt); | ||||
|                   try { | ||||
|                     check(SCardTransmit(_id, &rPci, | ||||
|                                         (LPCBYTE)in.c_str(), | ||||
|                                         in.size(), | ||||
|                                         0, buff, &len), | ||||
|                           "smartcard transmit resend message "+crypto::hex(in)); | ||||
|                   } catch (...) { | ||||
|                     continue; // try again | ||||
|                   } | ||||
|                   break; // success | ||||
|                 } | ||||
| #             else | ||||
|                 throw; // just rethrow otherwise | ||||
| #             endif | ||||
|               throw; // just rethrow otherwise | ||||
|             } | ||||
|             //CRYPTOLOG(" -> "<<crypto::hex(std::string((char*)buff, len))); | ||||
|             return std::string((char*)buff, len); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user