From: merlokk Date: Mon, 4 Dec 2017 20:20:29 +0000 (+0200) Subject: small refactoring X-Git-Tag: v3.1.0~111^2 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/7a7afeba5cbbb518216d0d1d5bb5228a41a4db17?ds=inline;hp=--cc small refactoring --- 7a7afeba5cbbb518216d0d1d5bb5228a41a4db17 diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index 268d9e63..92ae01f9 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -322,7 +322,7 @@ int CmdHFEMVExec(const char *cmd) { switch (param_getchar_indx(cmd, 1, cmdp)) { case 'h': case 'H': - UsageCmdHFEMVPPSE(); + UsageCmdHFEMVExec(); return 0; case 's': case 'S': diff --git a/client/emv/emv_tags.c b/client/emv/emv_tags.c index 80b4c29d..25ad9658 100644 --- a/client/emv/emv_tags.c +++ b/client/emv/emv_tags.c @@ -483,20 +483,20 @@ static void emv_tag_dump_cid(const struct tlv *tlv, const struct emv_tag *tag, F } PRINT_INDENT(level); - if ((tlv->value[0] & 0xC0) == 0x00) fprintf(f, "\tAC1: AAC (Transaction declined)\n"); - if ((tlv->value[0] & 0xC0) == 0x40) fprintf(f, "\tAC1: TC (Transaction approved)\n"); - if ((tlv->value[0] & 0xC0) == 0x80) fprintf(f, "\tAC1: ARQC (Online authorisation requested)\n"); - if ((tlv->value[0] & 0xC0) == 0xC0) fprintf(f, "\tAC1: RFU\n"); + if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_AAC) fprintf(f, "\tAC1: AAC (Transaction declined)\n"); + if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_TC) fprintf(f, "\tAC1: TC (Transaction approved)\n"); + if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_ARQC) fprintf(f, "\tAC1: ARQC (Online authorisation requested)\n"); + if ((tlv->value[0] & EMVAC_AC_MASK) == EMVAC_AC_MASK) fprintf(f, "\tAC1: RFU\n"); - if ((tlv->value[0] & 0x08) != 0x00) { + if (tlv->value[0] & EMVCID_ADVICE) { PRINT_INDENT(level); fprintf(f, "\tAdvice required!\n"); } - if ((tlv->value[0] & 0x07) != 0x00) { + if (tlv->value[0] & EMVCID_REASON_MASK) { PRINT_INDENT(level); fprintf(f, "\tReason/advice/referral code: "); - switch((tlv->value[0] & 0x07)) { + switch((tlv->value[0] & EMVCID_REASON_MASK)) { case 0: fprintf(f, "No information given\n"); break; @@ -510,7 +510,7 @@ static void emv_tag_dump_cid(const struct tlv *tlv, const struct emv_tag *tag, F fprintf(f, "Issuer authentication failed\n"); break; default: - fprintf(f, "\tRFU: %2x\n", (tlv->value[0] & 0x07)); + fprintf(f, "\tRFU: %2x\n", (tlv->value[0] & EMVCID_REASON_MASK)); break; } } diff --git a/client/emv/emv_tags.h b/client/emv/emv_tags.h index 8dbd9e00..f6d44f01 100644 --- a/client/emv/emv_tags.h +++ b/client/emv/emv_tags.h @@ -19,6 +19,17 @@ #include "tlv.h" #include +// AC +# define EMVAC_AC_MASK 0xC0 +# define EMVAC_AAC 0x00 +# define EMVAC_TC 0x40 +# define EMVAC_ARQC 0x80 +# define EMVAC_CDAREQ 0x10 + +// CID +# define EMVCID_ADVICE 0x08 +# define EMVCID_REASON_MASK 0x07 + bool emv_tag_dump(const struct tlv *tlv, FILE *f, int level); #endif diff --git a/client/emv/emvcore.h b/client/emv/emvcore.h index 94c5d9b0..7df58850 100644 --- a/client/emv/emvcore.h +++ b/client/emv/emvcore.h @@ -29,13 +29,6 @@ #define APDU_RES_LEN 260 #define APDU_AID_LEN 50 -// AC -# define EMVAC_AC_MASK 0xC0 -# define EMVAC_AAC 0x00 -# define EMVAC_TC 0x40 -# define EMVAC_ARQC 0x80 -# define EMVAC_CDAREQ 0x10 - enum TransactionType { TT_MSD, TT_VSDC, // not standart for contactless!!!!