]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
Fixes 2 bugs in mifare simulate (#380)
authoretmatrix <david.gnomo@excite.it>
Thu, 17 Aug 2017 14:59:48 +0000 (16:59 +0200)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Thu, 17 Aug 2017 14:59:48 +0000 (16:59 +0200)
- Check button press when there is NOFIELD, so we can exit also without FIELD
- struct nonces_t is moved to include/mifare.h so client and arm has the same definition

armsrc/iso14443a.c
client/mfkey.c
client/mfkey.h
include/mifare.h

index d648beee338f293b08c45bc9db62d2bf5f019d75..29b23833cd875065c26a1aa06f9981391941c86f 100644 (file)
@@ -2352,18 +2352,6 @@ void ReaderMifare(bool first_try)
        set_tracing(false);
 }
 
-typedef struct {
-  uint32_t cuid;
-  uint8_t  sector;
-  uint8_t  keytype;
-  uint32_t nonce;
-  uint32_t ar;
-  uint32_t nr;
-  uint32_t nonce2;
-  uint32_t ar2;
-  uint32_t nr2;
-} nonces_t;
-
 /**
   *MIFARE 1K simulate.
   *
@@ -2562,7 +2550,10 @@ void Mifare1ksim(uint8_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t *
                                LED_A_ON();
                        }
                }
-               if (cardSTATE == MFEMUL_NOFIELD) continue;
+               if (cardSTATE == MFEMUL_NOFIELD) {
+                       button_pushed = BUTTON_PRESS();
+                       continue;
+               }
 
                //Now, get data
                res = EmGetCmd(receivedCmd, &len, receivedCmd_par);
index 60cfcbbf5e723e1d70208281158ddbec45d93250..2ab15dcbd5ff89324a0fbf59311b83396b255ac5 100644 (file)
@@ -10,6 +10,7 @@
 // MIFARE Darkside hack
 //-----------------------------------------------------------------------------
 
+#include "mifare.h"
 #include "mfkey.h"
 
 #include "crapto1/crapto1.h"
index ad5a863da0ae0095c30a222d7de146eca1c73a35..fb7f575b2ce53603d51b7c7c24a20b0b818df719 100644 (file)
 #include <stdint.h>
 #include <stdbool.h>
 
-typedef struct {
-                         uint32_t cuid;
-                         uint8_t  sector;
-                         uint8_t  keytype;
-                         uint32_t nonce;
-                         uint32_t ar;
-                         uint32_t nr;
-                         uint32_t at;
-                         uint32_t nonce2;
-                         uint32_t ar2;
-                         uint32_t nr2;
-                       } nonces_t;
-
 extern bool mfkey32(nonces_t data, uint64_t *outputkey);
 extern bool mfkey32_moebius(nonces_t data, uint64_t *outputkey);
 extern int mfkey64(nonces_t data, uint64_t *outputkey);
index ad86886dbc0b69afc29ce453b08ec94be5cd23fb..e2386cd5926fb2c5869d189e88981e317246f806 100644 (file)
@@ -37,4 +37,17 @@ typedef enum ISO14A_COMMAND {
        ISO14A_TOPAZMODE =                      (1 << 8)
 } iso14a_command_t;
 
+typedef struct {
+       uint32_t cuid;
+       uint8_t  sector;
+       uint8_t  keytype;
+       uint32_t nonce;
+       uint32_t ar;
+       uint32_t nr;
+       uint32_t at;
+       uint32_t nonce2;
+       uint32_t ar2;
+       uint32_t nr2;
+} nonces_t;
+
 #endif // _MIFARE_H_
Impressum, Datenschutz