mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-24 06:55:27 -07:00
some Mifare/CPU hybird card won't response to Mifare command any more if send RATS command
This commit is contained in:
parent
13b71e58fd
commit
b75f4c6f10
5 changed files with 23 additions and 22 deletions
|
@ -429,7 +429,7 @@ void StandAloneMode14a()
|
|||
SpinDelay(300);
|
||||
}
|
||||
}
|
||||
if (!iso14443a_select_card(uid, &hi14a_card[selected], &cuid))
|
||||
if (!iso14443a_select_card(uid, &hi14a_card[selected], &cuid, 1))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
|
|
|
@ -526,7 +526,7 @@ int EPA_Setup()
|
|||
// power up the field
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_MOD);
|
||||
// select the card
|
||||
return_code = iso14443a_select_card(uid, &card_select_info, NULL);
|
||||
return_code = iso14443a_select_card(uid, &card_select_info, NULL, 0);
|
||||
if (return_code == 1) {
|
||||
// send the PPS request
|
||||
ReaderTransmit((uint8_t *)pps, sizeof(pps), NULL);
|
||||
|
|
|
@ -1698,7 +1698,7 @@ int ReaderReceive(uint8_t *receivedAnswer, uint8_t *parity)
|
|||
/* performs iso14443a anticollision procedure
|
||||
* fills the uid pointer unless NULL
|
||||
* fills resp_data unless NULL */
|
||||
int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, uint32_t *cuid_ptr) {
|
||||
int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, uint32_t *cuid_ptr, uint8_t no_rats) {
|
||||
uint8_t wupa[] = { 0x52 }; // 0x26 - REQA 0x52 - WAKE-UP
|
||||
uint8_t sel_all[] = { 0x93,0x20 };
|
||||
uint8_t sel_uid[] = { 0x93,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
|
||||
|
@ -1821,7 +1821,8 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
|
|||
}
|
||||
|
||||
// non iso14443a compliant tag
|
||||
if( (sak & 0x20) == 0) return 2;
|
||||
// some Mifare/CPU hybird card won't response to Mifare command any more if send RATS command.
|
||||
if( no_rats || (sak & 0x20) == 0) return 2;
|
||||
|
||||
// Request for answer to select
|
||||
AppendCrc14443a(rats, 2);
|
||||
|
@ -1926,7 +1927,7 @@ void ReaderIso14443a(UsbCommand *c)
|
|||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
if(!(param & ISO14A_NO_SELECT)) {
|
||||
iso14a_card_select_t *card = (iso14a_card_select_t*)buf;
|
||||
arg0 = iso14443a_select_card(NULL,card,NULL);
|
||||
arg0 = iso14443a_select_card(NULL,card,NULL,0);
|
||||
cmd_send(CMD_ACK,arg0,card->uidlen,0,buf,sizeof(iso14a_card_select_t));
|
||||
}
|
||||
}
|
||||
|
@ -2125,7 +2126,7 @@ void ReaderMifare(bool first_try, uint8_t blockNo, uint8_t keyType)
|
|||
SpinDelay(100);
|
||||
}
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Mifare: Can't select card");
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ extern int ReaderReceive(uint8_t *receivedAnswer, uint8_t *par);
|
|||
|
||||
extern void iso14443a_setup(uint8_t fpga_minor_mode);
|
||||
extern int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, void *data);
|
||||
extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr);
|
||||
extern int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *resp_data, uint32_t *cuid_ptr, uint8_t no_rats);
|
||||
extern void iso14a_set_trigger(bool enable);
|
||||
|
||||
#endif /* __ISO14443A_H */
|
||||
|
|
|
@ -53,7 +53,7 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
LED_C_OFF();
|
||||
|
||||
while (true) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
break;
|
||||
};
|
||||
|
@ -100,7 +100,7 @@ void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes){
|
|||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL, 1)) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
return;
|
||||
|
@ -135,7 +135,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
|||
|
||||
clear_trace();
|
||||
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL);
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL, 1);
|
||||
if(!len) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%02X)",len);
|
||||
OnError(1);
|
||||
|
@ -211,7 +211,7 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
LED_C_OFF();
|
||||
|
||||
isOK = 1;
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
isOK = 0;
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
return;
|
||||
}
|
||||
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL);
|
||||
int len = iso14443a_select_card(NULL, NULL, NULL, 1);
|
||||
if (!len) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);
|
||||
OnError(1);
|
||||
|
@ -377,7 +377,7 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
LED_C_OFF();
|
||||
|
||||
while (true) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
break;
|
||||
};
|
||||
|
@ -431,7 +431,7 @@ void MifareUWriteBlockCompat(uint8_t arg0, uint8_t *datain)
|
|||
clear_trace();
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, NULL)) {
|
||||
if(!iso14443a_select_card(uid, NULL, NULL, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
return;
|
||||
|
@ -477,7 +477,7 @@ void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
|||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
return;
|
||||
|
@ -536,7 +536,7 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain){
|
|||
|
||||
clear_trace();
|
||||
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||
if(!iso14443a_select_card(NULL, NULL, NULL, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
OnError(0);
|
||||
return;
|
||||
|
@ -672,7 +672,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
|
|||
continue;
|
||||
}
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Nested: Can't select card");
|
||||
rtr--;
|
||||
continue;
|
||||
|
@ -746,7 +746,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t calibrate, uint8_t *dat
|
|||
continue;
|
||||
}
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Nested: Can't select card");
|
||||
continue;
|
||||
};
|
||||
|
@ -861,7 +861,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
|||
if (MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Halt error");
|
||||
}
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (OLD_MF_DBGLEVEL >= 1) Dbprintf("ChkKeys: Can't select card");
|
||||
break;
|
||||
};
|
||||
|
@ -954,7 +954,7 @@ void MifareECardLoad(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
|
||||
bool isOK = true;
|
||||
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
isOK = false;
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
}
|
||||
|
@ -1054,7 +1054,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datai
|
|||
|
||||
// get UID from chip
|
||||
if (workFlags & 0x01) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid)) {
|
||||
if(!iso14443a_select_card(uid, NULL, &cuid, 1)) {
|
||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||
break;
|
||||
};
|
||||
|
@ -1249,7 +1249,7 @@ void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain){
|
|||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
clear_trace();
|
||||
|
||||
int len = iso14443a_select_card(uid, NULL, &cuid);
|
||||
int len = iso14443a_select_card(uid, NULL, &cuid, 0);
|
||||
if(!len) {
|
||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card");
|
||||
OnError(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue