]>
Commit | Line | Data |
---|---|---|
1 | //-----------------------------------------------------------------------------\r | |
2 | // Merlok, May 2011\r | |
3 | // Many authors, that makes it possible\r | |
4 | //\r | |
5 | // This code is licensed to you under the terms of the GNU GPL, version 2 or,\r | |
6 | // at your option, any later version. See the LICENSE.txt file for the text of\r | |
7 | // the license.\r | |
8 | //-----------------------------------------------------------------------------\r | |
9 | // code for work with mifare cards.\r | |
10 | //-----------------------------------------------------------------------------\r | |
11 | #ifndef __MIFAREUTIL_H\r | |
12 | #define __MIFAREUTIL_H\r | |
13 | \r | |
14 | #define CRYPT_NONE 0\r | |
15 | #define CRYPT_ALL 1\r | |
16 | #define CRYPT_REQUEST 2\r | |
17 | #define AUTH_FIRST 0\r | |
18 | #define AUTH_NESTED 2\r | |
19 | \r | |
20 | // debug\r | |
21 | // 0 - no debug messages 1 - error messages 2 - all messages 4 - extended debug mode\r | |
22 | #define MF_DBG_NONE 0\r | |
23 | #define MF_DBG_ERROR 1\r | |
24 | #define MF_DBG_ALL 2\r | |
25 | #define MF_DBG_EXTENDED 4\r | |
26 | \r | |
27 | extern int MF_DBGLEVEL;\r | |
28 | \r | |
29 | //mifare nested\r | |
30 | #define MEM_CHUNK 10000\r | |
31 | #define TRY_KEYS 50\r | |
32 | #define NS_TOLERANCE 10 // [distance avg-value, distance avg+value]\r | |
33 | #define NS_RETRIES_GETNONCE 15\r | |
34 | #define NES_MAX_INFO 5\r | |
35 | \r | |
36 | //mifare emulate states\r | |
37 | #define MFEMUL_NOFIELD 0\r | |
38 | #define MFEMUL_IDLE 1\r | |
39 | #define MFEMUL_SELECT1 2\r | |
40 | #define MFEMUL_SELECT2 3\r | |
41 | #define MFEMUL_AUTH1 4\r | |
42 | #define MFEMUL_AUTH2 5\r | |
43 | #define MFEMUL_HALTED 6\r | |
44 | \r | |
45 | //functions\r | |
46 | uint8_t* mifare_get_bigbufptr(void);\r | |
47 | int mifare_sendcmd_short(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer);\r | |
48 | int mifare_sendcmd_shortex(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer, uint32_t * parptr);\r | |
49 | \r | |
50 | int mifare_classic_auth(struct Crypto1State *pcs, uint32_t uid, \\r | |
51 | uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested);\r | |
52 | int mifare_classic_authex(struct Crypto1State *pcs, uint32_t uid, \\r | |
53 | uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested, uint32_t * ntptr);\r | |
54 | int mifare_classic_readblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t *blockData); \r | |
55 | int mifare_classic_writeblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t *blockData);\r | |
56 | int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid); \r | |
57 | \r | |
58 | #endif |