mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-24 15:15:39 -07:00
swapped to defines
This commit is contained in:
parent
e74a025a27
commit
6597d14e10
4 changed files with 64 additions and 62 deletions
|
@ -126,8 +126,8 @@ static void hf14b_aid_search(bool verbose) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw == 0x9000 || sw == 0x6283 || sw == 0x6285) {
|
if (sw == ISO7816_OK || sw == ISO7816_INVALID_DF || sw == ISO7816_FILE_TERMINATED) {
|
||||||
if (sw == 0x9000) {
|
if (sw == ISO7816_OK) {
|
||||||
if (verbose) PrintAndLogEx(SUCCESS, "Application ( " _GREEN_("ok") " )");
|
if (verbose) PrintAndLogEx(SUCCESS, "Application ( " _GREEN_("ok") " )");
|
||||||
} else {
|
} else {
|
||||||
if (verbose) PrintAndLogEx(WARNING, "Application ( " _RED_("blocked") " )");
|
if (verbose) PrintAndLogEx(WARNING, "Application ( " _RED_("blocked") " )");
|
||||||
|
@ -2035,7 +2035,7 @@ int CmdHF14BNdefRead(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t sw = get_sw(response, resplen);
|
uint16_t sw = get_sw(response, resplen);
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Selecting NDEF aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Selecting NDEF aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
res = PM3_ESOFT;
|
res = PM3_ESOFT;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -2055,7 +2055,7 @@ int CmdHF14BNdefRead(const char *Cmd) {
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
sw = get_sw(response, resplen);
|
sw = get_sw(response, resplen);
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Selecting NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Selecting NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
res = PM3_ESOFT;
|
res = PM3_ESOFT;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -2071,7 +2071,7 @@ int CmdHF14BNdefRead(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sw = get_sw(response, resplen);
|
sw = get_sw(response, resplen);
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
res = PM3_ESOFT;
|
res = PM3_ESOFT;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -2090,7 +2090,7 @@ int CmdHF14BNdefRead(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sw = get_sw(response, resplen);
|
sw = get_sw(response, resplen);
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "reading NDEF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
res = PM3_ESOFT;
|
res = PM3_ESOFT;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "fileutils.h" // laodFileJSONroot
|
#include "fileutils.h" // laodFileJSONroot
|
||||||
#include "crypto/libpcrypto.h"
|
#include "crypto/libpcrypto.h"
|
||||||
|
#include "protocols.h" // ISO7816 APDU return codes
|
||||||
|
|
||||||
const uint8_t PxSE_AID[] = {0xA0, 0x00, 0x00, 0x05, 0x07, 0x01, 0x00};
|
const uint8_t PxSE_AID[] = {0xA0, 0x00, 0x00, 0x05, 0x07, 0x01, 0x00};
|
||||||
#define PxSE_AID_LENGTH 7
|
#define PxSE_AID_LENGTH 7
|
||||||
|
@ -104,11 +105,11 @@ static int SelectAndPrintInfoFile(void) {
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
|
|
||||||
int res = CIPURSESelectFile(0x2ff7, buf, sizeof(buf), &len, &sw);
|
int res = CIPURSESelectFile(0x2ff7, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
return PM3_EAPDU_FAIL;
|
return PM3_EAPDU_FAIL;
|
||||||
|
|
||||||
res = CIPURSEReadBinary(0, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEReadBinary(0, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
return PM3_EAPDU_FAIL;
|
return PM3_EAPDU_FAIL;
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
@ -151,7 +152,7 @@ static int CmdHFCipurseInfo(const char *Cmd) {
|
||||||
bool mfExist = false;
|
bool mfExist = false;
|
||||||
bool infoPrinted = false;
|
bool infoPrinted = false;
|
||||||
int res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
int res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res == PM3_SUCCESS && sw == 0x9000) {
|
if (res == PM3_SUCCESS && sw == ISO7816_OK) {
|
||||||
mfExist = true;
|
mfExist = true;
|
||||||
PrintAndLogEx(INFO, _YELLOW_("MasterFile") " exist and can be selected.");
|
PrintAndLogEx(INFO, _YELLOW_("MasterFile") " exist and can be selected.");
|
||||||
|
|
||||||
|
@ -161,7 +162,7 @@ static int CmdHFCipurseInfo(const char *Cmd) {
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYLEN(PxSE_AID_LIST); i++) {
|
for (int i = 0; i < ARRAYLEN(PxSE_AID_LIST); i++) {
|
||||||
res = CIPURSESelectAID(false, true, (uint8_t *)PxSE_AID_LIST[i].aid, PxSE_AID_LENGTH, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectAID(false, true, (uint8_t *)PxSE_AID_LIST[i].aid, PxSE_AID_LENGTH, buf, sizeof(buf), &len, &sw);
|
||||||
if (res == PM3_SUCCESS && sw == 0x9000) {
|
if (res == PM3_SUCCESS && sw == ISO7816_OK) {
|
||||||
mfExist = true;
|
mfExist = true;
|
||||||
PrintAndLogEx(INFO, _CYAN_("PxSE") " exist: %s", PxSE_AID_LIST[i].name);
|
PrintAndLogEx(INFO, _CYAN_("PxSE") " exist: %s", PxSE_AID_LIST[i].name);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
@ -179,7 +180,7 @@ static int CmdHFCipurseInfo(const char *Cmd) {
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, "Application `" _YELLOW_("AF F1") "` selected " _GREEN_("successfully"));
|
PrintAndLogEx(INFO, "Application `" _YELLOW_("AF F1") "` selected " _GREEN_("successfully"));
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
if (sw == 0x0000) {
|
if (sw == 0x0000) {
|
||||||
PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000");
|
PrintAndLogEx(ERR, "APDU exchange error. Card returns 0x0000");
|
||||||
} else {
|
} else {
|
||||||
|
@ -362,7 +363,7 @@ static int SelectCommandEx(bool selectDefaultFile, bool useAID, uint8_t *aid, si
|
||||||
if (useAID && aidLen > 0) {
|
if (useAID && aidLen > 0) {
|
||||||
|
|
||||||
res = CIPURSESelectAID(true, true, aid, aidLen, buf, bufSize, len, sw);
|
res = CIPURSESelectAID(true, true, aid, aidLen, buf, bufSize, len, sw);
|
||||||
if (res != 0 || *sw != 0x9000) {
|
if (res != 0 || *sw != ISO7816_OK) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select application " _GREEN_("%s ") _RED_("error") ". Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), *sw);
|
PrintAndLogEx(ERR, "Cipurse select application " _GREEN_("%s ") _RED_("error") ". Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), *sw);
|
||||||
}
|
}
|
||||||
|
@ -375,7 +376,7 @@ static int SelectCommandEx(bool selectDefaultFile, bool useAID, uint8_t *aid, si
|
||||||
} else if (useFID) {
|
} else if (useFID) {
|
||||||
|
|
||||||
res = CIPURSESelectFileEx(true, true, fileId, buf, bufSize, len, sw);
|
res = CIPURSESelectFileEx(true, true, fileId, buf, bufSize, len, sw);
|
||||||
if (res != 0 || *sw != 0x9000) {
|
if (res != 0 || *sw != ISO7816_OK) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select file 0x%04x ( %s )", fileId, _RED_("fail"));
|
PrintAndLogEx(ERR, "Cipurse select file 0x%04x ( %s )", fileId, _RED_("fail"));
|
||||||
PrintAndLogEx(ERR, "Card returns 0x%04x", *sw);
|
PrintAndLogEx(ERR, "Card returns 0x%04x", *sw);
|
||||||
|
@ -389,7 +390,7 @@ static int SelectCommandEx(bool selectDefaultFile, bool useAID, uint8_t *aid, si
|
||||||
} else if (selectDefaultFile) {
|
} else if (selectDefaultFile) {
|
||||||
|
|
||||||
res = CIPURSESelectMFDefaultFileEx(true, true, buf, bufSize, len, sw);
|
res = CIPURSESelectMFDefaultFileEx(true, true, buf, bufSize, len, sw);
|
||||||
if (res != 0 || *sw != 0x9000) {
|
if (res != 0 || *sw != ISO7816_OK) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select default file " _RED_("error") ". Card returns 0x%04x", *sw);
|
PrintAndLogEx(ERR, "Cipurse select default file " _RED_("error") ". Card returns 0x%04x", *sw);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +403,7 @@ static int SelectCommandEx(bool selectDefaultFile, bool useAID, uint8_t *aid, si
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
res = CIPURSESelect(true, true, buf, bufSize, len, sw);
|
res = CIPURSESelect(true, true, buf, bufSize, len, sw);
|
||||||
if (res != 0 || *sw != 0x9000) {
|
if (res != 0 || *sw != ISO7816_OK) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select default application " _RED_("error") ". Card returns 0x%04x", *sw);
|
PrintAndLogEx(ERR, "Cipurse select default application " _RED_("error") ". Card returns 0x%04x", *sw);
|
||||||
}
|
}
|
||||||
|
@ -419,7 +420,7 @@ static int SelectCommandEx(bool selectDefaultFile, bool useAID, uint8_t *aid, si
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSESelectFileEx(false, true, childFileId, buf, bufSize, len, sw);
|
res = CIPURSESelectFileEx(false, true, childFileId, buf, bufSize, len, sw);
|
||||||
if (res != 0 || *sw != 0x9000) {
|
if (res != 0 || *sw != ISO7816_OK) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(ERR, "Select child file 0x%04x " _RED_("error") ". Card returns 0x%04x", childFileId, *sw);
|
PrintAndLogEx(ERR, "Select child file 0x%04x " _RED_("error") ". Card returns 0x%04x", childFileId, *sw);
|
||||||
}
|
}
|
||||||
|
@ -487,7 +488,7 @@ static int CmdHFCipurseSelect(const char *Cmd) {
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, true, buf, sizeof(buf), &len, &sw);
|
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -553,7 +554,7 @@ static int CmdHFCipurseAuth(const char *Cmd) {
|
||||||
uint8_t buf[APDU_RES_LEN] = {0};
|
uint8_t buf[APDU_RES_LEN] = {0};
|
||||||
|
|
||||||
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, true, buf, sizeof(buf), &len, &sw);
|
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -635,7 +636,7 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
uint8_t buf[APDU_RES_LEN] = {0};
|
uint8_t buf[APDU_RES_LEN] = {0};
|
||||||
|
|
||||||
res = CIPURSESelectAID(true, true, aid, aidLen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectAID(true, true, aid, aidLen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select application " _CYAN_("%s") " ( " _RED_("error") " ). Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), sw);
|
PrintAndLogEx(ERR, "Cipurse select application " _CYAN_("%s") " ( " _RED_("error") " ). Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -660,7 +661,7 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File select ( " _RED_("error") " ). Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File select ( " _RED_("error") " ). Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -671,7 +672,7 @@ static int CmdHFCipurseReadFile(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Select file 0x%x ( %s )", fileId, _GREEN_("ok"));
|
PrintAndLogEx(INFO, "Select file 0x%x ( %s )", fileId, _GREEN_("ok"));
|
||||||
|
|
||||||
res = CIPURSEReadBinary(offset, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEReadBinary(offset, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File read " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File read " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -758,7 +759,7 @@ static int CmdHFCipurseWriteFile(const char *Cmd) {
|
||||||
uint8_t buf[APDU_RES_LEN] = {0};
|
uint8_t buf[APDU_RES_LEN] = {0};
|
||||||
|
|
||||||
res = CIPURSESelectAID(true, true, aid, aidLen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectAID(true, true, aid, aidLen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse select application " _CYAN_("%s") " ( " _RED_("error") " ). Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), sw);
|
PrintAndLogEx(ERR, "Cipurse select application " _CYAN_("%s") " ( " _RED_("error") " ). Card returns 0x%04x", sprint_hex_inrow(aid, aidLen), sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -789,7 +790,7 @@ static int CmdHFCipurseWriteFile(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectFile(fileId, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File select " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File select " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -800,7 +801,7 @@ static int CmdHFCipurseWriteFile(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Select file 0x%x ( %s )", fileId, _GREEN_("ok"));
|
PrintAndLogEx(INFO, "Select file 0x%x ( %s )", fileId, _GREEN_("ok"));
|
||||||
|
|
||||||
res = CIPURSEUpdateBinary(offset, hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEUpdateBinary(offset, hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File write " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File write " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -812,7 +813,7 @@ static int CmdHFCipurseWriteFile(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -883,7 +884,7 @@ static int CmdHFCipurseReadFileAttr(const char *Cmd) {
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
|
|
||||||
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -921,7 +922,7 @@ static int CmdHFCipurseReadFileAttr(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSEReadFileAttributes(buf, sizeof(buf), &len, &sw);
|
res = CIPURSEReadFileAttributes(buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File read " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File read " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -1020,7 +1021,7 @@ static int CmdHFCipurseWriteFileAttr(const char *Cmd) {
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
|
|
||||||
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommandEx(selmfd, useAID, aid, aidLen, useFID, fileId, useChildFID, childFileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1058,7 +1059,7 @@ static int CmdHFCipurseWriteFileAttr(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSEUpdateFileAttributes(hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEUpdateFileAttributes(hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
if (verbose == false)
|
if (verbose == false)
|
||||||
PrintAndLogEx(ERR, "File attributes update " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "File attributes update " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
|
@ -1070,7 +1071,7 @@ static int CmdHFCipurseWriteFileAttr(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -1125,7 +1126,7 @@ static int CmdHFCipurseFormatAll(const char *Cmd) {
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
|
|
||||||
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1154,7 +1155,7 @@ static int CmdHFCipurseFormatAll(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSEFormatAll(&sw);
|
res = CIPURSEFormatAll(&sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Format " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Format " _RED_("ERROR") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1239,14 +1240,14 @@ static int CmdHFCipurseCreateDGI(const char *Cmd) {
|
||||||
|
|
||||||
if (useAID || useFID || selmfd) {
|
if (useAID || useFID || selmfd) {
|
||||||
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1277,7 +1278,7 @@ static int CmdHFCipurseCreateDGI(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSECreateFile(hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSECreateFile(hdata, hdatalen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Create file command " _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Create file command " _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
||||||
GetSpecificAPDUCodeDesc(SelectAPDUCodeDescriptions, ARRAYLEN(SelectAPDUCodeDescriptions), sw));
|
GetSpecificAPDUCodeDesc(SelectAPDUCodeDescriptions, ARRAYLEN(SelectAPDUCodeDescriptions), sw));
|
||||||
|
@ -1289,7 +1290,7 @@ static int CmdHFCipurseCreateDGI(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -1376,14 +1377,14 @@ static int CmdHFCipurseDeleteFile(const char *Cmd) {
|
||||||
|
|
||||||
if (useChildFID) {
|
if (useChildFID) {
|
||||||
res = SelectCommand(false, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommand(false, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Top level select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Top level select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1405,7 +1406,7 @@ static int CmdHFCipurseDeleteFile(const char *Cmd) {
|
||||||
|
|
||||||
if (useChildFID) {
|
if (useChildFID) {
|
||||||
res = CIPURSEDeleteFile(childFileId, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEDeleteFile(childFileId, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Delete child file " _CYAN_("%04x ") " %s", childFileId, _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Delete child file " _CYAN_("%04x ") " %s", childFileId, _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s",
|
PrintAndLogEx(ERR, "0x%04x - %s",
|
||||||
sw,
|
sw,
|
||||||
|
@ -1417,7 +1418,7 @@ static int CmdHFCipurseDeleteFile(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Child file id " _CYAN_("%04x") " deleted " _GREEN_("succesfully"), childFileId);
|
PrintAndLogEx(INFO, "Child file id " _CYAN_("%04x") " deleted " _GREEN_("succesfully"), childFileId);
|
||||||
} else if (useFID) {
|
} else if (useFID) {
|
||||||
res = CIPURSEDeleteFile(fileId, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEDeleteFile(fileId, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Delete file " _CYAN_("%04x ") " %s", fileId, _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Delete file " _CYAN_("%04x ") " %s", fileId, _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s",
|
PrintAndLogEx(ERR, "0x%04x - %s",
|
||||||
sw,
|
sw,
|
||||||
|
@ -1429,7 +1430,7 @@ static int CmdHFCipurseDeleteFile(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "File id " _CYAN_("%04x") " deleted " _GREEN_("succesfully"), fileId);
|
PrintAndLogEx(INFO, "File id " _CYAN_("%04x") " deleted " _GREEN_("succesfully"), fileId);
|
||||||
} else {
|
} else {
|
||||||
res = CIPURSEDeleteFileAID(aid, aidLen, buf, sizeof(buf), &len, &sw);
|
res = CIPURSEDeleteFileAID(aid, aidLen, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Delete application " _CYAN_("%s ") " %s", sprint_hex_inrow(aid, aidLen), _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Delete application " _CYAN_("%s ") " %s", sprint_hex_inrow(aid, aidLen), _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s",
|
PrintAndLogEx(ERR, "0x%04x - %s",
|
||||||
sw,
|
sw,
|
||||||
|
@ -1444,7 +1445,7 @@ static int CmdHFCipurseDeleteFile(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -1588,14 +1589,14 @@ static int CmdHFCipurseUpdateKey(const char *Cmd) {
|
||||||
|
|
||||||
if (useAID || useFID || selmfd) {
|
if (useAID || useFID || selmfd) {
|
||||||
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1626,7 +1627,7 @@ static int CmdHFCipurseUpdateKey(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSEUpdateKey(encKeyId, newKeyId, keydata, sizeof(keydata), buf, sizeof(buf), &len, &sw);
|
res = CIPURSEUpdateKey(encKeyId, newKeyId, keydata, sizeof(keydata), buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Update key command " _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Update key command " _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
||||||
GetSpecificAPDUCodeDesc(UAPDpdateKeyCodeDescriptions, ARRAYLEN(UAPDpdateKeyCodeDescriptions), sw));
|
GetSpecificAPDUCodeDesc(UAPDpdateKeyCodeDescriptions, ARRAYLEN(UAPDpdateKeyCodeDescriptions), sw));
|
||||||
|
@ -1638,7 +1639,7 @@ static int CmdHFCipurseUpdateKey(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -1736,14 +1737,14 @@ static int CmdHFCipurseUpdateKeyAttr(const char *Cmd) {
|
||||||
|
|
||||||
if (useAID || useFID || selmfd) {
|
if (useAID || useFID || selmfd) {
|
||||||
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
res = SelectCommand(selmfd, useAID, aid, aidLen, useFID, fileId, verbose, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
PrintAndLogEx(ERR, "Select command ( " _RED_("error") " )");
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
res = CIPURSESelectMFEx(true, true, buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
PrintAndLogEx(ERR, "Cipurse masterfile select " _RED_("error") ". Card returns 0x%04x", sw);
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -1774,7 +1775,7 @@ static int CmdHFCipurseUpdateKeyAttr(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
res = CIPURSEUpdateKeyAttrib(trgKeyId, hdata[0], buf, sizeof(buf), &len, &sw);
|
res = CIPURSEUpdateKeyAttrib(trgKeyId, hdata[0], buf, sizeof(buf), &len, &sw);
|
||||||
if (res != 0 || sw != 0x9000) {
|
if (res != 0 || sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Update key attributes command " _RED_("ERROR"));
|
PrintAndLogEx(ERR, "Update key attributes command " _RED_("ERROR"));
|
||||||
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
PrintAndLogEx(ERR, "0x%04x - %s", sw,
|
||||||
GetSpecificAPDUCodeDesc(UAPDpdateKeyAttrCodeDescriptions, ARRAYLEN(UAPDpdateKeyAttrCodeDescriptions), sw));
|
GetSpecificAPDUCodeDesc(UAPDpdateKeyAttrCodeDescriptions, ARRAYLEN(UAPDpdateKeyAttrCodeDescriptions), sw));
|
||||||
|
@ -1786,7 +1787,7 @@ static int CmdHFCipurseUpdateKeyAttr(const char *Cmd) {
|
||||||
if (needCommit) {
|
if (needCommit) {
|
||||||
sw = 0;
|
sw = 0;
|
||||||
res = CIPURSECommitTransaction(&sw);
|
res = CIPURSECommitTransaction(&sw);
|
||||||
if (res != 0 || sw != 0x9000)
|
if (res != 0 || sw != ISO7816_OK)
|
||||||
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
PrintAndLogEx(WARNING, "Commit ( " _YELLOW_("fail") " ) Card returns 0x%04x", sw);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
|
@ -1803,7 +1804,7 @@ bool CheckCardCipurse(void) {
|
||||||
uint16_t sw = 0;
|
uint16_t sw = 0;
|
||||||
int res = CIPURSESelect(true, false, buf, sizeof(buf), &len, &sw);
|
int res = CIPURSESelect(true, false, buf, sizeof(buf), &len, &sw);
|
||||||
|
|
||||||
return (res == 0 && sw == 0x9000);
|
return (res == 0 && sw == ISO7816_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFCipurseTest(const char *Cmd) {
|
static int CmdHFCipurseTest(const char *Cmd) {
|
||||||
|
|
|
@ -194,7 +194,7 @@ static bool emrtd_exchange_commands(sAPDU_t apdu, bool include_le, uint16_t le,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(DEBUG, "Command failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(DEBUG, "Command failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "cmdtrace.h"
|
#include "cmdtrace.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "fileutils.h" // laodFileJSONroot
|
#include "fileutils.h" // laodFileJSONroot
|
||||||
|
#include "protocols.h" // ISO7816 APDU return codes
|
||||||
|
|
||||||
#define DEF_FIDO_SIZE 2048
|
#define DEF_FIDO_SIZE 2048
|
||||||
#define DEF_FIDO_PARAM_FILE "hf_fido2_defparams.json"
|
#define DEF_FIDO_PARAM_FILE "hf_fido2_defparams.json"
|
||||||
|
@ -84,7 +85,7 @@ static int CmdHFFidoInfo(const char *Cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
if (sw)
|
if (sw)
|
||||||
PrintAndLogEx(INFO, "Not a FIDO card! APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(INFO, "Not a FIDO card! APDU response: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
else
|
else
|
||||||
|
@ -111,7 +112,7 @@ static int CmdHFFidoInfo(const char *Cmd) {
|
||||||
if (res) {
|
if (res) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "FIDO2 version doesn't exist (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "FIDO2 version doesn't exist (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +263,7 @@ static int CmdHFFidoRegister(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
DropField();
|
DropField();
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
|
@ -277,7 +278,7 @@ static int CmdHFFidoRegister(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "ERROR execute register command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "ERROR execute register command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -584,7 +585,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
DropField();
|
DropField();
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
|
@ -599,7 +600,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "ERROR execute authentication command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "ERROR execute authentication command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -724,7 +725,7 @@ static int CmdHFFido2MakeCredential(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
DropField();
|
DropField();
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
|
@ -752,7 +753,7 @@ static int CmdHFFido2MakeCredential(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "ERROR execute make credential command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "ERROR execute make credential command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
|
@ -843,7 +844,7 @@ static int CmdHFFido2GetAssertion(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "Can't select FIDO application. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
DropField();
|
DropField();
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
|
@ -871,7 +872,7 @@ static int CmdHFFido2GetAssertion(const char *cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sw != 0x9000) {
|
if (sw != ISO7816_OK) {
|
||||||
PrintAndLogEx(ERR, "ERROR execute get assertion command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
PrintAndLogEx(ERR, "ERROR execute get assertion command. APDU response status: %04x - %s", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
|
||||||
json_decref(root);
|
json_decref(root);
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue