]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmfdes.c
CHG: the device-side code for "hf 14a sim x"
[proxmark3-svn] / client / cmdhfmfdes.c
index c0c7a67ec0c87180404b5e0e26932144326cb68e..f72cfecdb14571fd9de668f6202635477d7e8f15 100644 (file)
@@ -12,7 +12,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
-#include <openssl/des.h>
+//#include <openssl/des.h>
+#include "loclass/des.h"
 #include "cmdmain.h"
 #include "proxmark3.h"
 #include "../include/common.h"
 #include "cmdparser.h"
 #include "util.h"
 #include "cmdhfmfdes.h"
+#include "cmdhf14a.h"
+
 
 uint8_t CMDPOS = 0;
 uint8_t LENPOS = 1;
 
-uint8_t key_zero_data[16] = { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 };
+uint8_t key_zero_data[16] = { 0x00 };
+uint8_t key_ones_data[16] = { 0x01 };
 uint8_t key_defa_data[16] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f };
-uint8_t key_ones_data[16] = { 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01 };
 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);
@@ -157,7 +160,7 @@ int CmdHF14ADesInfo(const char *Cmd){
        PrintAndLog("  Production date    : week %02x, 20%02x",resp.d.asBytes[33], resp.d.asBytes[34]);
        PrintAndLog("  -----------------------------------------------------------");
        PrintAndLog("  Hardware Information");
-       PrintAndLog("      Vendor Id      : %s", GetVendorStr(resp.d.asBytes[7]));
+       PrintAndLog("      Vendor Id      : %s", getTagInfo(resp.d.asBytes[7]));
        PrintAndLog("      Type           : 0x%02X",resp.d.asBytes[8]);
        PrintAndLog("      Subtype        : 0x%02X",resp.d.asBytes[9]);
        PrintAndLog("      Version        : %d.%d",resp.d.asBytes[10], resp.d.asBytes[11]);
@@ -165,7 +168,7 @@ int CmdHF14ADesInfo(const char *Cmd){
        PrintAndLog("      Protocol       : %s",GetProtocolStr(resp.d.asBytes[13]));
        PrintAndLog("  -----------------------------------------------------------");
        PrintAndLog("  Software Information");
-       PrintAndLog("      Vendor Id      : %s",GetVendorStr(resp.d.asBytes[14]));
+       PrintAndLog("      Vendor Id      : %s", getTagInfo(resp.d.asBytes[14]));
        PrintAndLog("      Type           : 0x%02X",resp.d.asBytes[15]);
        PrintAndLog("      Subtype        : 0x%02X",resp.d.asBytes[16]);
        PrintAndLog("      Version        : %d.%d",resp.d.asBytes[17], resp.d.asBytes[18]);
@@ -210,17 +213,6 @@ int CmdHF14ADesInfo(const char *Cmd){
     return 1;
 }
 
-char * GetVendorStr( uint8_t id){
-       static char buf[30];
-       char *retStr = buf;
-       
-       if ( id == 0x04 )
-               sprintf(retStr, "0x%02X (NXP)",id);
-       else 
-               sprintf(retStr,"0x%02X (Unknown)",id);
-       return buf;
-}
-
 /*
   The 7 MSBits (= n) code the storage size itself based on 2^n, 
   the LSBit is set to '0' if the size is exactly 2^n
@@ -236,7 +228,7 @@ char * GetCardSizeStr( uint8_t fsize ){
        uint16_t lsize = 1 << (fsize >>1);
        
        // is  LSB set?
-       if (  fsize & (1 << 0 ) )
+       if (  fsize & 1 )
                sprintf(retStr, "0x%02X (%d - %d bytes)",fsize, usize, lsize);
        else 
                sprintf(retStr, "0x%02X (%d bytes)", fsize, lsize);             
@@ -251,7 +243,7 @@ char * GetProtocolStr(uint8_t id){
        if ( id == 0x05)
                sprintf(retStr,"0x%02X (ISO 14443-3, 14443-4)", id);
        else
-               sprintf(retStr,"0x%02X", id);   
+               sprintf(retStr,"0x%02X (Unknown)", id); 
        return buf;
 }
 
@@ -537,11 +529,6 @@ int CmdHF14ADesEnumApplications(const char *Cmd){
        return 1;
 }
 
-int CmdHF14ADesNonces(const char *Cmd){
-       return 1;
-}
-
-//
 // MIAFRE DesFire Authentication
 //
 #define BUFSIZE 256 
@@ -670,7 +657,6 @@ static command_t CommandTable[] =
   {"wb",               CmdHF14ADesWb,                          0, "write MIFARE DesFire block"},
   {"info",             CmdHF14ADesInfo,                        0, "Get MIFARE DesFire information"},
   {"enum",             CmdHF14ADesEnumApplications,0, "Tries enumerate all applications"},
-  {"nonce",            CmdHF14ADesNonces,                      0, "<n> Collect n>0 nonces"},
   {NULL, NULL, 0, NULL}
 };
 
Impressum, Datenschutz