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