]>
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 | ||
16 | //----------------------------------------------------------------------------- | |
17 | // ISO 14443A | |
18 | //----------------------------------------------------------------------------- | |
19 | typedef struct { | |
20 | byte_t uid[10]; | |
21 | byte_t uidlen; | |
22 | byte_t atqa[2]; | |
23 | byte_t sak; | |
24 | byte_t ats_len; | |
25 | byte_t ats[256]; | |
26 | } __attribute__((__packed__)) iso14a_card_select_t; | |
27 | ||
28 | typedef enum ISO14A_COMMAND { | |
48ece4a7 | 29 | ISO14A_CONNECT = (1 << 0), |
30 | ISO14A_NO_DISCONNECT = (1 << 1), | |
31 | ISO14A_APDU = (1 << 2), | |
32 | ISO14A_RAW = (1 << 3), | |
33 | ISO14A_REQUEST_TRIGGER = (1 << 4), | |
34 | ISO14A_APPEND_CRC = (1 << 5), | |
35 | ISO14A_SET_TIMEOUT = (1 << 6), | |
36 | ISO14A_NO_SELECT = (1 << 7), | |
c04a4b60 | 37 | ISO14A_TOPAZMODE = (1 << 8), |
38 | ISO14A_NO_RATS = (1 << 9) | |
ecab772e | 39 | } iso14a_command_t; |
40 | ||
4efdfbe6 | 41 | typedef struct { |
42 | uint32_t cuid; | |
43 | uint8_t sector; | |
44 | uint8_t keytype; | |
45 | uint32_t nonce; | |
46 | uint32_t ar; | |
47 | uint32_t nr; | |
48 | uint32_t at; | |
49 | uint32_t nonce2; | |
50 | uint32_t ar2; | |
51 | uint32_t nr2; | |
52 | } nonces_t; | |
53 | ||
ecab772e | 54 | #endif // _MIFARE_H_ |