blob: 27afe34aa4b6a5c8f5cf3ea41f20c0e4cc1d0d05 [file] [log] [blame]
Harald Weltead418632012-09-10 10:49:59 +02001/* ETSI UICC specific structures / routines */
2/*
3 * (C) 2012 by Harald Welte <laforge@gnumonks.org>
4 *
5 * All Rights Reserved
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23
Harald Welted54c2ee2012-01-17 18:25:50 +010024#include <osmocom/sim/sim.h>
25#include <osmocom/gsm/tlv.h>
26
27/* TS 102 221 V10.0.0 / 10.2.1 */
28const struct osim_card_sw ts102221_uicc_sw[] = {
29 {
30 0x9000, 0xffff, SW_TYPE_STR, SW_CLS_OK,
31 .u.str = "Normal ending of the command",
32 }, {
33 0x9100, 0xff00, SW_TYPE_STR, SW_CLS_OK,
34 .u.str = "Normal ending of the command, extra info proactive",
35 }, {
36 0x9200, 0xff00, SW_TYPE_STR, SW_CLS_OK,
37 .u.str = "Normal ending of the command, extra info regarding transfer session",
38 }, {
39 0x9300, 0xff00, SW_TYPE_STR, SW_CLS_POSTP,
40 .u.str = "SIM Application Toolkit is busy, command cannot be executed at present",
41 }, {
42 0x6200, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
43 .u.str = "No information given, state of non volatile memory unchanged",
44 }, {
45 0x6281, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
46 .u.str = "Part of returned data may be corrupted",
47 }, {
48 0x6282, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
49 .u.str = "End of file/record reached before reading Le bytes",
50 }, {
51 0x6283, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
52 .u.str = "Selected file invalidated",
53 }, {
54 0x6285, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
55 .u.str = "Selected file in termination state",
56 }, {
57 0x62f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
58 .u.str = "More data available",
59 }, {
60 0x62f2, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
61 .u.str = "More data available and proactive command pending",
62 }, {
63 0x62f3, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
64 .u.str = "Response data available",
65 }, {
66 0x63f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
67 .u.str = "More data expected",
68 }, {
69 0x63c0, 0xfff0, SW_TYPE_STR, SW_CLS_WARN,
70 .u.str = "Verification falied, X retries remaining",
71 }, {
72 0x6400, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
73 .u.str = "Execution - No information given, state of non-volatile memory unchanged",
74 }, {
75 0x6500, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
76 .u.str = "Execution - No information given, state of non-volatile memory changed",
77 }, {
78 0x6581, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
79 .u.str = "Execution - Memory problem",
80 }, {
81 0x6700, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
82 .u.str = "Checking - Wrong length",
83 }, {
84 0x6700, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
85 .u.str = "Checking - Command dependent error",
86 }, {
87 0x6b00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
88 .u.str = "Checking - Wrong parameter(s) P1-P2",
89 }, {
90 0x6d00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
91 .u.str = "Checking - Instruction code not supported or valid",
92 }, {
93 0x6e00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
94 .u.str = "Checking - Class not supported",
95 }, {
96 0x6f00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
97 .u.str = "Checking - Technical problem, no precise diagnostics",
98 }, {
99 0x6f00, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
100 .u.str = "Checking - Command dependent error",
101 }, {
102 0x6800, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
103 .u.str = "Function in CLA not supported - No information given",
104 }, {
105 0x6881, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
106 .u.str = "Function in CLA not supported - Logical channel not supported",
107 }, {
108 0x6882, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
109 .u.str = "Function in CLA not supportied - Secure messaging not supported",
110 }, {
111 0x6900, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
112 .u.str = "Command not allowed - No information given",
113 }, {
114 0x6981, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
115 .u.str = "Command not allowed - Command incompatible with file structure",
116 }, {
117 0x6982, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
118 .u.str = "Command not allowed - Security status not satisfied",
119 }, {
120 0x6983, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
121 .u.str = "Command not allowed - Authentication/PIN method blocked",
122 }, {
123 0x6984, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
124 .u.str = "Command not allowed - Referenced data invalidated",
125 }, {
126 0x6985, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
127 .u.str = "Command not allowed - Conditions of use not satisfied",
128 }, {
129 0x6986, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
130 .u.str = "Command not allowed - Noe EF selected",
131 }, {
132 0x6989, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
133 .u.str = "Command not allowed - secure channel - security not satisfied",
134 }, {
135 0x6a80, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
136 .u.str = "Wrong parameters - Incorrect parameters in the data field",
137 }, {
138 0x6a81, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
139 .u.str = "Wrong parameters - Function not supported",
140 }, {
141 0x6a82, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
142 .u.str = "Wrong parameters - File not found",
143 }, {
144 0x6a83, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
145 .u.str = "Wrong parameters - Record not found",
146 }, {
147 0x6a84, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
148 .u.str = "Wrong parameters - Not enough memory space",
149 }, {
150 0x6a86, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
151 .u.str = "Wrong parameters - Incorrect parameters P1 to P2",
152 }, {
153 0x6a87, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
154 .u.str = "Wrong parameters - Lc inconsistent with P1 ot P2",
155 }, {
156 0x6a88, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
157 .u.str = "Wrong parameters - Referenced data not found",
158 }, {
159 0x9850, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
160 .u.str = "Application error - INCREASE cannot be performed, max value reached",
161 }, {
162 0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
163 .u.str = "Application error - Authentication error, application specific",
164 }, {
165 0x9863, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
166 .u.str = "Application error - Security session or association expired",
167 },
168 OSIM_CARD_SW_LAST
169};
170
171const struct value_string ts102221_fcp_vals[14] = {
172 { UICC_FCP_T_FCP, "File control parameters" },
173 { UICC_FCP_T_FILE_SIZE, "File size" },
174 { UICC_FCP_T_TOT_F_SIZE, "Total size of files" },
175 { UICC_FCP_T_FILE_DESC, "File descriptor" },
176 { UICC_FCP_T_FILE_ID, "File identifier" },
177 { UICC_FCP_T_DF_NAME, "DF name" },
178 { UICC_FCP_T_SFID, "Short file identifier" },
179 { UICC_FCP_T_LIFEC_STS, "Lifecycle status integer" },
180 { UICC_FCP_T_SEC_ATTR_REFEXP, "Security attributes (Referenced/Expanded)" },
181 { UICC_FCP_T_SEC_ATTR_COMP, "Security attributes (Compact)" },
182 { UICC_FCP_T_PROPRIETARY, "Proprietary" },
183 { UICC_FCP_T_SEC_ATTR_EXP, "Security attributes (Expanded)" },
184 { UICC_FCP_T_PIN_STS_DO, "PIN Status DO" },
185 { 0, NULL }
186};
187
188/* FIXME: Ber-TLV ?? */
189const struct tlv_definition ts102221_fcp_tlv_def = {
190 .def = {
191 [UICC_FCP_T_FCP] = { TLV_TYPE_TLV },
192 [UICC_FCP_T_FILE_SIZE] = { TLV_TYPE_TLV },
193 [UICC_FCP_T_TOT_F_SIZE] = { TLV_TYPE_TLV },
194 [UICC_FCP_T_FILE_DESC] = { TLV_TYPE_TLV },
195 [UICC_FCP_T_FILE_ID] = { TLV_TYPE_TLV },
196 [UICC_FCP_T_DF_NAME] = { TLV_TYPE_TLV },
197 [UICC_FCP_T_SFID] = { TLV_TYPE_TLV },
198 [UICC_FCP_T_LIFEC_STS] = { TLV_TYPE_TLV },
199 [UICC_FCP_T_SEC_ATTR_REFEXP] = { TLV_TYPE_TLV },
200 [UICC_FCP_T_SEC_ATTR_COMP] = { TLV_TYPE_TLV },
201 [UICC_FCP_T_PROPRIETARY] = { TLV_TYPE_TLV },
202 [UICC_FCP_T_SEC_ATTR_EXP] = { TLV_TYPE_TLV },
203 [UICC_FCP_T_PIN_STS_DO] = { TLV_TYPE_TLV },
204 },
205};
206
207/* Annex E - TS 101 220 */
Pau Espin Pedrol92274452017-06-17 23:27:47 +0200208static const uint8_t __attribute__((__unused__)) adf_uicc_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x01 };