added mock of key check
authorOleg Moiseenko <olegmsn@gmail.com>
Sat, 10 Feb 2018 21:06:01 +0000 (23:06 +0200)
committerOleg Moiseenko <olegmsn@gmail.com>
Sat, 10 Feb 2018 21:06:01 +0000 (23:06 +0200)
client/cmdhflist.c
client/cmdhflist.h

index 43e0e56258565a97bac788f53c11ad7e932b45c9..30249579848a8ea40f427d41d2db97be0dd9b4b1 100644 (file)
@@ -23,6 +23,7 @@
 #include "protocols.h"
 #include "crapto1/crapto1.h"
 #include "mifarehost.h"
+#include "mifaredefault.h"
 
 
 enum MifareAuthSeq {
@@ -291,10 +292,17 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *m
                        
                        // check last used key
                        if (mfLastKey) {
-                               
+                               if (NestedCheckKey(mfLastKey, &AuthData, cmd, cmdsize)) {
+                               };
                        }
                        
                        // check default keys
+                       for (int defaultKeyCounter = 0; defaultKeyCounter < MifareDefaultKeysSize; defaultKeyCounter++){
+                               if (NestedCheckKey(MifareDefaultKeys[defaultKeyCounter], &AuthData, cmd, cmdsize)) {
+                                       
+                                       break;
+                               };
+                       }
                        
                        // nested
                        if (validate_prng_nonce(AuthData.nt)) {
@@ -317,3 +325,6 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *m
        return *mfDataLen > 0;
 }
 
+bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize) {
+       return false;
+}
\ No newline at end of file
index 7d95cc1c2b888f73c7cddbb8380a5a569fda9c81..d0298de50ff2b80a5290aa23f8b0f6e0049447cf 100644 (file)
@@ -33,5 +33,6 @@ extern uint8_t mifare_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
 extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize);
 extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse);
 extern bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *mfData, size_t *mfDataLen);
+extern bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize);
 
 #endif // CMDHFLIST
Impressum, Datenschutz