mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-24 07:05:40 -07:00
Revert DropField commit
This commit is contained in:
parent
c1ba18db8d
commit
0bcc2a9025
1 changed files with 1 additions and 29 deletions
|
@ -246,20 +246,17 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
||||||
|
|
||||||
if (select_status == 0) {
|
if (select_status == 0) {
|
||||||
PrintAndLogEx(ERR, "E->iso14443a card select failed");
|
PrintAndLogEx(ERR, "E->iso14443a card select failed");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_status == 2) {
|
if (select_status == 2) {
|
||||||
PrintAndLogEx(ERR, "E->Card doesn't support iso14443-4 mode");
|
PrintAndLogEx(ERR, "E->Card doesn't support iso14443-4 mode");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_status == 3) {
|
if (select_status == 3) {
|
||||||
PrintAndLogEx(INFO, "E->Card doesn't support standard iso14443-3 anticollision");
|
PrintAndLogEx(INFO, "E->Card doesn't support standard iso14443-3 anticollision");
|
||||||
PrintAndLogEx(SUCCESS, "\tATQA : %02x %02x", card->atqa[1], card->atqa[0]);
|
PrintAndLogEx(SUCCESS, "\tATQA : %02x %02x", card->atqa[1], card->atqa[0]);
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +265,6 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
||||||
PrintAndLogEx(SUCCESS, " SAK: %02x [%" PRIu64 "]", card->sak, resp.oldarg[0]);
|
PrintAndLogEx(SUCCESS, " SAK: %02x [%" PRIu64 "]", card->sak, resp.oldarg[0]);
|
||||||
if (card->ats_len < 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
if (card->ats_len < 3) { // a valid ATS consists of at least the length byte (TL) and 2 CRC bytes
|
||||||
PrintAndLogEx(INFO, "E-> Error ATS length(%d) : %s", card->ats_len, sprint_hex(card->ats, card->ats_len));
|
PrintAndLogEx(INFO, "E-> Error ATS length(%d) : %s", card->ats_len, sprint_hex(card->ats, card->ats_len));
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +416,6 @@ static int CmdHF14ACUIDs(const char *Cmd) {
|
||||||
// check if command failed
|
// check if command failed
|
||||||
if (resp.oldarg[0] == 0) {
|
if (resp.oldarg[0] == 0) {
|
||||||
PrintAndLogEx(WARNING, "card select failed.");
|
PrintAndLogEx(WARNING, "card select failed.");
|
||||||
DropField();
|
|
||||||
} else {
|
} else {
|
||||||
char uid_string[20];
|
char uid_string[20];
|
||||||
for (uint16_t m = 0; m < card->uidlen; m++) {
|
for (uint16_t m = 0; m < card->uidlen; m++) {
|
||||||
|
@ -568,20 +563,17 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
||||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check result
|
// check result
|
||||||
if (resp.oldarg[0] == 0) {
|
if (resp.oldarg[0] == 0) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "No card in field.");
|
if (!silentMode) PrintAndLogEx(ERR, "No card in field.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
|
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]);
|
if (!silentMode) PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]);
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,13 +583,11 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
||||||
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0, rats, 2);
|
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, 2, 0, rats, 2);
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
if (!silentMode) PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.oldarg[0] == 0) { // ats_len
|
if (resp.oldarg[0] == 0) { // ats_len
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Can't get ATS.");
|
if (!silentMode) PrintAndLogEx(ERR, "Can't get ATS.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -620,7 +610,6 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
||||||
|
|
||||||
if (!iLen) {
|
if (!iLen) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "No card response.");
|
if (!silentMode) PrintAndLogEx(ERR, "No card response.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,13 +619,11 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
||||||
|
|
||||||
if (maxdataoutlen && *dataoutlen > maxdataoutlen) {
|
if (maxdataoutlen && *dataoutlen > maxdataoutlen) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Buffer too small(%d). Needs %d bytes", *dataoutlen, maxdataoutlen);
|
if (!silentMode) PrintAndLogEx(ERR, "Buffer too small(%d). Needs %d bytes", *dataoutlen, maxdataoutlen);
|
||||||
DropField();
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recv[0] != data[0]) {
|
if (recv[0] != data[0]) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "iso14443-4 framing error. Card send %2x must be %2x", dataout[0], data[0]);
|
if (!silentMode) PrintAndLogEx(ERR, "iso14443-4 framing error. Card send %2x must be %2x", dataout[0], data[0]);
|
||||||
DropField();
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,13 +632,11 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
||||||
// CRC Check
|
// CRC Check
|
||||||
if (iLen == -1) {
|
if (iLen == -1) {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "ISO 14443A CRC error.");
|
if (!silentMode) PrintAndLogEx(ERR, "ISO 14443A CRC error.");
|
||||||
DropField();
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!silentMode) PrintAndLogEx(ERR, "Reply timeout.");
|
if (!silentMode) PrintAndLogEx(ERR, "Reply timeout.");
|
||||||
DropField();
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,20 +657,17 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check result
|
// check result
|
||||||
if (resp.oldarg[0] == 0) {
|
if (resp.oldarg[0] == 0) {
|
||||||
PrintAndLogEx(ERR, "No card in field.");
|
PrintAndLogEx(ERR, "No card in field.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
|
if (resp.oldarg[0] != 1 && resp.oldarg[0] != 2) {
|
||||||
PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]);
|
PrintAndLogEx(ERR, "Card not in iso14443-4. res=%" PRId64 ".", resp.oldarg[0]);
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,13 +677,11 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||||
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, sizeof(rats), 0, rats, sizeof(rats));
|
SendCommandOLD(CMD_HF_ISO14443A_READER, ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT, sizeof(rats), 0, rats, sizeof(rats));
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
PrintAndLogEx(ERR, "Proxmark3 connection timeout.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resp.oldarg[0] == 0) { // ats_len
|
if (resp.oldarg[0] == 0) { // ats_len
|
||||||
PrintAndLogEx(ERR, "Can't get ATS.");
|
PrintAndLogEx(ERR, "Can't get ATS.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,21 +759,18 @@ static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool
|
||||||
|
|
||||||
if (!iLen) {
|
if (!iLen) {
|
||||||
PrintAndLogEx(ERR, "APDU: No APDU response.");
|
PrintAndLogEx(ERR, "APDU: No APDU response.");
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check apdu length
|
// check apdu length
|
||||||
if (iLen < 2 && iLen >= 0) {
|
if (iLen < 2 && iLen >= 0) {
|
||||||
PrintAndLogEx(ERR, "APDU: Small APDU response. Len=%d", iLen);
|
PrintAndLogEx(ERR, "APDU: Small APDU response. Len=%d", iLen);
|
||||||
DropField();
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check block TODO
|
// check block TODO
|
||||||
if (iLen == -2) {
|
if (iLen == -2) {
|
||||||
PrintAndLogEx(ERR, "APDU: Block type mismatch.");
|
PrintAndLogEx(ERR, "APDU: Block type mismatch.");
|
||||||
DropField();
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -807,12 +784,10 @@ static int CmdExchangeAPDU(bool chainingin, uint8_t *datain, int datainlen, bool
|
||||||
// CRC Check
|
// CRC Check
|
||||||
if (iLen == -1) {
|
if (iLen == -1) {
|
||||||
PrintAndLogEx(ERR, "APDU: ISO 14443A CRC error.");
|
PrintAndLogEx(ERR, "APDU: ISO 14443A CRC error.");
|
||||||
DropField();
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(ERR, "APDU: Reply timeout.");
|
PrintAndLogEx(ERR, "APDU: Reply timeout.");
|
||||||
DropField();
|
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,15 +1149,12 @@ static int waitCmd(uint8_t iSelect) {
|
||||||
PrintAndLogEx(NORMAL, "received %i bytes", len);
|
PrintAndLogEx(NORMAL, "received %i bytes", len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!len) {
|
if (!len)
|
||||||
DropField();
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "%s", sprint_hex(resp.data.asBytes, len));
|
PrintAndLogEx(NORMAL, "%s", sprint_hex(resp.data.asBytes, len));
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||||
DropField();
|
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue