move emv commands to root

This commit is contained in:
merlokk 2018-12-03 18:16:25 +02:00
commit 47d954c79f
6 changed files with 42 additions and 42 deletions

View file

@ -112,7 +112,6 @@ static command_t CommandTable[] = {
{"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"}, {"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"},
{"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"}, {"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"},
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"}, {"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
{"emv", CmdHFEMV, 1, "{ EMV RFIDs... }"},
{"felica", CmdHFFelica, 1, "{ ISO18092 / Felica RFIDs... }"}, {"felica", CmdHFFelica, 1, "{ ISO18092 / Felica RFIDs... }"},
{"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"}, {"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"},
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"}, {"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},

View file

@ -30,7 +30,6 @@
#include "cmdhfmfdes.h" // DESFIRE #include "cmdhfmfdes.h" // DESFIRE
#include "cmdhftopaz.h" // TOPAZ #include "cmdhftopaz.h" // TOPAZ
#include "cmdhffelica.h" // ISO18092 / FeliCa #include "cmdhffelica.h" // ISO18092 / FeliCa
#include "emv/cmdemv.h" // EMV
#include "cmdhffido.h" // FIDO authenticators #include "cmdhffido.h" // FIDO authenticators
#include "cmdtrace.h" // trace list #include "cmdtrace.h" // trace list

View file

@ -22,6 +22,7 @@ static command_t CommandTable[] = {
{"hf", CmdHF, 1, "{ High Frequency commands... }"}, {"hf", CmdHF, 1, "{ High Frequency commands... }"},
{"hw", CmdHW, 1, "{ Hardware commands... }"}, {"hw", CmdHW, 1, "{ Hardware commands... }"},
{"lf", CmdLF, 1, "{ Low Frequency commands... }"}, {"lf", CmdLF, 1, "{ Low Frequency commands... }"},
{"emv", CmdEMV, 1, "{ EMV iso14443 and iso7816... }"},
{"rem", CmdRem, 1, "{ Add text to row in log file }"}, {"rem", CmdRem, 1, "{ Add text to row in log file }"},
{"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.53... }"}, {"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.53... }"},
{"script", CmdScript, 1, "{ Scripting commands }"}, {"script", CmdScript, 1, "{ Scripting commands }"},

View file

@ -31,6 +31,7 @@
#include "cmdscript.h" #include "cmdscript.h"
#include "cmdcrc.h" #include "cmdcrc.h"
#include "cmdanalyse.h" #include "cmdanalyse.h"
#include "emv/cmdemv.h" // EMV
#ifdef WITH_FLASH #ifdef WITH_FLASH
#include "cmdflashmem.h" // rdv40 flashmem commands #include "cmdflashmem.h" // rdv40 flashmem commands

View file

@ -40,7 +40,7 @@ void ParamLoadDefaults(struct tlvdb *tlvRoot) {
TLV_ADD(0x9F66, "\x26\x00\x00\x00"); // qVSDC TLV_ADD(0x9F66, "\x26\x00\x00\x00"); // qVSDC
} }
int CmdHFEMVSelect(const char *cmd) { int CmdEMVSelect(const char *cmd) {
uint8_t data[APDU_AID_LEN] = {0}; uint8_t data[APDU_AID_LEN] = {0};
int datalen = 0; int datalen = 0;
@ -86,7 +86,7 @@ int CmdHFEMVSelect(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVSearch(const char *cmd) { int CmdEMVSearch(const char *cmd) {
CLIParserInit("hf emv search", CLIParserInit("hf emv search",
"Tries to select all applets from applet list:\n", "Tries to select all applets from applet list:\n",
@ -131,7 +131,7 @@ int CmdHFEMVSearch(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVPPSE(const char *cmd) { int CmdEMVPPSE(const char *cmd) {
CLIParserInit("hf emv pse", CLIParserInit("hf emv pse",
"Executes PSE/PPSE select command. It returns list of applet on the card:\n", "Executes PSE/PPSE select command. It returns list of applet on the card:\n",
@ -181,7 +181,7 @@ int CmdHFEMVPPSE(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVGPO(const char *cmd) { int CmdEMVGPO(const char *cmd) {
uint8_t data[APDU_RES_LEN] = {0}; uint8_t data[APDU_RES_LEN] = {0};
int datalen = 0; int datalen = 0;
@ -276,7 +276,7 @@ int CmdHFEMVGPO(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVReadRecord(const char *cmd) { int CmdEMVReadRecord(const char *cmd) {
uint8_t data[APDU_RES_LEN] = {0}; uint8_t data[APDU_RES_LEN] = {0};
int datalen = 0; int datalen = 0;
@ -326,7 +326,7 @@ int CmdHFEMVReadRecord(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVAC(const char *cmd) { int CmdEMVAC(const char *cmd) {
uint8_t data[APDU_RES_LEN] = {0}; uint8_t data[APDU_RES_LEN] = {0};
int datalen = 0; int datalen = 0;
@ -437,7 +437,7 @@ int CmdHFEMVAC(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVGenerateChallenge(const char *cmd) { int CmdEMVGenerateChallenge(const char *cmd) {
CLIParserInit("hf emv challenge", CLIParserInit("hf emv challenge",
"Executes Generate Challenge command. It returns 4 or 8-byte random number from card.\nNeeds a EMV applet to be selected and GPO to be executed.", "Executes Generate Challenge command. It returns 4 or 8-byte random number from card.\nNeeds a EMV applet to be selected and GPO to be executed.",
@ -477,7 +477,7 @@ int CmdHFEMVGenerateChallenge(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVInternalAuthenticate(const char *cmd) { int CmdEMVInternalAuthenticate(const char *cmd) {
uint8_t data[APDU_RES_LEN] = {0}; uint8_t data[APDU_RES_LEN] = {0};
int datalen = 0; int datalen = 0;
@ -631,7 +631,7 @@ void ProcessGPOResponseFormat1(struct tlvdb *tlvRoot, uint8_t *buf, size_t len,
} }
} }
int CmdHFEMVExec(const char *cmd) { int CmdEMVExec(const char *cmd) {
uint8_t buf[APDU_RES_LEN] = {0}; uint8_t buf[APDU_RES_LEN] = {0};
size_t len = 0; size_t len = 0;
uint16_t sw = 0; uint16_t sw = 0;
@ -1071,7 +1071,7 @@ int CmdHFEMVExec(const char *cmd) {
return 0; return 0;
} }
int CmdHFEMVScan(const char *cmd) { int CmdEMVScan(const char *cmd) {
uint8_t AID[APDU_AID_LEN] = {0}; uint8_t AID[APDU_AID_LEN] = {0};
size_t AIDlen = 0; size_t AIDlen = 0;
uint8_t buf[APDU_RES_LEN] = {0}; uint8_t buf[APDU_RES_LEN] = {0};
@ -1409,46 +1409,46 @@ int usage_emv_getrnd(void){
} }
//retrieve the UN number from a terminal //retrieve the UN number from a terminal
int CmdHfEMVGetrng(const char *Cmd) { int CmdEMVGetrng(const char *Cmd) {
char cmdp = param_getchar(Cmd, 0); char cmdp = param_getchar(Cmd, 0);
if ( cmdp == 'h' || cmdp == 'H') return usage_emv_getrnd(); if ( cmdp == 'h' || cmdp == 'H') return usage_emv_getrnd();
return 0; return 0;
} }
int CmdHfEMVList(const char *Cmd) { int CmdEMVList(const char *Cmd) {
return CmdTraceList("7816"); return CmdTraceList("7816");
} }
int CmdHFEMVTest(const char *cmd) { int CmdEMVTest(const char *cmd) {
return ExecuteCryptoTests(true); return ExecuteCryptoTests(true);
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"}, {"help", CmdHelp, 1, "This help"},
{"exec", CmdHFEMVExec, 0, "Executes EMV contactless transaction."}, {"exec", CmdEMVExec, 0, "Executes EMV contactless transaction."},
{"pse", CmdHFEMVPPSE, 0, "Execute PPSE. It selects 2PAY.SYS.DDF01 or 1PAY.SYS.DDF01 directory."}, {"pse", CmdEMVPPSE, 0, "Execute PPSE. It selects 2PAY.SYS.DDF01 or 1PAY.SYS.DDF01 directory."},
{"search", CmdHFEMVSearch, 0, "Try to select all applets from applets list and print installed applets."}, {"search", CmdEMVSearch, 0, "Try to select all applets from applets list and print installed applets."},
{"select", CmdHFEMVSelect, 0, "Select applet."}, {"select", CmdEMVSelect, 0, "Select applet."},
{"gpo", CmdHFEMVGPO, 0, "Execute GetProcessingOptions."}, {"gpo", CmdEMVGPO, 0, "Execute GetProcessingOptions."},
{"readrec", CmdHFEMVReadRecord, 0, "Read files from card."}, {"readrec", CmdEMVReadRecord, 0, "Read files from card."},
{"genac", CmdHFEMVAC, 0, "Generate ApplicationCryptogram."}, {"genac", CmdEMVAC, 0, "Generate ApplicationCryptogram."},
{"challenge", CmdHFEMVGenerateChallenge, 0, "Generate challenge."}, {"challenge", CmdEMVGenerateChallenge, 0, "Generate challenge."},
{"intauth", CmdHFEMVInternalAuthenticate, 0, "Internal authentication."}, {"intauth", CmdEMVInternalAuthenticate, 0, "Internal authentication."},
{"scan", CmdHFEMVScan, 0, "Scan EMV card and save it contents to json file for emulator."}, {"scan", CmdEMVScan, 0, "Scan EMV card and save it contents to json file for emulator."},
{"test", CmdHFEMVTest, 0, "Crypto logic test."}, {"test", CmdEMVTest, 0, "Crypto logic test."},
/* /*
{"getrng", CmdHfEMVGetrng, 0, "get random number from terminal"}, {"getrng", CmdEMVGetrng, 0, "get random number from terminal"},
{"eload", CmdHfEmvELoad, 0, "load EMV tag into device"}, {"eload", CmdEmvELoad, 0, "load EMV tag into device"},
{"dump", CmdHfEmvDump, 0, "dump EMV tag values"}, {"dump", CmdEmvDump, 0, "dump EMV tag values"},
{"sim", CmdHfEmvSim, 0, "simulate EMV tag"}, {"sim", CmdEmvSim, 0, "simulate EMV tag"},
{"clone", CmdHfEmvClone, 0, "clone an EMV tag"}, {"clone", CmdEmvClone, 0, "clone an EMV tag"},
*/ */
{"list", CmdHfEMVList, 0, "[Deprecated] List ISO7816 history"}, {"list", CmdEMVList, 0, "[Deprecated] List ISO7816 history"},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
int CmdHFEMV(const char *Cmd) { int CmdEMV(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
CmdsParse(CommandTable, Cmd); CmdsParse(CommandTable, Cmd);
return 0; return 0;

View file

@ -26,13 +26,13 @@
#include "emvcore.h" #include "emvcore.h"
#include "apduinfo.h" #include "apduinfo.h"
int CmdHFEMV(const char *Cmd); int CmdEMV(const char *Cmd);
extern int CmdHFEMVSelect(const char *cmd); extern int CmdEMVSelect(const char *cmd);
extern int CmdHFEMVSearch(const char *cmd); extern int CmdEMVSearch(const char *cmd);
extern int CmdHFEMVPPSE(const char *cmd); extern int CmdEMVPPSE(const char *cmd);
extern int CmdHFEMVExec(const char *cmd); extern int CmdEMVExec(const char *cmd);
extern int CmdHfEMVGetrng(const char *Cmd); extern int CmdEMVGetrng(const char *Cmd);
extern int CmdHfEMVList(const char *Cmd); extern int CmdEMVList(const char *Cmd);
#endif #endif