some improvements in APDU response checking

This commit is contained in:
merlokk 2018-10-17 18:19:04 +03:00
commit 117f0df729
2 changed files with 12 additions and 6 deletions

View file

@ -134,7 +134,7 @@ int CmdHFFidoRegister(const char *cmd) {
}
res = FIDORegister(data, buf, sizeof(buf), &len, &sw);
/* if (res) {
if (res) {
PrintAndLog("Can't execute register command. res=%x. Exit...", res);
return res;
}
@ -142,9 +142,10 @@ int CmdHFFidoRegister(const char *cmd) {
if (sw != 0x9000) {
PrintAndLog("Can't execute register command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
return 3;
}*/
}
//PrintAndLog("data: %s", sprint_hex(buf, len));
PrintAndLog("---------------------------------------------------------------");
PrintAndLog("data len: %d", len);
if (buf[0] != 0x05) {
PrintAndLog("ERROR: First byte must be 0x05, but it %2x", buf[0]);

View file

@ -255,9 +255,14 @@ int EMVExchangeEx(bool ActivateField, bool LeaveFieldON, sAPDU apdu, bool Includ
*sw = isw;
if (isw != 0x9000) {
if (APDULogging)
PrintAndLog("APDU(%02x%02x) ERROR: [%4X] %s", apdu.CLA, apdu.INS, isw, GetAPDUCodeDescription(*sw >> 8, *sw & 0xff));
return 5;
if (APDULogging) {
if (*sw >> 8 == 0x61) {
PrintAndLog("APDU chaining len:%02x -->", *sw & 0xff);
} else {
PrintAndLog("APDU(%02x%02x) ERROR: [%4X] %s", apdu.CLA, apdu.INS, isw, GetAPDUCodeDescription(*sw >> 8, *sw & 0xff));
return 5;
}
}
}
// add to tlv tree