X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/c068ebb78f2e4070fcf1a604df0d7088374b60c6..0db11b71efad3781186cc2da9f31686a6562d065:/client/cmdhfmfdes.c diff --git a/client/cmdhfmfdes.c b/client/cmdhfmfdes.c index f72cfecd..9ab5a4af 100644 --- a/client/cmdhfmfdes.c +++ b/client/cmdhfmfdes.c @@ -12,7 +12,6 @@ #include #include #include -//#include #include "loclass/des.h" #include "cmdmain.h" #include "proxmark3.h" @@ -36,9 +35,6 @@ uint8_t key_defa_data[16] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, uint8_t key_picc_data[16] = { 0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f }; static int CmdHelp(const char *Cmd); -static void xor(unsigned char * dst, unsigned char * src, size_t len); -static int32_t le24toh (uint8_t data[3]); - int CmdHF14ADesWb(const char *Cmd) { @@ -356,7 +352,7 @@ void GetKeySettings( uint8_t *aid){ PrintAndLog(" Can't read Application Master key settings"); } else { // Access rights. - uint8_t rights = (resp.d.asBytes[3] >> 4 && 0xff); + uint8_t rights = (resp.d.asBytes[3] >> 4 & 0xff); switch (rights){ case 0x00: str = "AMK authentication is necessary to change any key (default)"; @@ -615,7 +611,7 @@ int CmdHF14ADesAuth(const char *Cmd){ c.d.asBytes[0] = keylength; memcpy(c.d.asBytes+1, key, keylength); - + clearCommandBuffer(); SendCommand(&c); UsbCommand resp; @@ -640,38 +636,27 @@ int CmdHF14ADesAuth(const char *Cmd){ } -static void xor(unsigned char * dst, unsigned char * src, size_t len) { - for( ; len > 0; len--,dst++,src++) - *dst ^= *src; -} - -static int32_t le24toh (uint8_t data[3]) { - return (data[2] << 16) | (data[1] << 8) | data[0]; -} - -static command_t CommandTable[] = -{ +static command_t CommandTable[] = { {"help", CmdHelp, 1, "This help"}, - {"auth", CmdHF14ADesAuth, 0, "Tries a MIFARE DesFire Authentication"}, - {"rb", CmdHF14ADesRb, 0, "Read MIFARE DesFire block"}, - {"wb", CmdHF14ADesWb, 0, "write MIFARE DesFire block"}, {"info", CmdHF14ADesInfo, 0, "Get MIFARE DesFire information"}, {"enum", CmdHF14ADesEnumApplications,0, "Tries enumerate all applications"}, + {"auth", CmdHF14ADesAuth, 0, "Tries a MIFARE DesFire Authentication"}, + {"rdbl", CmdHF14ADesRb, 0, "Read MIFARE DesFire block"}, + {"wrbl", CmdHF14ADesWb, 0, "write MIFARE DesFire block"}, {NULL, NULL, 0, NULL} }; -int CmdHFMFDes(const char *Cmd) -{ +int CmdHFMFDes(const char *Cmd) { // flush - WaitForResponseTimeout(CMD_ACK,NULL,100); - CmdsParse(CommandTable, Cmd); - return 0; + clearCommandBuffer(); + //WaitForResponseTimeout(CMD_ACK,NULL,100); + CmdsParse(CommandTable, Cmd); + return 0; } -int CmdHelp(const char *Cmd) -{ - CmdsHelp(CommandTable); - return 0; +int CmdHelp(const char *Cmd) { + CmdsHelp(CommandTable); + return 0; }