]>
Commit | Line | Data |
---|---|---|
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 | |
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 | |
22 | \r | |
23 | #define MEM_CHUNK 1000000\r | |
24 | #define NESTED_SECTOR_RETRY 10\r | |
25 | \r | |
26 | // mfCSetBlock work flags\r | |
27 | #define CSETBLOCK_UID 0x01\r | |
28 | #define CSETBLOCK_WUPC 0x02\r | |
29 | #define CSETBLOCK_HALT 0x04\r | |
30 | #define CSETBLOCK_INIT_FIELD 0x08\r | |
31 | #define CSETBLOCK_RESET_FIELD 0x10\r | |
32 | #define CSETBLOCK_SINGLE_OPER 0x1F\r | |
33 | \r | |
34 | typedef struct fnVector { uint8_t blockNo, keyType; uint32_t uid, nt, ks1; } fnVector;\r | |
35 | \r | |
36 | typedef struct {\r | |
37 | uint64_t Key[2];\r | |
38 | int foundKey[2];\r | |
39 | } sector;\r | |
40 | \r | |
41 | typedef struct {\r | |
42 | uint64_t *possibleKeys;\r | |
43 | uint32_t size;\r | |
44 | } pKeys;\r | |
45 | \r | |
46 | typedef struct {\r | |
47 | uint64_t key;\r | |
48 | int count;\r | |
49 | } countKeys;\r | |
50 | \r | |
51 | int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo, uint8_t trgKeyType, uint8_t * ResultKeys);\r | |
52 | int mfCheckKeys (uint8_t blockNo, uint8_t keyType, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key);\r | |
53 | int mfEmlGetMem(uint8_t *data, int blockNum, int blocksCount);\r | |
54 | int mfEmlSetMem(uint8_t *data, int blockNum, int blocksCount);\r | |
55 | int mfCSetUID(uint8_t *uid, uint8_t *oldUID, int wantWipe);\r | |
56 | int mfCSetBlock(uint8_t blockNo, uint8_t *data, uint8_t *uid, int wantWipe, uint8_t params);\r | |
57 | int mfCGetBlock(uint8_t blockNo, uint8_t *data, uint8_t params);\r |