added mock of key check

This commit is contained in:
Oleg Moiseenko 2018-02-10 23:06:01 +02:00
commit c6a886fb4f
2 changed files with 13 additions and 1 deletions

View file

@ -23,6 +23,7 @@
#include "protocols.h" #include "protocols.h"
#include "crapto1/crapto1.h" #include "crapto1/crapto1.h"
#include "mifarehost.h" #include "mifarehost.h"
#include "mifaredefault.h"
enum MifareAuthSeq { enum MifareAuthSeq {
@ -291,10 +292,17 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *m
// check last used key // check last used key
if (mfLastKey) { if (mfLastKey) {
if (NestedCheckKey(mfLastKey, &AuthData, cmd, cmdsize)) {
};
} }
// check default keys // check default keys
for (int defaultKeyCounter = 0; defaultKeyCounter < MifareDefaultKeysSize; defaultKeyCounter++){
if (NestedCheckKey(MifareDefaultKeys[defaultKeyCounter], &AuthData, cmd, cmdsize)) {
break;
};
}
// nested // nested
if (validate_prng_nonce(AuthData.nt)) { 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; return *mfDataLen > 0;
} }
bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize) {
return false;
}

View 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 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 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 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 #endif // CMDHFLIST