]>
cvs.zerfleddert.de Git - proxmark3-svn/blob - client/mifarehost.h
2 // people from mifare@nethemba.com, 2010
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
8 // High frequency ISO14443A commands
9 //-----------------------------------------------------------------------------
19 #include "nonce2key/nonce2key.h"
20 #include "nonce2key/crapto1.h"
21 #include "iso14443crc.h"
22 #include "protocols.h"
24 #define MEM_CHUNK 1000000
25 #define NESTED_SECTOR_RETRY 10
27 // mifare tracer flags
28 #define TRACE_IDLE 0x00
29 #define TRACE_AUTH1 0x01
30 #define TRACE_AUTH2 0x02
31 #define TRACE_AUTH_OK 0x03
32 #define TRACE_READ_DATA 0x04
33 #define TRACE_WRITE_OK 0x05
34 #define TRACE_WRITE_DATA 0x06
36 #define TRACE_ERROR 0xFF
43 int compar_int(const void * a
, const void * b
);
44 extern char logHexFileName
[FILE_PATH_SIZE
];
46 int mfnested(uint8_t blockNo
, uint8_t keyType
, uint8_t * key
, uint8_t trgBlockNo
, uint8_t trgKeyType
, uint8_t * ResultKeys
, bool calibrate
);
47 int mfCheckKeys (uint8_t blockNo
, uint8_t keyType
, bool clear_trace
, uint8_t keycnt
, uint8_t * keyBlock
, uint64_t * key
);
49 int mfEmlGetMem(uint8_t *data
, int blockNum
, int blocksCount
);
50 int mfEmlSetMem(uint8_t *data
, int blockNum
, int blocksCount
);
51 int mfEmlSetMem_xt(uint8_t *data
, int blockNum
, int blocksCount
, int blockBtWidth
);
53 int mfCSetUID(uint8_t *uid
, uint8_t *atqa
, uint8_t *sak
, uint8_t *oldUID
, uint8_t wipecard
);
54 int mfCSetBlock(uint8_t blockNo
, uint8_t *data
, uint8_t *uid
, uint8_t params
);
55 int mfCGetBlock(uint8_t blockNo
, uint8_t *data
, uint8_t params
);
57 int mfTraceInit(uint8_t *tuid
, uint8_t uidlen
, uint8_t *atqa
, uint8_t sak
, bool wantSaveToEmlFile
);
58 int mfTraceDecode(uint8_t *data_src
, int len
, bool wantSaveToEmlFile
);
60 int isTraceCardEmpty(void);
61 int isBlockEmpty(int blockN
);
62 int isBlockTrailer(int blockN
);
63 int loadTraceCard(uint8_t *tuid
, uint8_t uidlen
);
64 int saveTraceCard(void);
65 int tryDecryptWord(uint32_t nt
, uint32_t ar_enc
, uint32_t at_enc
, uint8_t *data
, int len
);