]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/mifarehost.h
added 'hitag2.ht2' binary example image for emulation
[proxmark3-svn] / client / mifarehost.h
CommitLineData
f397b5cc
M
1// Merlok, 2011\r
2// people from mifare@nethemba.com, 2010\r
3//\r
4// This code is licensed to you under the terms of the GNU GPL, version 2 or,\r
5// at your option, any later version. See the LICENSE.txt file for the text of\r
6// the license.\r
7//-----------------------------------------------------------------------------\r
8// High frequency ISO14443A commands\r
9//-----------------------------------------------------------------------------\r
10\r
11#include <stdio.h>\r
12#include <stdlib.h>\r
13#include <unistd.h>\r
f397b5cc
M
14#include "common.h"\r
15#include "cmdmain.h"\r
16#include "ui.h"\r
17#include "data.h"\r
18#include "proxusb.h"\r
19#include "util.h"\r
20#include "nonce2key/nonce2key.h"\r
21#include "nonce2key/crapto1.h"\r
8b6a93df 22#include "iso14443crc.h"\r
f397b5cc
M
23\r
24#define MEM_CHUNK 1000000\r
25#define NESTED_SECTOR_RETRY 10\r
26\r
208a0166
M
27// mfCSetBlock work flags\r
28#define CSETBLOCK_UID 0x01\r
29#define CSETBLOCK_WUPC 0x02\r
30#define CSETBLOCK_HALT 0x04\r
31#define CSETBLOCK_INIT_FIELD 0x08\r
32#define CSETBLOCK_RESET_FIELD 0x10\r
33#define CSETBLOCK_SINGLE_OPER 0x1F\r
34\r
55acbb2a
M
35// mifare tracer flags\r
36#define TRACE_IDLE 0x00\r
37#define TRACE_AUTH1 0x01\r
38#define TRACE_AUTH2 0x02\r
39#define TRACE_AUTH_OK 0x03\r
40#define TRACE_READ_DATA 0x04\r
41#define TRACE_WRITE_OK 0x05\r
42#define TRACE_WRITE_DATA 0x06\r
43\r
44#define TRACE_ERROR 0xFF\r
45\r
f397b5cc
M
46typedef struct fnVector { uint8_t blockNo, keyType; uint32_t uid, nt, ks1; } fnVector;\r
47\r
48typedef struct {\r
49 uint64_t Key[2];\r
50 int foundKey[2];\r
51} sector;\r
52 \r
53typedef struct {\r
54 uint64_t *possibleKeys;\r
55 uint32_t size;\r
56} pKeys;\r
57\r
58typedef struct {\r
59 uint64_t key;\r
60 int count;\r
61} countKeys;\r
62\r
55acbb2a
M
63extern char logHexFileName[200];\r
64\r
f397b5cc
M
65int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * ResultKeys);\r
66int mfCheckKeys (uint8_t blockNo, uint8_t keyType, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key);\r
e0c635d1 67\r
8556b852
M
68int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);\r
69int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);\r
e0c635d1 70\r
0675f200 71int mfCSetUID(uint8_t *uid, uint8_t *oldUID, int wantWipe);\r
208a0166 72int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, int wantWipe, uint8_t params);\r
545a1f38 73int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params);\r
e0c635d1
M
74\r
75int mfTraceInit(uint8_t *tuid, uint8_t *atqa, uint8_t sak, bool wantSaveToEmlFile);\r
71d90e54 76int mfTraceDecode(uint8_t *data_src, int len, uint32_t parity, bool wantSaveToEmlFile);\r
e0c635d1
M
77\r
78int isTraceCardEmpty(void);\r
79int isBlockEmpty(int blockN);\r
80int isBlockTrailer(int blockN);\r
81int loadTraceCard(uint8_t *tuid);\r
82int saveTraceCard(void);\r
Impressum, Datenschutz