]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - armsrc/mifareutil.h
4433fe65a952f3133dc571aff747b09f0495b6f7
1 //-----------------------------------------------------------------------------
3 // Many authors, that makes it possible
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
8 //-----------------------------------------------------------------------------
9 // code for work with mifare cards.
10 //-----------------------------------------------------------------------------
12 #ifndef __MIFAREUTIL_H
13 #define __MIFAREUTIL_H
15 // mifare authentication
18 #define CRYPT_REQUEST 2
22 // reader voltage field detector
23 #define MF_MINFIELDV 4000
26 // 0 - no debug messages 1 - error messages 2 - all messages 4 - extended debug mode
28 #define MF_DBG_ERROR 1
30 #define MF_DBG_EXTENDED 4
32 extern int MF_DBGLEVEL
;
35 #define MEM_CHUNK 10000
37 #define NS_TOLERANCE 10 // [distance avg-value, distance avg+value]
38 #define NS_RETRIES_GETNONCE 15
39 #define NES_MAX_INFO 5
41 //mifare emulator states
42 #define MFEMUL_NOFIELD 0
44 #define MFEMUL_SELECT1 2
45 #define MFEMUL_SELECT2 3
46 #define MFEMUL_AUTH1 4
47 #define MFEMUL_AUTH2 5
49 #define MFEMUL_HALTED 7
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
);
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
);