aboutsummaryrefslogtreecommitdiffstats
path: root/src/sim/card_fs_uicc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/card_fs_uicc.c')
-rw-r--r--src/sim/card_fs_uicc.c185
1 files changed, 185 insertions, 0 deletions
diff --git a/src/sim/card_fs_uicc.c b/src/sim/card_fs_uicc.c
new file mode 100644
index 00000000..03dbad32
--- /dev/null
+++ b/src/sim/card_fs_uicc.c
@@ -0,0 +1,185 @@
+#include <osmocom/sim/sim.h>
+#include <osmocom/gsm/tlv.h>
+
+/* TS 102 221 V10.0.0 / 10.2.1 */
+const struct osim_card_sw ts102221_uicc_sw[] = {
+ {
+ 0x9000, 0xffff, SW_TYPE_STR, SW_CLS_OK,
+ .u.str = "Normal ending of the command",
+ }, {
+ 0x9100, 0xff00, SW_TYPE_STR, SW_CLS_OK,
+ .u.str = "Normal ending of the command, extra info proactive",
+ }, {
+ 0x9200, 0xff00, SW_TYPE_STR, SW_CLS_OK,
+ .u.str = "Normal ending of the command, extra info regarding transfer session",
+ }, {
+ 0x9300, 0xff00, SW_TYPE_STR, SW_CLS_POSTP,
+ .u.str = "SIM Application Toolkit is busy, command cannot be executed at present",
+ }, {
+ 0x6200, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "No information given, state of non volatile memory unchanged",
+ }, {
+ 0x6281, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "Part of returned data may be corrupted",
+ }, {
+ 0x6282, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "End of file/record reached before reading Le bytes",
+ }, {
+ 0x6283, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "Selected file invalidated",
+ }, {
+ 0x6285, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "Selected file in termination state",
+ }, {
+ 0x62f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "More data available",
+ }, {
+ 0x62f2, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "More data available and proactive command pending",
+ }, {
+ 0x62f3, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "Response data available",
+ }, {
+ 0x63f1, 0xffff, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "More data expected",
+ }, {
+ 0x63c0, 0xfff0, SW_TYPE_STR, SW_CLS_WARN,
+ .u.str = "Verification falied, X retries remaining",
+ }, {
+ 0x6400, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Execution - No information given, state of non-volatile memory unchanged",
+ }, {
+ 0x6500, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Execution - No information given, state of non-volatile memory changed",
+ }, {
+ 0x6581, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Execution - Memory problem",
+ }, {
+ 0x6700, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Wrong length",
+ }, {
+ 0x6700, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Command dependent error",
+ }, {
+ 0x6b00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Wrong parameter(s) P1-P2",
+ }, {
+ 0x6d00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Instruction code not supported or valid",
+ }, {
+ 0x6e00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Class not supported",
+ }, {
+ 0x6f00, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Technical problem, no precise diagnostics",
+ }, {
+ 0x6f00, 0xff00, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Checking - Command dependent error",
+ }, {
+ 0x6800, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Function in CLA not supported - No information given",
+ }, {
+ 0x6881, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Function in CLA not supported - Logical channel not supported",
+ }, {
+ 0x6882, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Function in CLA not supportied - Secure messaging not supported",
+ }, {
+ 0x6900, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - No information given",
+ }, {
+ 0x6981, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Command incompatible with file structure",
+ }, {
+ 0x6982, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Security status not satisfied",
+ }, {
+ 0x6983, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Authentication/PIN method blocked",
+ }, {
+ 0x6984, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Referenced data invalidated",
+ }, {
+ 0x6985, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Conditions of use not satisfied",
+ }, {
+ 0x6986, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - Noe EF selected",
+ }, {
+ 0x6989, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Command not allowed - secure channel - security not satisfied",
+ }, {
+ 0x6a80, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Incorrect parameters in the data field",
+ }, {
+ 0x6a81, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Function not supported",
+ }, {
+ 0x6a82, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - File not found",
+ }, {
+ 0x6a83, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Record not found",
+ }, {
+ 0x6a84, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Not enough memory space",
+ }, {
+ 0x6a86, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Incorrect parameters P1 to P2",
+ }, {
+ 0x6a87, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Lc inconsistent with P1 ot P2",
+ }, {
+ 0x6a88, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Wrong parameters - Referenced data not found",
+ }, {
+ 0x9850, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Application error - INCREASE cannot be performed, max value reached",
+ }, {
+ 0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Application error - Authentication error, application specific",
+ }, {
+ 0x9863, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+ .u.str = "Application error - Security session or association expired",
+ },
+ OSIM_CARD_SW_LAST
+};
+
+const struct value_string ts102221_fcp_vals[14] = {
+ { UICC_FCP_T_FCP, "File control parameters" },
+ { UICC_FCP_T_FILE_SIZE, "File size" },
+ { UICC_FCP_T_TOT_F_SIZE, "Total size of files" },
+ { UICC_FCP_T_FILE_DESC, "File descriptor" },
+ { UICC_FCP_T_FILE_ID, "File identifier" },
+ { UICC_FCP_T_DF_NAME, "DF name" },
+ { UICC_FCP_T_SFID, "Short file identifier" },
+ { UICC_FCP_T_LIFEC_STS, "Lifecycle status integer" },
+ { UICC_FCP_T_SEC_ATTR_REFEXP, "Security attributes (Referenced/Expanded)" },
+ { UICC_FCP_T_SEC_ATTR_COMP, "Security attributes (Compact)" },
+ { UICC_FCP_T_PROPRIETARY, "Proprietary" },
+ { UICC_FCP_T_SEC_ATTR_EXP, "Security attributes (Expanded)" },
+ { UICC_FCP_T_PIN_STS_DO, "PIN Status DO" },
+ { 0, NULL }
+};
+
+/* FIXME: Ber-TLV ?? */
+const struct tlv_definition ts102221_fcp_tlv_def = {
+ .def = {
+ [UICC_FCP_T_FCP] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_FILE_SIZE] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_TOT_F_SIZE] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_FILE_DESC] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_FILE_ID] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_DF_NAME] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_SFID] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_LIFEC_STS] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_SEC_ATTR_REFEXP] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_SEC_ATTR_COMP] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_PROPRIETARY] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_SEC_ATTR_EXP] = { TLV_TYPE_TLV },
+ [UICC_FCP_T_PIN_STS_DO] = { TLV_TYPE_TLV },
+ },
+};
+
+/* Annex E - TS 101 220 */
+static const uint8_t adf_uicc_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x01 };