mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-21 05:43:23 -07:00
Add support for standard USB Smartcard Readers (#765)
* add PCSC interface (pcsc.c and pcsc.h) * new command 'sc select' to choose an USB Smartcard Reader * updated CI/.travis.yml accordingly * remove TCK CRC check in i2c.c It is done in PrintATR() anyway * Fix TCK CRC check in PrintATR() * Add PCSC reader support to 'sc info'
This commit is contained in:
parent
1511ea28a8
commit
a9104f7e31
14 changed files with 382 additions and 93 deletions
22
armsrc/i2c.c
22
armsrc/i2c.c
|
@ -656,28 +656,6 @@ static bool GetATR(smart_card_atr_t *card_ptr) {
|
|||
if ( !sc_rx_bytes(card_ptr->atr, &len) )
|
||||
return false;
|
||||
|
||||
uint8_t pos_td = 1;
|
||||
if ( (card_ptr->atr[1] & 0x10) == 0x10) pos_td++;
|
||||
if ( (card_ptr->atr[1] & 0x20) == 0x20) pos_td++;
|
||||
if ( (card_ptr->atr[1] & 0x40) == 0x40) pos_td++;
|
||||
|
||||
// T0 indicate presence T=0 vs T=1. T=1 has checksum TCK
|
||||
if ( (card_ptr->atr[1] & 0x80) == 0x80) {
|
||||
|
||||
pos_td++;
|
||||
|
||||
// 1 == T1 , presence of checksum TCK
|
||||
if ( (card_ptr->atr[pos_td] & 0x01) == 0x01) {
|
||||
uint8_t chksum = 0;
|
||||
// xor property. will be zero when xored with chksum.
|
||||
for (uint8_t i = 1; i < len; ++i)
|
||||
chksum ^= card_ptr->atr[i];
|
||||
if ( chksum ) {
|
||||
if ( MF_DBGLEVEL > 2) DbpString("Wrong ATR checksum");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
card_ptr->atr_len = len;
|
||||
LogTrace(card_ptr->atr, card_ptr->atr_len, 0, 0, NULL, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue