This commit is contained in:
Philippe Teuwen 2020-04-28 19:58:07 +02:00
parent 857526a945
commit fbd0a7e284
7 changed files with 30 additions and 30 deletions

View file

@ -746,14 +746,14 @@ static int NxpSysInfo(uint8_t *uid) {
if (status < 2) { if (status < 2) {
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to NXP systeminfo command"); PrintAndLogEx(WARNING, "iso15693 card doesn't answer to NXP systeminfo command");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
bool support_signature = (recv[5] & 0x01); bool support_signature = (recv[5] & 0x01);
@ -855,14 +855,14 @@ static int NxpSysInfo(uint8_t *uid) {
if (status < 2) { if (status < 2) {
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command"); PrintAndLogEx(WARNING, "iso15693 card doesn't answer to READ SIGNATURE command");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
uint8_t signature[32] = {0x00}; uint8_t signature[32] = {0x00};
@ -916,14 +916,14 @@ static int CmdHF15Info(const char *Cmd) {
if (status < 2) { if (status < 2) {
PrintAndLogEx(WARNING, "iso15693 card doesn't answer to systeminfo command"); PrintAndLogEx(WARNING, "iso15693 card doesn't answer to systeminfo command");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
memcpy(uid, recv + 2, sizeof(uid)); memcpy(uid, recv + 2, sizeof(uid));
@ -1090,7 +1090,7 @@ static int CmdHF15WriteAfi(const char *Cmd) {
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
@ -1149,7 +1149,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) {
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
@ -1430,7 +1430,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
uint32_t status = resp.oldarg[0]; uint32_t status = resp.oldarg[0];
if (status < 2) { if (status < 2) {
PrintAndLogEx(FAILED, "iso15693 card select failed"); PrintAndLogEx(FAILED, "iso15693 card select failed");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
@ -1442,7 +1442,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(FAILED, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(FAILED, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
// skip status byte // skip status byte
@ -1512,7 +1512,7 @@ static int CmdHF15Read(const char *Cmd) {
uint32_t status = resp.oldarg[0]; uint32_t status = resp.oldarg[0];
if (status < 2) { if (status < 2) {
PrintAndLogEx(ERR, "iso15693 card select failed"); PrintAndLogEx(ERR, "iso15693 card select failed");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
@ -1524,7 +1524,7 @@ static int CmdHF15Read(const char *Cmd) {
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
// print response // print response
@ -1598,7 +1598,7 @@ static int CmdHF15Write(const char *Cmd) {
uint32_t status = resp.oldarg[0]; uint32_t status = resp.oldarg[0];
if (status < 2) { if (status < 2) {
PrintAndLogEx(FAILED, "iso15693 card select failed"); PrintAndLogEx(FAILED, "iso15693 card select failed");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
recv = resp.data.asBytes; recv = resp.data.asBytes;
@ -1610,7 +1610,7 @@ static int CmdHF15Write(const char *Cmd) {
if (recv[0] & ISO15_RES_ERROR) { if (recv[0] & ISO15_RES_ERROR) {
PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0]));
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
PrintAndLogEx(NORMAL, "OK"); PrintAndLogEx(NORMAL, "OK");

View file

@ -1469,7 +1469,7 @@ static int WriteBlock(uint8_t blockno, uint8_t *bldata, uint8_t *KEY, bool use_c
if (resp.status != PM3_SUCCESS) { if (resp.status != PM3_SUCCESS) {
if (verbose) PrintAndLogEx(ERR, "failed to communicate with card"); if (verbose) PrintAndLogEx(ERR, "failed to communicate with card");
DropField(); DropField();
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
if (resp.data.asBytes[0] == 1) if (resp.data.asBytes[0] == 1)
@ -1811,7 +1811,7 @@ static int ReadBlock(uint8_t *KEY, uint8_t blockno, uint8_t keyType, bool elite,
if (resp.status != PM3_SUCCESS) { if (resp.status != PM3_SUCCESS) {
if (verbose) PrintAndLogEx(ERR, "failed to communicate with card"); if (verbose) PrintAndLogEx(ERR, "failed to communicate with card");
DropField(); DropField();
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} }
result = (struct p *)resp.data.asBytes; result = (struct p *)resp.data.asBytes;

View file

@ -149,14 +149,14 @@ static int lto_select(uint8_t *id_response, uint8_t id_len, uint8_t *type_respon
resp_len = id_len; resp_len = id_len;
status = lto_send_cmd_raw(select_sn_cmd, sizeof(select_sn_cmd), id_response, &resp_len, false, false, verbose); status = lto_send_cmd_raw(select_sn_cmd, sizeof(select_sn_cmd), id_response, &resp_len, false, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
return PM3_EWRONGANSVER; // REQUEST SERIAL NUMBER failed return PM3_EWRONGANSWER; // REQUEST SERIAL NUMBER failed
} }
memcpy(select_cmd + 2, id_response, sizeof(select_cmd) - 2); memcpy(select_cmd + 2, id_response, sizeof(select_cmd) - 2);
resp_len = 1; resp_len = 1;
status = lto_send_cmd_raw(select_cmd, sizeof(select_cmd), resp, &resp_len, true, false, verbose); status = lto_send_cmd_raw(select_cmd, sizeof(select_cmd), resp, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) {
return PM3_EWRONGANSVER; // SELECT failed return PM3_EWRONGANSWER; // SELECT failed
} }
// tag is now INIT and SELECTED. // tag is now INIT and SELECTED.
@ -222,12 +222,12 @@ static int lto_rdbl(uint8_t blk, uint8_t *block_responce, uint8_t *block_cnt_res
int status = lto_send_cmd_raw(rdbl_cmd, sizeof(rdbl_cmd), block_responce, &resp_len, true, false, verbose); int status = lto_send_cmd_raw(rdbl_cmd, sizeof(rdbl_cmd), block_responce, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
return PM3_EWRONGANSVER; // READ BLOCK failed return PM3_EWRONGANSWER; // READ BLOCK failed
} }
status = lto_send_cmd_raw(rdbl_cnt_cmd, sizeof(rdbl_cnt_cmd), block_cnt_responce, &resp_len, false, false, verbose); status = lto_send_cmd_raw(rdbl_cnt_cmd, sizeof(rdbl_cnt_cmd), block_cnt_responce, &resp_len, false, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
return PM3_EWRONGANSVER; // READ BLOCK CONTINUE failed return PM3_EWRONGANSWER; // READ BLOCK CONTINUE failed
} }
return PM3_SUCCESS; return PM3_SUCCESS;
@ -334,17 +334,17 @@ static int lto_wrbl(uint8_t blk, uint8_t *data, bool verbose) {
int status = lto_send_cmd_raw(wrbl_cmd, sizeof(wrbl_cmd), resp, &resp_len, true, false, verbose); int status = lto_send_cmd_raw(wrbl_cmd, sizeof(wrbl_cmd), resp, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) {
return PM3_EWRONGANSVER; // WRITE BLOCK failed return PM3_EWRONGANSWER; // WRITE BLOCK failed
} }
status = lto_send_cmd_raw(wrbl_d00_d15, sizeof(wrbl_d00_d15), resp, &resp_len, true, false, verbose); status = lto_send_cmd_raw(wrbl_d00_d15, sizeof(wrbl_d00_d15), resp, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) {
return PM3_EWRONGANSVER; // WRITE BLOCK failed return PM3_EWRONGANSWER; // WRITE BLOCK failed
} }
status = lto_send_cmd_raw(wrbl_d16_d31, sizeof(wrbl_d16_d31), resp, &resp_len, true, false, verbose); status = lto_send_cmd_raw(wrbl_d16_d31, sizeof(wrbl_d16_d31), resp, &resp_len, true, false, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT || resp[0] != 0x0A) {
return PM3_EWRONGANSVER; // WRITE BLOCK failed return PM3_EWRONGANSWER; // WRITE BLOCK failed
} }
return PM3_SUCCESS; return PM3_SUCCESS;

View file

@ -534,7 +534,7 @@ static char *GetErrorString(int res, uint16_t *sw) {
return "Generic TTY error"; return "Generic TTY error";
case PM3_EINIT: case PM3_EINIT:
return "Initialization error"; return "Initialization error";
case PM3_EWRONGANSVER: case PM3_EWRONGANSWER:
return "Expected a different answer error"; return "Expected a different answer error";
case PM3_EOUTOFBOUND: case PM3_EOUTOFBOUND:
return "Memory out-of-bounds error"; return "Memory out-of-bounds error";

View file

@ -109,7 +109,7 @@ static int topaz_select(uint8_t *atqa, uint8_t atqa_len, uint8_t *rid_response,
status = topaz_send_cmd(rid_cmd, sizeof(rid_cmd), rid_response, &resp_len, verbose); status = topaz_send_cmd(rid_cmd, sizeof(rid_cmd), rid_response, &resp_len, verbose);
if (status == PM3_ETIMEOUT || status == PM3_ESOFT) { if (status == PM3_ETIMEOUT || status == PM3_ESOFT) {
topaz_switch_off_field(); topaz_switch_off_field();
return PM3_EWRONGANSVER; // RID failed return PM3_EWRONGANSWER; // RID failed
} }
return PM3_SUCCESS; return PM3_SUCCESS;
@ -529,7 +529,7 @@ int readTopazUid(bool verbose) {
return PM3_ESOFT; return PM3_ESOFT;
} }
if (status == PM3_EWRONGANSVER) { if (status == PM3_EWRONGANSWER) {
if (verbose) PrintAndLogEx(ERR, "Error: tag didn't answer to RID"); if (verbose) PrintAndLogEx(ERR, "Error: tag didn't answer to RID");
topaz_switch_off_field(); topaz_switch_off_field();
return PM3_ESOFT; return PM3_ESOFT;

View file

@ -611,7 +611,7 @@ bool t55xxVerifyWrite(uint8_t block, bool page1, bool usepwd, uint8_t override,
if (GetT55xxBlockData(&read_data) == false) if (GetT55xxBlockData(&read_data) == false)
return false; return false;
} else if (res == PM3_EWRONGANSVER) { } else if (res == PM3_EWRONGANSWER) {
// could't decode. Lets see if this was a block 0 write and try read/detect it auto. // could't decode. Lets see if this was a block 0 write and try read/detect it auto.
// this messes up with ppls config.. // this messes up with ppls config..
@ -852,7 +852,7 @@ int T55xxReadBlockEx(uint8_t block, bool page1, bool usepwd, uint8_t override, u
if (tryDetectModulation(downlink_mode, false) == false) { if (tryDetectModulation(downlink_mode, false) == false) {
PrintAndLogEx(WARNING, "Safety check: Could not detect if PWD bit is set in config block. Exits."); PrintAndLogEx(WARNING, "Safety check: Could not detect if PWD bit is set in config block. Exits.");
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
} else { } else {
PrintAndLogEx(WARNING, "Safety check: PWD bit is NOT set in config block. Reading without password..."); PrintAndLogEx(WARNING, "Safety check: PWD bit is NOT set in config block. Reading without password...");
usepwd = false; usepwd = false;
@ -867,7 +867,7 @@ int T55xxReadBlockEx(uint8_t block, bool page1, bool usepwd, uint8_t override, u
return PM3_ERFTRANS; return PM3_ERFTRANS;
if (DecodeT55xxBlock() == false) if (DecodeT55xxBlock() == false)
return PM3_EWRONGANSVER; return PM3_EWRONGANSWER;
if (verbose) if (verbose)
printT55xxBlock(block, page1); printT55xxBlock(block, page1);

View file

@ -613,7 +613,7 @@ typedef struct {
// Initialization error pm3: error related to trying to initalize the pm3 / fpga for different operations // Initialization error pm3: error related to trying to initalize the pm3 / fpga for different operations
#define PM3_EINIT -15 #define PM3_EINIT -15
// Expected a different answer error client/pm3: error when expecting one answer and got another one // Expected a different answer error client/pm3: error when expecting one answer and got another one
#define PM3_EWRONGANSVER -16 #define PM3_EWRONGANSWER -16
// Memory out-of-bounds error client/pm3: error when a read/write is outside the expected array // Memory out-of-bounds error client/pm3: error when a read/write is outside the expected array
#define PM3_EOUTOFBOUND -17 #define PM3_EOUTOFBOUND -17
// exchange with card error client/pm3: error when cant get answer from card or got an incorrect answer // exchange with card error client/pm3: error when cant get answer from card or got an incorrect answer