1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // MIFARE type prototyping
17 //-----------------------------------------------------------------------------
27 #define MF_MAD1_SECTOR 0x00
28 #define MF_MAD2_SECTOR 0x10
30 //-----------------------------------------------------------------------------
31 // Common types, used by client and ARM
32 //-----------------------------------------------------------------------------
33 // New Ultralight/NTAG dump file format
34 // Length must be aligned to 4 bytes (UL/NTAG page)
35 #define MFU_DUMP_PREFIX_LENGTH 56
41 uint8_t pages
; // max page number in dump
42 uint8_t signature
[32];
43 uint8_t counter_tearing
[3][4]; // 3 bytes counter, 1 byte tearing flag
47 //-----------------------------------------------------------------------------
49 //-----------------------------------------------------------------------------
57 } PACKED iso14a_card_select_t
;
66 uint8_t signature
[32];
67 } PACKED iso14a_card_select_ev1_t
;
70 iso14a_card_select_t card_info
;
73 } iso14a_mf_extdump_t
;
77 iso14a_card_select_t mfc
;
78 iso14a_card_select_ev1_t ev1
;
82 } iso14a_mf_dump_ev1_t
;
85 typedef enum ISO14A_COMMAND
{
86 ISO14A_CONNECT
= (1 << 0),
87 ISO14A_NO_DISCONNECT
= (1 << 1),
88 ISO14A_APDU
= (1 << 2),
89 ISO14A_RAW
= (1 << 3),
90 ISO14A_REQUEST_TRIGGER
= (1 << 4),
91 ISO14A_APPEND_CRC
= (1 << 5),
92 ISO14A_SET_TIMEOUT
= (1 << 6),
93 ISO14A_NO_SELECT
= (1 << 7),
94 ISO14A_TOPAZMODE
= (1 << 8),
95 ISO14A_NO_RATS
= (1 << 9),
96 ISO14A_SEND_CHAINING
= (1 << 10),
97 ISO14A_USE_ECP
= (1 << 11),
98 ISO14A_USE_MAGSAFE
= (1 << 12),
99 ISO14A_USE_CUSTOM_POLLING
= (1 << 13)
102 // Defines a frame that will be used in a polling sequence
103 // ECP Frames are up to (7 + 16) bytes long, 24 bytes should cover future and other cases
106 uint8_t frame_length
;
107 uint8_t last_byte_bits
;
108 uint16_t extra_delay
;
109 } PACKED iso14a_polling_frame_t
;
111 // Defines polling sequence configuration
112 // 6 would be enough for 4 magsafe, 1 wupa, 1 ecp,
114 iso14a_polling_frame_t frames
[6];
116 uint16_t extra_timeout
;
117 } PACKED iso14a_polling_parameters_t
;
123 uint16_t modulation_n
;
124 uint32_t ProxToAirDuration
;
125 uint8_t par
; // enough for precalculated parity of 8 Byte responses
126 } PACKED tag_response_info_t
;
128 // DESFIRE_RAW flag enums
129 typedef enum DESFIRE_COMMAND
{
142 } mifare_des_authmode_t
;
147 MFDES_ALGO_3K3DES
= 3,
149 } mifare_des_authalgo_t
;
152 MFDES_KDF_ALGO_NONE
= 0,
153 MFDES_KDF_ALGO_AN10922
= 1,
154 MFDES_KDF_ALGO_GALLAGHER
= 2,
155 } mifare_des_kdf_algo_t
;
157 //-----------------------------------------------------------------------------
158 // "hf 14a sim -x", "hf mf sim -x" attacks
159 //-----------------------------------------------------------------------------