From 47d954c79ff91cb0f9efa5d9f20400640636dd05 Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 3 Dec 2018 18:16:25 +0200 Subject: [PATCH] move emv commands to root --- client/cmdhf.c | 1 - client/cmdhf.h | 1 - client/cmdmain.c | 1 + client/cmdmain.h | 1 + client/emv/cmdemv.c | 64 ++++++++++++++++++++++----------------------- client/emv/cmdemv.h | 16 ++++++------ 6 files changed, 42 insertions(+), 42 deletions(-) diff --git a/client/cmdhf.c b/client/cmdhf.c index 65b6bd33d..cb4e424da 100644 --- a/client/cmdhf.c +++ b/client/cmdhf.c @@ -112,7 +112,6 @@ static command_t CommandTable[] = { {"14b", CmdHF14B, 1, "{ ISO14443B RFIDs... }"}, {"15", CmdHF15, 1, "{ ISO15693 RFIDs... }"}, {"epa", CmdHFEPA, 1, "{ German Identification Card... }"}, - {"emv", CmdHFEMV, 1, "{ EMV RFIDs... }"}, {"felica", CmdHFFelica, 1, "{ ISO18092 / Felica RFIDs... }"}, {"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"}, {"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"}, diff --git a/client/cmdhf.h b/client/cmdhf.h index bd191ead5..b2dcc10f1 100644 --- a/client/cmdhf.h +++ b/client/cmdhf.h @@ -30,7 +30,6 @@ #include "cmdhfmfdes.h" // DESFIRE #include "cmdhftopaz.h" // TOPAZ #include "cmdhffelica.h" // ISO18092 / FeliCa -#include "emv/cmdemv.h" // EMV #include "cmdhffido.h" // FIDO authenticators #include "cmdtrace.h" // trace list diff --git a/client/cmdmain.c b/client/cmdmain.c index 85d7f19c3..5b147e76a 100644 --- a/client/cmdmain.c +++ b/client/cmdmain.c @@ -22,6 +22,7 @@ static command_t CommandTable[] = { {"hf", CmdHF, 1, "{ High Frequency commands... }"}, {"hw", CmdHW, 1, "{ Hardware commands... }"}, {"lf", CmdLF, 1, "{ Low Frequency commands... }"}, + {"emv", CmdEMV, 1, "{ EMV iso14443 and iso7816... }"}, {"rem", CmdRem, 1, "{ Add text to row in log file }"}, {"reveng", CmdRev, 1, "{ Crc calculations from the software reveng 1.53... }"}, {"script", CmdScript, 1, "{ Scripting commands }"}, diff --git a/client/cmdmain.h b/client/cmdmain.h index 74804300d..629cd98af 100644 --- a/client/cmdmain.h +++ b/client/cmdmain.h @@ -31,6 +31,7 @@ #include "cmdscript.h" #include "cmdcrc.h" #include "cmdanalyse.h" +#include "emv/cmdemv.h" // EMV #ifdef WITH_FLASH #include "cmdflashmem.h" // rdv40 flashmem commands diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index 5a64892c4..fef34a863 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -40,7 +40,7 @@ void ParamLoadDefaults(struct tlvdb *tlvRoot) { 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}; int datalen = 0; @@ -86,7 +86,7 @@ int CmdHFEMVSelect(const char *cmd) { return 0; } -int CmdHFEMVSearch(const char *cmd) { +int CmdEMVSearch(const char *cmd) { CLIParserInit("hf emv search", "Tries to select all applets from applet list:\n", @@ -131,7 +131,7 @@ int CmdHFEMVSearch(const char *cmd) { return 0; } -int CmdHFEMVPPSE(const char *cmd) { +int CmdEMVPPSE(const char *cmd) { CLIParserInit("hf emv pse", "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; } -int CmdHFEMVGPO(const char *cmd) { +int CmdEMVGPO(const char *cmd) { uint8_t data[APDU_RES_LEN] = {0}; int datalen = 0; @@ -276,7 +276,7 @@ int CmdHFEMVGPO(const char *cmd) { return 0; } -int CmdHFEMVReadRecord(const char *cmd) { +int CmdEMVReadRecord(const char *cmd) { uint8_t data[APDU_RES_LEN] = {0}; int datalen = 0; @@ -326,7 +326,7 @@ int CmdHFEMVReadRecord(const char *cmd) { return 0; } -int CmdHFEMVAC(const char *cmd) { +int CmdEMVAC(const char *cmd) { uint8_t data[APDU_RES_LEN] = {0}; int datalen = 0; @@ -437,7 +437,7 @@ int CmdHFEMVAC(const char *cmd) { return 0; } -int CmdHFEMVGenerateChallenge(const char *cmd) { +int CmdEMVGenerateChallenge(const char *cmd) { 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.", @@ -477,7 +477,7 @@ int CmdHFEMVGenerateChallenge(const char *cmd) { return 0; } -int CmdHFEMVInternalAuthenticate(const char *cmd) { +int CmdEMVInternalAuthenticate(const char *cmd) { uint8_t data[APDU_RES_LEN] = {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}; size_t len = 0; uint16_t sw = 0; @@ -1071,7 +1071,7 @@ int CmdHFEMVExec(const char *cmd) { return 0; } -int CmdHFEMVScan(const char *cmd) { +int CmdEMVScan(const char *cmd) { uint8_t AID[APDU_AID_LEN] = {0}; size_t AIDlen = 0; uint8_t buf[APDU_RES_LEN] = {0}; @@ -1409,46 +1409,46 @@ int usage_emv_getrnd(void){ } //retrieve the UN number from a terminal -int CmdHfEMVGetrng(const char *Cmd) { +int CmdEMVGetrng(const char *Cmd) { char cmdp = param_getchar(Cmd, 0); if ( cmdp == 'h' || cmdp == 'H') return usage_emv_getrnd(); return 0; } -int CmdHfEMVList(const char *Cmd) { +int CmdEMVList(const char *Cmd) { return CmdTraceList("7816"); } -int CmdHFEMVTest(const char *cmd) { +int CmdEMVTest(const char *cmd) { return ExecuteCryptoTests(true); } static command_t CommandTable[] = { - {"help", CmdHelp, 1, "This help"}, - {"exec", CmdHFEMVExec, 0, "Executes EMV contactless transaction."}, - {"pse", CmdHFEMVPPSE, 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."}, - {"select", CmdHFEMVSelect, 0, "Select applet."}, - {"gpo", CmdHFEMVGPO, 0, "Execute GetProcessingOptions."}, - {"readrec", CmdHFEMVReadRecord, 0, "Read files from card."}, - {"genac", CmdHFEMVAC, 0, "Generate ApplicationCryptogram."}, - {"challenge", CmdHFEMVGenerateChallenge, 0, "Generate challenge."}, - {"intauth", CmdHFEMVInternalAuthenticate, 0, "Internal authentication."}, - {"scan", CmdHFEMVScan, 0, "Scan EMV card and save it contents to json file for emulator."}, - {"test", CmdHFEMVTest, 0, "Crypto logic test."}, + {"help", CmdHelp, 1, "This help"}, + {"exec", CmdEMVExec, 0, "Executes EMV contactless transaction."}, + {"pse", CmdEMVPPSE, 0, "Execute PPSE. It selects 2PAY.SYS.DDF01 or 1PAY.SYS.DDF01 directory."}, + {"search", CmdEMVSearch, 0, "Try to select all applets from applets list and print installed applets."}, + {"select", CmdEMVSelect, 0, "Select applet."}, + {"gpo", CmdEMVGPO, 0, "Execute GetProcessingOptions."}, + {"readrec", CmdEMVReadRecord, 0, "Read files from card."}, + {"genac", CmdEMVAC, 0, "Generate ApplicationCryptogram."}, + {"challenge", CmdEMVGenerateChallenge, 0, "Generate challenge."}, + {"intauth", CmdEMVInternalAuthenticate, 0, "Internal authentication."}, + {"scan", CmdEMVScan, 0, "Scan EMV card and save it contents to json file for emulator."}, + {"test", CmdEMVTest, 0, "Crypto logic test."}, /* - {"getrng", CmdHfEMVGetrng, 0, "get random number from terminal"}, - {"eload", CmdHfEmvELoad, 0, "load EMV tag into device"}, - {"dump", CmdHfEmvDump, 0, "dump EMV tag values"}, - {"sim", CmdHfEmvSim, 0, "simulate EMV tag"}, - {"clone", CmdHfEmvClone, 0, "clone an EMV tag"}, + {"getrng", CmdEMVGetrng, 0, "get random number from terminal"}, + {"eload", CmdEmvELoad, 0, "load EMV tag into device"}, + {"dump", CmdEmvDump, 0, "dump EMV tag values"}, + {"sim", CmdEmvSim, 0, "simulate 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} }; -int CmdHFEMV(const char *Cmd) { +int CmdEMV(const char *Cmd) { clearCommandBuffer(); CmdsParse(CommandTable, Cmd); return 0; diff --git a/client/emv/cmdemv.h b/client/emv/cmdemv.h index 76fb89c4b..b4397fd15 100644 --- a/client/emv/cmdemv.h +++ b/client/emv/cmdemv.h @@ -26,13 +26,13 @@ #include "emvcore.h" #include "apduinfo.h" -int CmdHFEMV(const char *Cmd); +int CmdEMV(const char *Cmd); -extern int CmdHFEMVSelect(const char *cmd); -extern int CmdHFEMVSearch(const char *cmd); -extern int CmdHFEMVPPSE(const char *cmd); -extern int CmdHFEMVExec(const char *cmd); -extern int CmdHfEMVGetrng(const char *Cmd); -extern int CmdHfEMVList(const char *Cmd); +extern int CmdEMVSelect(const char *cmd); +extern int CmdEMVSearch(const char *cmd); +extern int CmdEMVPPSE(const char *cmd); +extern int CmdEMVExec(const char *cmd); +extern int CmdEMVGetrng(const char *Cmd); +extern int CmdEMVList(const char *Cmd); -#endif \ No newline at end of file +#endif