]> cvs.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/emvcmd.c
ADD: 'hf emv' - forgot to add some file
[proxmark3-svn] / armsrc / emvcmd.c
index 3549d0e3d105ae0c6e075efee45c6d925dd3568e..8b93ad9d3e151eae086795fa1b99b3e8b44c00f6 100644 (file)
@@ -8,23 +8,17 @@
 //--------------------------------------------------------------------------------
 //Routines to support EMV transactions
 //--------------------------------------------------------------------------------
-
-#include "mifare.h"
-#include "iso14443a.h"
-#include "emvutil.h"
 #include "emvcmd.h"
-#include "apps.h"
-#include "emvdataels.h"
 
 static emvtags currentcard; //use to hold emv tags for the reader/card during communications
-static tUart Uart;
+//static tUart Uart;
 
 // The FPGA will report its internal sending delay in
 uint16_t FpgaSendQueueDelay;
 //variables used for timing purposes:
 //these are in ssp_clk cycles:
 //static uint32_t NextTransferTime;
-static uint32_t LastTimeProxToAirStart;
+//static uint32_t LastTimeProxToAirStart;
 //static uint32_t LastProxToAirDuration;
 
 //load individual tag into current card
@@ -134,7 +128,6 @@ int EMVGetProcessingOptions(uint8_t *PDOL, uint8_t PDOLlen, emvtags* inputcard)
 int EMVGetChallenge(emvtags* inputcard)
 {
     uint8_t receivedAnswer[MAX_FRAME_SIZE];
-    //uint8_t receivedAnswerPar[MAX_PARITY_SIZE];
     //variables
     //tlvtag inputtag; //create the tag structure
     //perform select 
@@ -152,7 +145,6 @@ int EMVGenerateAC(uint8_t refcontrol, emvtags* inputcard)
     uint8_t cdolcommandlen = 0;
     tlvtag temptag;
  
-    //uint8_t receivedAnswerPar[MAX_PARITY_SIZE];
     if(currentcard.tag_8C_len > 0) { 
         emv_generateDOL(currentcard.tag_8C, currentcard.tag_8C_len, &currentcard, cdolcommand, &cdolcommandlen); }
     else{
@@ -190,10 +182,9 @@ int EMV_PaywaveTransaction()
     else if((currentcard.tag_9F66[0] & 0x80) == 0x80) {
         if((currentcard.tag_9F66[1] & 0x80) == 1) { //CVN17
             cardMode = VISA_CVN17;
-        }
-        else{
+        } else {
             cardMode = VISA_DCVV; 
-            }
+        }
     }
      
     EMVSelectAID(currentcard.tag_4F,currentcard.tag_4F_len, &currentcard); //perform second AID command
@@ -249,7 +240,7 @@ int EMV_PaywaveTransaction()
         EMVReadRecord(4,2,&currentcard);
     }
     //EMVGetChallenge(&currentcard);
-        //memcpy(currentcard.tag_9F4C,&responsebuffer[1],8); // ICC UN 
+    //memcpy(currentcard.tag_9F4C,&responsebuffer[1],8); // ICC UN 
     EMVGenerateAC(0x81,&currentcard);
 
     Dbprintf("CARDMODE=%i",cardMode);    
@@ -354,7 +345,7 @@ void EMVTransaction()
  
     iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
     while(true) { 
-        if(!iso14443a_select_card(uid,NULL,&cuid)) {
+        if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {
             if(EMV_DBGLEVEL >= 1) Dbprintf("Can't select card");
             break;
         }
@@ -389,6 +380,8 @@ void EMVdumpcard(void){
 //-----------------------------------------------------------------------------
 void SimulateEMVcard()
 {
+       /*
+       
        //uint8_t sak; //select ACKnowledge
     uint16_t readerPacketLen = 64; //reader packet length - provided by RATS, default to 64 bytes if RATS not supported
        
@@ -554,17 +547,17 @@ void SimulateEMVcard()
            currentblock = receivedCmd[0] & 0x01;       
         
         if(receivedCmd[0] == 0x26) { // Received a REQUEST
-                       p_response = &responses[ATR]; order = REQA;
+                       p_response = &responses[ATR]; order = ISO14443A_CMD_REQA;
                } else if(receivedCmd[0] == 0x52) { // Received a WAKEUP
-                       p_response = &responses[ATR]; order = WUPA;
+                       p_response = &responses[ATR]; order = ISO14443A_CMD_WUPA;
                } else if(receivedCmd[1] == 0x20 && receivedCmd[0] == 0x93) {   // Received request for UID (cascade 1)
-                       p_response = &responses[UID1]; order = SELUID1;
+                       p_response = &responses[UID1]; order =  ISO14443A_CMD_ANTICOLL_OR_SELECT;
                } else if(receivedCmd[1] == 0x20 && receivedCmd[0] == 0x95) {   // Received request for UID (cascade 2)
-                       p_response = &responses[UID2]; order = SELUID2;
+                       p_response = &responses[UID2]; order =  ISO14443A_CMD_ANTICOLL_OR_SELECT_2;
                } else if(receivedCmd[1] == 0x70 && receivedCmd[0] == 0x93) {   // Received a SELECT (cascade 1)
-                       p_response = &responses[SELACK1]; order = SEL1;
+                       p_response = &responses[SELACK1]; order =  ISO14443A_CMD_ANTICOLL_OR_SELECT;
                } else if(receivedCmd[1] == 0x70 && receivedCmd[0] == 0x95) {   // Received a SELECT (cascade 2)
-                       p_response = &responses[SELACK2]; order = SEL2;
+                       p_response = &responses[SELACK2]; order =  ISO14443A_CMD_ANTICOLL_OR_SELECT_2;
                } else if((receivedCmd[0] & 0xA2) == 0xA2){ //R-Block received 
             if(previousblock == currentblock){ //rule 11, retransmit last block
                        p_response = &dynamic_response_info;
@@ -737,4 +730,6 @@ void SimulateEMVcard()
        Dbprintf("%x %x %x", happened, happened2, cmdsRecvd);
        LED_A_OFF();
        BigBuf_free_keep_EM();
+       
+       */
 }
Impressum, Datenschutz