Merge branch 'master' of github.com:merlokk/proxmark3i into emv_vsdc

This commit is contained in:
merlokk 2019-02-19 18:34:52 +02:00
commit bebfcab7b9
84 changed files with 3694 additions and 923 deletions

View file

@ -623,7 +623,7 @@ int CmdEMVInternalAuthenticate(const char *cmd) {
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) {
@ -1244,7 +1244,7 @@ int CmdEMVExec(const char *cmd) {
}
DropField();
DropFieldEx( channel );
// Destroy TLV's
free(pdol_data_tlv);
@ -1346,7 +1346,7 @@ int CmdEMVScan(const char *cmd) {
}
// drop field at start
DropField();
DropFieldEx( channel );
// iso 14443 select
PrintAndLogEx(NORMAL, "--> GET UID, ATS.");
@ -1399,7 +1399,7 @@ int CmdEMVScan(const char *cmd) {
if (EMVSearch(channel, false, true, decodeTLV, tlvSelect)) {
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
tlvdb_free(tlvSelect);
DropField();
DropFieldEx( channel );
return 3;
}
@ -1415,7 +1415,7 @@ int CmdEMVScan(const char *cmd) {
if (!AIDlen) {
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
DropField();
DropFieldEx( channel );
return 4;
}
@ -1434,7 +1434,7 @@ int CmdEMVScan(const char *cmd) {
if (res) {
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 5;
}
@ -1462,7 +1462,7 @@ int CmdEMVScan(const char *cmd) {
if (!pdol_data_tlv){
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 6;
}
@ -1471,7 +1471,7 @@ int CmdEMVScan(const char *cmd) {
if (!pdol_data_tlv_data) {
PrintAndLogEx(ERR, "Can't create PDOL data.");
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 6;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
@ -1485,7 +1485,7 @@ int CmdEMVScan(const char *cmd) {
if (res) {
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 7;
}
ProcessGPOResponseFormat1(tlvRoot, buf, len, decodeTLV);
@ -1577,8 +1577,7 @@ int CmdEMVScan(const char *cmd) {
// free tlv object
tlvdb_free(tlvRoot);
// DropField
DropField();
DropFieldEx( channel );
res = json_dump_file(root, fname, JSON_INDENT(2));
if (res) {
@ -1631,6 +1630,14 @@ int CmdEMVRoca(const char *cmd) {
if (arg_get_lit(2))
channel = ECC_CONTACT;
PrintChannel(channel);
#ifndef WITH_SMARTCARD
// not compiled with smartcard functionality, we need to exit
if ( channel == ECC_CONTACT ) {
PrintAndLogEx(WARNING, "PM3 Client is not compiled with support for SMARTCARD. Exiting.");
return 0;
}
#endif
// select card
uint8_t psenum = (channel == ECC_CONTACT) ? 1 : 2;
@ -1654,7 +1661,7 @@ int CmdEMVRoca(const char *cmd) {
if (EMVSearch(channel, false, true, false, tlvSelect)) {
PrintAndLogEx(ERR, "Can't found any of EMV AID. Exit...");
tlvdb_free(tlvSelect);
DropField();
DropFieldEx( channel );
return 3;
}
@ -1670,7 +1677,7 @@ int CmdEMVRoca(const char *cmd) {
if (!AIDlen) {
PrintAndLogEx(INFO, "Can't select AID. EMV AID not found. Exit...");
DropField();
DropFieldEx( channel );
return 4;
}
@ -1685,7 +1692,7 @@ int CmdEMVRoca(const char *cmd) {
if (res) {
PrintAndLogEx(ERR, "Can't select AID (%d). Exit...", res);
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 5;
}
@ -1697,7 +1704,7 @@ int CmdEMVRoca(const char *cmd) {
if (!pdol_data_tlv){
PrintAndLogEx(ERR, "Can't create PDOL TLV.");
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 6;
}
@ -1706,7 +1713,7 @@ int CmdEMVRoca(const char *cmd) {
if (!pdol_data_tlv_data) {
PrintAndLogEx(ERR, "Can't create PDOL data.");
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 6;
}
PrintAndLogEx(INFO, "PDOL data[%d]: %s", pdol_data_tlv_data_len, sprint_hex(pdol_data_tlv_data, pdol_data_tlv_data_len));
@ -1720,7 +1727,7 @@ int CmdEMVRoca(const char *cmd) {
if (res) {
PrintAndLogEx(ERR, "GPO error(%d): %4x. Exit...", res, sw);
tlvdb_free(tlvRoot);
DropField();
DropFieldEx( channel );
return 7;
}
ProcessGPOResponseFormat1(tlvRoot, buf, len, false);
@ -1818,10 +1825,7 @@ out:
// free tlv object
tlvdb_free(tlvRoot);
if ( channel == ECC_CONTACTLESS)
DropField();
DropFieldEx( channel );
return 0;
}