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