mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
CHG: dropfield when CL is used.
This commit is contained in:
parent
384a44ce50
commit
c419f7bf37
3 changed files with 27 additions and 23 deletions
|
@ -623,7 +623,7 @@ int CmdEMVInternalAuthenticate(const char *cmd) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define dreturn(n) {free(pdol_data_tlv);tlvdb_free(tlvSelect);tlvdb_free(tlvRoot);DropField();return n;}
|
#define dreturn(n) {free(pdol_data_tlv); tlvdb_free(tlvSelect); tlvdb_free(tlvRoot); DropFieldEx( channel ); return n;}
|
||||||
|
|
||||||
void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum TransactionType TrType, bool GenACGPO) {
|
void InitTransactionParameters(struct tlvdb *tlvRoot, bool paramLoadJSON, enum TransactionType TrType, bool GenACGPO) {
|
||||||
|
|
||||||
|
@ -1212,7 +1212,7 @@ int CmdEMVExec(const char *cmd) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
|
|
||||||
// Destroy TLV's
|
// Destroy TLV's
|
||||||
free(pdol_data_tlv);
|
free(pdol_data_tlv);
|
||||||
|
@ -1314,7 +1314,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop field at start
|
// drop field at start
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
|
|
||||||
// iso 14443 select
|
// iso 14443 select
|
||||||
PrintAndLogEx(NORMAL, "--> GET UID, ATS.");
|
PrintAndLogEx(NORMAL, "--> GET UID, ATS.");
|
||||||
|
@ -1367,7 +1367,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
if (EMVSearch(channel, false, true, decodeTLV, tlvSelect)) {
|
if (EMVSearch(channel, false, true, decodeTLV, tlvSelect)) {
|
||||||
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
|
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
|
||||||
tlvdb_free(tlvSelect);
|
tlvdb_free(tlvSelect);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
|
|
||||||
if (!AIDlen) {
|
if (!AIDlen) {
|
||||||
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
|
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1402,7 +1402,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
|
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1430,7 +1430,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
if (!pdol_data_tlv){
|
if (!pdol_data_tlv){
|
||||||
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
|
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,7 +1439,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
if (!pdol_data_tlv_data) {
|
if (!pdol_data_tlv_data) {
|
||||||
PrintAndLogEx(ERR, "Can't create PDOL data.");
|
PrintAndLogEx(ERR, "Can't create PDOL data.");
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
|
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
|
||||||
|
@ -1453,7 +1453,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
|
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
ProcessGPOResponseFormat1(tlvRoot, buf, len, decodeTLV);
|
ProcessGPOResponseFormat1(tlvRoot, buf, len, decodeTLV);
|
||||||
|
@ -1545,8 +1545,7 @@ int CmdEMVScan(const char *cmd) {
|
||||||
// free tlv object
|
// free tlv object
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
|
|
||||||
// DropField
|
DropFieldEx( channel );
|
||||||
DropField();
|
|
||||||
|
|
||||||
res = json_dump_file(root, fname, JSON_INDENT(2));
|
res = json_dump_file(root, fname, JSON_INDENT(2));
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -1630,7 +1629,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
if (EMVSearch(channel, false, true, false, tlvSelect)) {
|
if (EMVSearch(channel, false, true, false, tlvSelect)) {
|
||||||
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
|
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
|
||||||
tlvdb_free(tlvSelect);
|
tlvdb_free(tlvSelect);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1646,7 +1645,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
|
|
||||||
if (!AIDlen) {
|
if (!AIDlen) {
|
||||||
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
|
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1661,7 +1660,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
|
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,7 +1672,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
if (!pdol_data_tlv){
|
if (!pdol_data_tlv){
|
||||||
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
|
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1682,7 +1681,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
if (!pdol_data_tlv_data) {
|
if (!pdol_data_tlv_data) {
|
||||||
PrintAndLogEx(ERR, "Can't create PDOL data.");
|
PrintAndLogEx(ERR, "Can't create PDOL data.");
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
|
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
|
||||||
|
@ -1696,7 +1695,7 @@ int CmdEMVRoca(const char *cmd) {
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
|
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
ProcessGPOResponseFormat1(tlvRoot, buf, len, false);
|
ProcessGPOResponseFormat1(tlvRoot, buf, len, false);
|
||||||
|
@ -1794,10 +1793,7 @@ out:
|
||||||
// free tlv object
|
// free tlv object
|
||||||
tlvdb_free(tlvRoot);
|
tlvdb_free(tlvRoot);
|
||||||
|
|
||||||
if ( channel == ECC_CONTACTLESS)
|
DropFieldEx( channel );
|
||||||
DropField();
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ int EMVExchangeEx(EMVCommandChannel channel, bool ActivateField, bool LeaveField
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
|
||||||
if (ActivateField) {
|
if (ActivateField) {
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
msleep(50);
|
msleep(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,7 +484,7 @@ int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldO
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!LeaveFieldON)
|
if(!LeaveFieldON)
|
||||||
DropField();
|
DropFieldEx( channel );
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,6 +178,14 @@
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DropFieldEx
|
||||||
|
#define DropFieldEx(x) { \
|
||||||
|
if ( (x) == ECC_CONTACTLESS) { \
|
||||||
|
DropField(); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
extern uint8_t g_debugMode;
|
extern uint8_t g_debugMode;
|
||||||
|
|
||||||
extern int ukbhit(void);
|
extern int ukbhit(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue