1 //-----------------------------------------------------------------------------
2 // (c) 2012 Roel Verdult
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 // MIFARE type prototyping
9 //-----------------------------------------------------------------------------
19 #define MF_MAD1_SECTOR 0x00
20 #define MF_MAD2_SECTOR 0x10
22 //-----------------------------------------------------------------------------
23 // Common types, used by client and ARM
24 //-----------------------------------------------------------------------------
25 // New Ultralight/NTAG dump file format
26 // Length must be aligned to 4 bytes (UL/NTAG page)
27 #define MFU_DUMP_PREFIX_LENGTH 56
33 uint8_t pages
; // max page number in dump
34 uint8_t signature
[32];
35 uint8_t counter_tearing
[3][4]; // 3 bytes counter, 1 byte tearing flag
39 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
49 } PACKED iso14a_card_select_t
;
51 typedef enum ISO14A_COMMAND
{
52 ISO14A_CONNECT
= (1 << 0),
53 ISO14A_NO_DISCONNECT
= (1 << 1),
54 ISO14A_APDU
= (1 << 2),
55 ISO14A_RAW
= (1 << 3),
56 ISO14A_REQUEST_TRIGGER
= (1 << 4),
57 ISO14A_APPEND_CRC
= (1 << 5),
58 ISO14A_SET_TIMEOUT
= (1 << 6),
59 ISO14A_NO_SELECT
= (1 << 7),
60 ISO14A_TOPAZMODE
= (1 << 8),
61 ISO14A_NO_RATS
= (1 << 9),
62 ISO14A_SEND_CHAINING
= (1 << 10)
69 uint16_t modulation_n
;
70 uint32_t ProxToAirDuration
;
71 uint8_t par
; // enough for precalculated parity of 8 Byte responses
72 } PACKED tag_response_info_t
;
74 // DESFIRE_RAW flag enums
75 typedef enum DESFIRE_COMMAND
{
88 } mifare_des_authmode_t
;
93 MFDES_ALGO_3K3DES
= 3,
95 } mifare_des_authalgo_t
;
98 MFDES_KDF_ALGO_NONE
= 0,
99 MFDES_KDF_ALGO_AN10922
= 1,
100 MFDES_KDF_ALGO_GALLAGHER
= 2,
101 } mifare_des_kdf_algo_t
;
103 //-----------------------------------------------------------------------------
104 // "hf 14a sim -x", "hf mf sim -x" attacks
105 //-----------------------------------------------------------------------------