]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifaredesfire.c
Merge pull request #4 from gcohen55/ubuntu_makefile
[proxmark3-svn] / armsrc / mifaredesfire.c
index 979e2f39cd2d04b2184d01a74a6f07938ca918dc..4d68bf5fc9a7e6ddf32d6a6064362d4eb6e458dc 100644 (file)
@@ -19,13 +19,12 @@ static  uint8_t deselect_cmd[] = {0xc2,0xe0,0xb4};
 //static uint8_t __res[MAX_FRAME_SIZE];
 
 bool InitDesfireCard(){
 //static uint8_t __res[MAX_FRAME_SIZE];
 
 bool InitDesfireCard(){
-       
-       byte_t cardbuf[USB_CMD_DATA_SIZE] = {0x00};
 
 
-       iso14a_card_select_t *card = (iso14a_card_select_t*)cardbuf;
-       
-       set_tracing(TRUE);
        iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
        iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
+       set_tracing(TRUE);
+
+       byte_t cardbuf[USB_CMD_DATA_SIZE] = {0x00};
+       iso14a_card_select_t *card = (iso14a_card_select_t*)cardbuf;
        
        int len = iso14443a_select_card(NULL,card,NULL);
 
        
        int len = iso14443a_select_card(NULL,card,NULL);
 
@@ -433,7 +432,7 @@ int DesfireAPDU(uint8_t *cmd, size_t cmd_len, uint8_t *dataout){
 
        size_t len = 0;
        size_t wrappedLen = 0;
 
        size_t len = 0;
        size_t wrappedLen = 0;
-       uint8_t wCmd[USB_CMD_DATA_SIZE] = {0};
+       uint8_t wCmd[USB_CMD_DATA_SIZE] = {0x00};
        
        uint8_t resp[MAX_FRAME_SIZE];
     uint8_t par[MAX_PARITY_SIZE];
        
        uint8_t resp[MAX_FRAME_SIZE];
     uint8_t par[MAX_PARITY_SIZE];
@@ -448,9 +447,7 @@ int DesfireAPDU(uint8_t *cmd, size_t cmd_len, uint8_t *dataout){
        len = ReaderReceive(resp, par);
        
        if( len == 0x00 ){
        len = ReaderReceive(resp, par);
        
        if( len == 0x00 ){
-               if (MF_DBGLEVEL >= 4) {
-                       Dbprintf("fukked");
-               }
+               if (MF_DBGLEVEL >= 4) Dbprintf("fukked");
                return FALSE; //DATA LINK ERROR
        }
        // if we received an I- or R(ACK)-Block with a block number equal to the
                return FALSE; //DATA LINK ERROR
        }
        // if we received an I- or R(ACK)-Block with a block number equal to the
@@ -502,6 +499,7 @@ void OnSuccess(){
 void OnError(uint8_t reason){
        pcb_blocknum = 0;
        ReaderTransmit(deselect_cmd, 3 , NULL);
 void OnError(uint8_t reason){
        pcb_blocknum = 0;
        ReaderTransmit(deselect_cmd, 3 , NULL);
+       
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        cmd_send(CMD_ACK,0,reason,0,0,0);
        LEDsoff();
        FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
        cmd_send(CMD_ACK,0,reason,0,0,0);
        LEDsoff();
Impressum, Datenschutz