blob: 03dbad3207f73bb89e067f8a69fd01915f99a0e8 [file] [log] [blame]
Harald Welted54c2ee2012-01-17 18:25:50 +01001#include <osmocom/sim/sim.h>
2#include <osmocom/gsm/tlv.h>
3
4/* TS 102 221 V10.0.0 / 10.2.1 */
5const struct osim_card_sw ts102221_uicc_sw[] = {
6 {
7 0x9000, 0xffff, SW_TYPE_STR, SW_CLS_OK,
8 .u.str = "Normal ending of the command",
9 }, {
10 0x9100, 0xff00, SW_TYPE_STR, SW_CLS_OK,
11 .u.str = "Normal ending of the command, extra info proactive",
12 }, {
13 0x9200, 0xff00, SW_TYPE_STR, SW_CLS_OK,
14 .u.str = "Normal ending of the command, extra info regarding transfer session",
15 }, {
16 0x9300, 0xff00, SW_TYPE_STR, SW_CLS_POSTP,
17 .u.str = "SIM Application Toolkit is busy, command cannot be executed at present",
18 }, {
19 0x6200, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
20 .u.str = "No information given, state of non volatile memory unchanged",
21 }, {
22 0x6281, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
23 .u.str = "Part of returned data may be corrupted",
24 }, {
25 0x6282, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
26 .u.str = "End of file/record reached before reading Le bytes",
27 }, {
28 0x6283, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
29 .u.str = "Selected file invalidated",
30 }, {
31 0x6285, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
32 .u.str = "Selected file in termination state",
33 }, {
34 0x62f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
35 .u.str = "More data available",
36 }, {
37 0x62f2, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
38 .u.str = "More data available and proactive command pending",
39 }, {
40 0x62f3, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
41 .u.str = "Response data available",
42 }, {
43 0x63f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
44 .u.str = "More data expected",
45 }, {
46 0x63c0, 0xfff0, SW_TYPE_STR, SW_CLS_WARN,
47 .u.str = "Verification falied, X retries remaining",
48 }, {
49 0x6400, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
50 .u.str = "Execution - No information given, state of non-volatile memory unchanged",
51 }, {
52 0x6500, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
53 .u.str = "Execution - No information given, state of non-volatile memory changed",
54 }, {
55 0x6581, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
56 .u.str = "Execution - Memory problem",
57 }, {
58 0x6700, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
59 .u.str = "Checking - Wrong length",
60 }, {
61 0x6700, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
62 .u.str = "Checking - Command dependent error",
63 }, {
64 0x6b00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
65 .u.str = "Checking - Wrong parameter(s) P1-P2",
66 }, {
67 0x6d00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
68 .u.str = "Checking - Instruction code not supported or valid",
69 }, {
70 0x6e00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
71 .u.str = "Checking - Class not supported",
72 }, {
73 0x6f00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
74 .u.str = "Checking - Technical problem, no precise diagnostics",
75 }, {
76 0x6f00, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
77 .u.str = "Checking - Command dependent error",
78 }, {
79 0x6800, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
80 .u.str = "Function in CLA not supported - No information given",
81 }, {
82 0x6881, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
83 .u.str = "Function in CLA not supported - Logical channel not supported",
84 }, {
85 0x6882, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
86 .u.str = "Function in CLA not supportied - Secure messaging not supported",
87 }, {
88 0x6900, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
89 .u.str = "Command not allowed - No information given",
90 }, {
91 0x6981, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
92 .u.str = "Command not allowed - Command incompatible with file structure",
93 }, {
94 0x6982, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
95 .u.str = "Command not allowed - Security status not satisfied",
96 }, {
97 0x6983, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
98 .u.str = "Command not allowed - Authentication/PIN method blocked",
99 }, {
100 0x6984, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
101 .u.str = "Command not allowed - Referenced data invalidated",
102 }, {
103 0x6985, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
104 .u.str = "Command not allowed - Conditions of use not satisfied",
105 }, {
106 0x6986, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
107 .u.str = "Command not allowed - Noe EF selected",
108 }, {
109 0x6989, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
110 .u.str = "Command not allowed - secure channel - security not satisfied",
111 }, {
112 0x6a80, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
113 .u.str = "Wrong parameters - Incorrect parameters in the data field",
114 }, {
115 0x6a81, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
116 .u.str = "Wrong parameters - Function not supported",
117 }, {
118 0x6a82, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
119 .u.str = "Wrong parameters - File not found",
120 }, {
121 0x6a83, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
122 .u.str = "Wrong parameters - Record not found",
123 }, {
124 0x6a84, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
125 .u.str = "Wrong parameters - Not enough memory space",
126 }, {
127 0x6a86, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
128 .u.str = "Wrong parameters - Incorrect parameters P1 to P2",
129 }, {
130 0x6a87, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
131 .u.str = "Wrong parameters - Lc inconsistent with P1 ot P2",
132 }, {
133 0x6a88, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
134 .u.str = "Wrong parameters - Referenced data not found",
135 }, {
136 0x9850, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
137 .u.str = "Application error - INCREASE cannot be performed, max value reached",
138 }, {
139 0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
140 .u.str = "Application error - Authentication error, application specific",
141 }, {
142 0x9863, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
143 .u.str = "Application error - Security session or association expired",
144 },
145 OSIM_CARD_SW_LAST
146};
147
148const struct value_string ts102221_fcp_vals[14] = {
149 { UICC_FCP_T_FCP, "File control parameters" },
150 { UICC_FCP_T_FILE_SIZE, "File size" },
151 { UICC_FCP_T_TOT_F_SIZE, "Total size of files" },
152 { UICC_FCP_T_FILE_DESC, "File descriptor" },
153 { UICC_FCP_T_FILE_ID, "File identifier" },
154 { UICC_FCP_T_DF_NAME, "DF name" },
155 { UICC_FCP_T_SFID, "Short file identifier" },
156 { UICC_FCP_T_LIFEC_STS, "Lifecycle status integer" },
157 { UICC_FCP_T_SEC_ATTR_REFEXP, "Security attributes (Referenced/Expanded)" },
158 { UICC_FCP_T_SEC_ATTR_COMP, "Security attributes (Compact)" },
159 { UICC_FCP_T_PROPRIETARY, "Proprietary" },
160 { UICC_FCP_T_SEC_ATTR_EXP, "Security attributes (Expanded)" },
161 { UICC_FCP_T_PIN_STS_DO, "PIN Status DO" },
162 { 0, NULL }
163};
164
165/* FIXME: Ber-TLV ?? */
166const struct tlv_definition ts102221_fcp_tlv_def = {
167 .def = {
168 [UICC_FCP_T_FCP] = { TLV_TYPE_TLV },
169 [UICC_FCP_T_FILE_SIZE] = { TLV_TYPE_TLV },
170 [UICC_FCP_T_TOT_F_SIZE] = { TLV_TYPE_TLV },
171 [UICC_FCP_T_FILE_DESC] = { TLV_TYPE_TLV },
172 [UICC_FCP_T_FILE_ID] = { TLV_TYPE_TLV },
173 [UICC_FCP_T_DF_NAME] = { TLV_TYPE_TLV },
174 [UICC_FCP_T_SFID] = { TLV_TYPE_TLV },
175 [UICC_FCP_T_LIFEC_STS] = { TLV_TYPE_TLV },
176 [UICC_FCP_T_SEC_ATTR_REFEXP] = { TLV_TYPE_TLV },
177 [UICC_FCP_T_SEC_ATTR_COMP] = { TLV_TYPE_TLV },
178 [UICC_FCP_T_PROPRIETARY] = { TLV_TYPE_TLV },
179 [UICC_FCP_T_SEC_ATTR_EXP] = { TLV_TYPE_TLV },
180 [UICC_FCP_T_PIN_STS_DO] = { TLV_TYPE_TLV },
181 },
182};
183
184/* Annex E - TS 101 220 */
185static const uint8_t adf_uicc_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x01 };