1. fixed hf 14a mifare. added functionality to ignore one Nt

2. completed hf 14a nested
3. added hf 14a chk to check keys
5. added check keys to hf 14a mifare and hf 14a nested
6. added debug level to mifare commands
7. small bugs and improvements
This commit is contained in:
Merlokbr@gmail.com 2011-06-07 12:35:52 +00:00
commit f397b5cc87
16 changed files with 877 additions and 317 deletions

View file

@ -8,6 +8,8 @@
//-----------------------------------------------------------------------------
// code for work with mifare cards.
//-----------------------------------------------------------------------------
#ifndef __MIFAREUTIL_H
#define __MIFAREUTIL_H
#define CRYPT_NONE 0
#define CRYPT_ALL 1
@ -15,6 +17,22 @@
#define AUTH_FIRST 0
#define AUTH_NESTED 2
// debug
// 0 - no debug messages 1 - error messages 2 - all messages 4 - extended debug mode
#define MF_DBG_NONE 0
#define MF_DBG_ERROR 1
#define MF_DBG_ALL 2
#define MF_DBG_EXTENDED 4
extern int MF_DBGLEVEL;
//mifare nested
#define MEM_CHUNK 10000
#define TRY_KEYS 50
#define NS_TOLERANCE 10 // [distance avg-value, distance avg+value]
#define NS_RETRIES_GETNONCE 15
#define NES_MAX_INFO 5
//mifare emulate states
#define MFEMUL_NOFIELD 0
#define MFEMUL_IDLE 1
@ -37,3 +55,4 @@ int mifare_classic_readblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blo
int mifare_classic_writeblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t *blockData);
int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid);
#endif