mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-11 15:56:09 -07:00
small fixes in ReaderIso14443a() (#446)
This commit is contained in:
parent
fefb7f5376
commit
618c220c38
2 changed files with 19 additions and 6 deletions
|
@ -1698,6 +1698,13 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
|
||||||
int cascade_level = 0;
|
int cascade_level = 0;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
// init card struct
|
||||||
|
if(p_hi14a_card) {
|
||||||
|
p_hi14a_card->uidlen = 0;
|
||||||
|
memset(p_hi14a_card->uid, 0, 10);
|
||||||
|
p_hi14a_card->ats_len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Broadcast for a card, WUPA (0x52) will force response from all cards in the field
|
// Broadcast for a card, WUPA (0x52) will force response from all cards in the field
|
||||||
ReaderTransmitBitsPar(wupa, 7, NULL, NULL);
|
ReaderTransmitBitsPar(wupa, 7, NULL, NULL);
|
||||||
|
|
||||||
|
@ -1706,8 +1713,6 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
|
||||||
|
|
||||||
if(p_hi14a_card) {
|
if(p_hi14a_card) {
|
||||||
memcpy(p_hi14a_card->atqa, resp, 2);
|
memcpy(p_hi14a_card->atqa, resp, 2);
|
||||||
p_hi14a_card->uidlen = 0;
|
|
||||||
memset(p_hi14a_card->uid,0,10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anticollision) {
|
if (anticollision) {
|
||||||
|
@ -1813,7 +1818,6 @@ int iso14443a_select_card(byte_t *uid_ptr, iso14a_card_select_t *p_hi14a_card, u
|
||||||
|
|
||||||
if(p_hi14a_card) {
|
if(p_hi14a_card) {
|
||||||
p_hi14a_card->sak = sak;
|
p_hi14a_card->sak = sak;
|
||||||
p_hi14a_card->ats_len = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// non iso14443a compliant tag
|
// non iso14443a compliant tag
|
||||||
|
@ -1908,7 +1912,7 @@ void ReaderIso14443a(UsbCommand *c)
|
||||||
size_t lenbits = c->arg[1] >> 16;
|
size_t lenbits = c->arg[1] >> 16;
|
||||||
uint32_t timeout = c->arg[2];
|
uint32_t timeout = c->arg[2];
|
||||||
uint32_t arg0 = 0;
|
uint32_t arg0 = 0;
|
||||||
byte_t buf[USB_CMD_DATA_SIZE];
|
byte_t buf[USB_CMD_DATA_SIZE] = {0};
|
||||||
uint8_t par[MAX_PARITY_SIZE];
|
uint8_t par[MAX_PARITY_SIZE];
|
||||||
|
|
||||||
if(param & ISO14A_CONNECT) {
|
if(param & ISO14A_CONNECT) {
|
||||||
|
|
|
@ -732,8 +732,17 @@ static void waitCmd(uint8_t iSelect)
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
||||||
recv = resp.d.asBytes;
|
recv = resp.d.asBytes;
|
||||||
uint8_t iLen = iSelect ? resp.arg[1] : resp.arg[0];
|
uint8_t iLen = resp.arg[0];
|
||||||
PrintAndLog("received %i octets", iLen);
|
if (iSelect){
|
||||||
|
iLen = resp.arg[1];
|
||||||
|
if (iLen){
|
||||||
|
PrintAndLog("Card selected. UID[%i]:", iLen);
|
||||||
|
} else {
|
||||||
|
PrintAndLog("Can't select card.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PrintAndLog("received %i bytes:", iLen);
|
||||||
|
}
|
||||||
if(!iLen)
|
if(!iLen)
|
||||||
return;
|
return;
|
||||||
hexout = (char *)malloc(iLen * 3 + 1);
|
hexout = (char *)malloc(iLen * 3 + 1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue