fix hf iclass config - now uses a default config card data if no config card present...
[RRG-proxmark3.git] / include / iso18.h
blob27f8078a0d05d5292f7e43a99ce576aad31e6619
1 //-----------------------------------------------------------------------------
2 // (c) 2020 Iceman
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 // ISO 18002 / FeliCa type prototyping
9 //-----------------------------------------------------------------------------
10 #ifndef _ISO18_H_
11 #define _ISO18_H_
13 #include "common.h"
15 typedef enum FELICA_COMMAND {
16 FELICA_CONNECT = (1 << 0),
17 FELICA_NO_DISCONNECT = (1 << 1),
18 FELICA_RAW = (1 << 3),
19 FELICA_APPEND_CRC = (1 << 5),
20 FELICA_NO_SELECT = (1 << 6),
21 } felica_command_t;
23 //-----------------------------------------------------------------------------
24 // FeliCa
25 //-----------------------------------------------------------------------------
26 // IDm = ID manufacturer
27 // mc = manufactureCode
28 // mc1 mc2 u1 u2 u3 u4 u5 u6
29 // PMm = Product manufacturer
30 // icCode =
31 // ic1 = ROM
32 // ic2 = IC
33 // maximum response time =
34 // B3(request service)
35 // B4(request response)
36 // B5(authenticate)
37 // B6(read)
38 // B7(write)
39 // B8()
41 // ServiceCode 2bytes (access-rights)
42 // FileSystem = 1 Block = 16 bytes
45 typedef struct {
46 uint8_t IDm[8];
47 uint8_t code[2];
48 uint8_t uid[6];
49 uint8_t PMm[8];
50 uint8_t iccode[2];
51 uint8_t mrt[6];
52 uint8_t servicecode[2];
53 } PACKED felica_card_select_t;
55 typedef struct {
56 uint8_t sync[2];
57 uint8_t length[1];
58 uint8_t cmd_code[1];
59 uint8_t IDm[8];
60 } PACKED felica_frame_response_t;
62 typedef struct {
63 uint8_t status_flag1[1];
64 uint8_t status_flag2[1];
65 } PACKED felica_status_flags_t;
67 typedef struct {
68 felica_frame_response_t frame_response;
69 uint8_t node_number[1];
70 uint8_t node_key_versions[2];
71 } PACKED felica_request_service_response_t;
73 typedef struct {
74 felica_frame_response_t frame_response;
75 uint8_t mode[1];
76 } PACKED felica_request_request_response_t;
78 typedef struct {
79 felica_frame_response_t frame_response;
80 felica_status_flags_t status_flags;
81 uint8_t number_of_block[1];
82 uint8_t block_data[16];
83 uint8_t block_element_number[1];
84 } PACKED felica_read_without_encryption_response_t;
86 typedef struct {
87 felica_frame_response_t frame_response;
88 felica_status_flags_t status_flags;
89 } PACKED felica_status_response_t;
91 typedef struct {
92 felica_frame_response_t frame_response;
93 uint8_t number_of_systems[1];
94 uint8_t system_code_list[32];
95 } PACKED felica_syscode_response_t;
97 typedef struct {
98 felica_frame_response_t frame_response;
99 felica_status_flags_t status_flags;
100 uint8_t format_version[1];
101 uint8_t basic_version[2];
102 uint8_t number_of_option[1];
103 uint8_t option_version_list[4];
104 } PACKED felica_request_spec_response_t;
106 typedef struct {
107 felica_frame_response_t frame_response;
108 uint8_t m2c[8];
109 uint8_t m3c[8];
110 } PACKED felica_auth1_response_t;
112 typedef struct {
113 uint8_t code[1];
114 uint8_t IDtc[8];
115 uint8_t IDi[8];
116 uint8_t PMi[8];
117 } PACKED felica_auth2_response_t;
119 #endif // _ISO18_H_