]>
Commit | Line | Data |
---|---|---|
ecab772e | 1 | //----------------------------------------------------------------------------- |
2 | // (c) 2012 Roel Verdult | |
3 | // | |
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 | |
6 | // the license. | |
7 | //----------------------------------------------------------------------------- | |
8 | // MIFARE type prototyping | |
9 | //----------------------------------------------------------------------------- | |
10 | ||
11 | #ifndef _MIFARE_H_ | |
12 | #define _MIFARE_H_ | |
13 | ||
14 | #include "common.h" | |
15 | ||
fdd9395d OM |
16 | #define MF_KEY_A 0 |
17 | #define MF_KEY_B 1 | |
18 | ||
19 | #define MF_MAD1_SECTOR 0x00 | |
20 | #define MF_MAD2_SECTOR 0x10 | |
21 | ||
aa8ff592 | 22 | // Fixed encrypted nonce used for nested attack with fixed nonce tags |
23 | #define NESTED_FIXED_NR_ENC {0x70, 0x69, 0x77, 0x69} | |
24 | ||
ecab772e | 25 | //----------------------------------------------------------------------------- |
26 | // ISO 14443A | |
27 | //----------------------------------------------------------------------------- | |
28 | typedef struct { | |
29 | byte_t uid[10]; | |
30 | byte_t uidlen; | |
31 | byte_t atqa[2]; | |
32 | byte_t sak; | |
33 | byte_t ats_len; | |
34 | byte_t ats[256]; | |
35 | } __attribute__((__packed__)) iso14a_card_select_t; | |
36 | ||
37 | typedef enum ISO14A_COMMAND { | |
48ece4a7 | 38 | ISO14A_CONNECT = (1 << 0), |
39 | ISO14A_NO_DISCONNECT = (1 << 1), | |
40 | ISO14A_APDU = (1 << 2), | |
41 | ISO14A_RAW = (1 << 3), | |
42 | ISO14A_REQUEST_TRIGGER = (1 << 4), | |
43 | ISO14A_APPEND_CRC = (1 << 5), | |
44 | ISO14A_SET_TIMEOUT = (1 << 6), | |
45 | ISO14A_NO_SELECT = (1 << 7), | |
c04a4b60 | 46 | ISO14A_TOPAZMODE = (1 << 8), |
eb6e8de4 | 47 | ISO14A_NO_RATS = (1 << 9), |
189b8177 | 48 | ISO14A_SEND_CHAINING = (1 << 10), |
49 | ISO14A_CLEAR_TRACE = (1 << 11) | |
ecab772e | 50 | } iso14a_command_t; |
51 | ||
4efdfbe6 | 52 | typedef struct { |
53 | uint32_t cuid; | |
54 | uint8_t sector; | |
55 | uint8_t keytype; | |
56 | uint32_t nonce; | |
57 | uint32_t ar; | |
58 | uint32_t nr; | |
59 | uint32_t at; | |
60 | uint32_t nonce2; | |
61 | uint32_t ar2; | |
62 | uint32_t nr2; | |
63 | } nonces_t; | |
64 | ||
ecab772e | 65 | #endif // _MIFARE_H_ |