]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/mifaredesfire.c
Merge pull request #14 from k02a/patch-2
[proxmark3-svn] / armsrc / mifaredesfire.c
index 57681d716933a59edda9277c117454a552b64631..c5e42277d49650dc47d545ca504b8b0df8e76bc3 100644 (file)
@@ -25,7 +25,7 @@ bool InitDesfireCard(){
        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,true,0);
 
        if (!len) {
                if (MF_DBGLEVEL >= MF_DBG_ERROR)
@@ -63,9 +63,8 @@ void MifareSendCommand(uint8_t arg0, uint8_t arg1, uint8_t *datain){
                print_result(" RX    : ", datain, datalen);
        }
        
-       if ( flags & CLEARTRACE ){
+       if ( flags & CLEARTRACE )
                clear_trace();
-       }
        
        if ( flags & INIT ){
                if ( !InitDesfireCard() )
@@ -73,9 +72,8 @@ void MifareSendCommand(uint8_t arg0, uint8_t arg1, uint8_t *datain){
        }
        
        int len = DesfireAPDU(datain, datalen, resp);
-       if (MF_DBGLEVEL >= 4) {
+       if (MF_DBGLEVEL >= 4)
                print_result("ERR <--: ", resp, len);
-       }
 
        if ( !len ) {
                OnError(2);
@@ -85,9 +83,8 @@ void MifareSendCommand(uint8_t arg0, uint8_t arg1, uint8_t *datain){
        // reset the pcb_blocknum,
        pcb_blocknum = 0;
        
-       if ( flags & DISCONNECT ){
+       if ( flags & DISCONNECT )
                OnSuccess();
-       }
        
        cmd_send(CMD_ACK,1,len,0,resp,len);
 }
@@ -114,7 +111,7 @@ void MifareDesfireGetInformation(){
 
        // card select - information
        iso14a_card_select_t *card = (iso14a_card_select_t*)cardbuf;
-       byte_t isOK = iso14443a_select_card(NULL, card, NULL);
+       byte_t isOK = iso14443a_select_card(NULL, card, NULL, true, 0);
        if ( isOK == 0) {
                if (MF_DBGLEVEL >= MF_DBG_ERROR) {
                        Dbprintf("Can't select card");
@@ -523,7 +520,7 @@ int DesfireAPDU(uint8_t *cmd, size_t cmd_len, uint8_t *dataout){
 
        len = ReaderReceive(resp, par);
        
-       if( len == 0x00 ){
+       if ( !len ) {
                if (MF_DBGLEVEL >= 4) Dbprintf("fukked");
                return FALSE; //DATA LINK ERROR
        }
@@ -575,11 +572,6 @@ void OnSuccess(){
 }
 
 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();
-       set_tracing(FALSE);     
+       OnSuccess();
 }
Impressum, Datenschutz