]> cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/mifareutil.h
4433fe65a952f3133dc571aff747b09f0495b6f7
[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
12 #ifndef __MIFAREUTIL_H
13 #define __MIFAREUTIL_H
14
15 // mifare authentication
16 #define CRYPT_NONE 0
17 #define CRYPT_ALL 1
18 #define CRYPT_REQUEST 2
19 #define AUTH_FIRST 0
20 #define AUTH_NESTED 2
21
22 // reader voltage field detector
23 #define MF_MINFIELDV 4000
24
25 // debug
26 // 0 - no debug messages 1 - error messages 2 - all messages 4 - extended debug mode
27 #define MF_DBG_NONE 0
28 #define MF_DBG_ERROR 1
29 #define MF_DBG_ALL 2
30 #define MF_DBG_EXTENDED 4
31
32 extern int MF_DBGLEVEL;
33
34 //mifare nested
35 #define MEM_CHUNK 10000
36 #define TRY_KEYS 50
37 #define NS_TOLERANCE 10 // [distance avg-value, distance avg+value]
38 #define NS_RETRIES_GETNONCE 15
39 #define NES_MAX_INFO 5
40
41 //mifare emulator states
42 #define MFEMUL_NOFIELD 0
43 #define MFEMUL_IDLE 1
44 #define MFEMUL_SELECT1 2
45 #define MFEMUL_SELECT2 3
46 #define MFEMUL_AUTH1 4
47 #define MFEMUL_AUTH2 5
48 #define MFEMUL_WORK 6
49 #define MFEMUL_HALTED 7
50
51 //functions
52 uint8_t* mifare_get_bigbufptr(void);
53 int mifare_sendcmd_short(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer);
54 int mifare_sendcmd_shortex(struct Crypto1State *pcs, uint8_t crypted, uint8_t cmd, uint8_t data, uint8_t* answer, uint32_t * parptr);
55
56 int mifare_classic_auth(struct Crypto1State *pcs, uint32_t uid, \
57 uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested);
58 int mifare_classic_authex(struct Crypto1State *pcs, uint32_t uid, \
59 uint8_t blockNo, uint8_t keyType, uint64_t ui64Key, uint64_t isNested, uint32_t * ntptr);
60 int mifare_classic_readblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t *blockData);
61 int mifare_classic_writeblock(struct Crypto1State *pcs, uint32_t uid, uint8_t blockNo, uint8_t *blockData);
62 int mifare_classic_halt(struct Crypto1State *pcs, uint32_t uid);
63
64 #endif
Impressum, Datenschutz