]> git.zerfleddert.de Git - proxmark3-svn/blame - client/mifarehost.h
FIX: lf hitag : Mea culpa, simulation should not have reader_field on. thanks to...
[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
2d3f8e5f 10#ifndef __MIFARE_HOST_H\r
11#define __MIFARE_HOST_H\r
f397b5cc
M
12\r
13#include <stdio.h>\r
14#include <stdlib.h>\r
15#include <unistd.h>\r
af4308b9 16#include <string.h>\r
17#include <pthread.h>\r
b403c300 18\r
19#include "proxmark3.h" // time_t\r
f397b5cc
M
20#include "common.h"\r
21#include "cmdmain.h"\r
22#include "ui.h"\r
23#include "data.h"\r
f397b5cc 24#include "util.h"\r
f397b5cc 25#include "nonce2key/crapto1.h"\r
8b6a93df 26#include "iso14443crc.h"\r
c2731f37 27#include "protocols.h"\r
f397b5cc 28\r
f397b5cc
M
29#define NESTED_SECTOR_RETRY 10\r
30\r
55acbb2a 31// mifare tracer flags\r
c2731f37 32#define TRACE_IDLE 0x00\r
33#define TRACE_AUTH1 0x01\r
34#define TRACE_AUTH2 0x02\r
35#define TRACE_AUTH_OK 0x03\r
36#define TRACE_READ_DATA 0x04\r
37#define TRACE_WRITE_OK 0x05\r
38#define TRACE_WRITE_DATA 0x06\r
c2731f37 39#define TRACE_ERROR 0xFF\r
55acbb2a 40\r
af4308b9 41typedef struct {\r
42 union {\r
43 struct Crypto1State *slhead;\r
44 uint64_t *keyhead;\r
45 } head;\r
46 union {\r
47 struct Crypto1State *sltail;\r
48 uint64_t *keytail;\r
49 } tail;\r
50 uint32_t len;\r
51 uint32_t uid;\r
52 uint32_t blockNo;\r
53 uint32_t keyType;\r
54 uint32_t nt;\r
55 uint32_t ks1;\r
56} StateList_t;\r
57 \r
f397b5cc
M
58typedef struct {\r
59 uint64_t Key[2];\r
60 int foundKey[2];\r
57778a46 61} sector_t;\r
f397b5cc 62 \r
af4308b9 63extern int compar_int(const void * a, const void * b);\r
e4691591 64extern char logHexFileName[FILE_PATH_SIZE];\r
55acbb2a 65\r
9492e0b0 66int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * ResultKeys, bool calibrate);\r
b10a759f 67int mfCheckKeys (uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key);\r
d9ed4e19 68int mfKeyBrute(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint64_t *resultkey);\r
e0c635d1 69\r
8556b852
M
70int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);\r
71int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);\r
0de8e387 72int mfEmlSetMem_xt(uint8_t *data, int blockNum, int blocksCount, int blockBtWidth);\r
e0c635d1 73\r
c2731f37 74int mfCSetUID(uint8_t *uid, uint8_t *atqa, uint8_t *sak, uint8_t *oldUID, uint8_t wipecard);\r
75int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, uint8_t params);\r
545a1f38 76int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params);\r
e0c635d1 77\r
6c84c900 78int mfTraceInit(uint8_t *tuid, uint8_t uidlen, uint8_t *atqa, uint8_t sak, bool wantSaveToEmlFile);\r
6a1f2d82 79int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile);\r
e0c635d1
M
80\r
81int isTraceCardEmpty(void);\r
82int isBlockEmpty(int blockN);\r
83int isBlockTrailer(int blockN);\r
6c84c900 84int loadTraceCard(uint8_t *tuid, uint8_t uidlen);\r
e0c635d1 85int saveTraceCard(void);\r
e98572a1 86int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data, int len);\r
2d3f8e5f 87#endif
Impressum, Datenschutz