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