blob: 1073429bfeb4570befee9501231937b0bea8f9ba [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file card_fs_isim.c
2 * 3GPP ISIM specific structures / routines. */
Harald Welte171c5b12014-05-04 14:09:35 +02003/*
4 * (C) 2014 by Harald Welte <laforge@gnumonks.org>
5 *
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 *
22 */
23
24
25#include <errno.h>
26#include <string.h>
27
28#include <osmocom/sim/sim.h>
29#include <osmocom/core/talloc.h>
30#include <osmocom/gsm/gsm48.h>
31
32#include "sim_int.h"
33#include "gsm_int.h"
34
35/* TS 31.103 Version 11.2.0 Release 11 / Chapoter 7.1.3 */
36const struct osim_card_sw ts31_103_sw[] = {
37 {
38 0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
39 .u.str = "Security management - Authentication error, incorrect MAC",
40 },
41 OSIM_CARD_SW_LAST
42};
43
44static const struct osim_card_sw *isim_card_sws[] = {
45 ts31_103_sw,
46 ts102221_uicc_sw,
47 NULL
48};
49
Harald Welte171c5b12014-05-04 14:09:35 +020050/* TS 31.103 Version 11.2.0 Release 11 / Chapoter 4.2 */
51static const struct osim_file_desc isim_ef_in_adf_isim[] = {
52 EF_TRANSP_N(0x6F02, 0x02, "EF.IMPI", 0, 1, 256,
53 "IMS private user identity"),
54 EF_TRANSP_N(0x6F03, 0x05, "EF.DOMAIN", 0, 1, 256,
55 "Home Network Domain Name"),
56 EF_LIN_FIX_N(0x6F04, 0x04, "EF.IMPU", 0, 1, 256,
57 "IMS public user identity"),
58 EF_TRANSP_N(0x6FAD, 0x03, "EF.AD", 0, 4, 16,
59 "Administrative Data"),
60 EF_LIN_FIX_N(0x6F06, 0x06, "EF.ARR", 0, 1, 256,
61 "Access Rule TLV data objects"),
62 EF_TRANSP_N(0x6F07, 0x07, "EF.IST", F_OPTIONAL, 1, 16,
63 "ISIM Service Table"),
64 EF_LIN_FIX_N(0x6F09, SFI_NONE, "EF.P-CSCF", F_OPTIONAL, 1, 256,
65 "P-CSCF Address"),
66 EF_TRANSP_N(0x6FD5, SFI_NONE, "EF.GBABP", F_OPTIONAL, 1, 35,
67 "GBA Bootstrapping parameters"),
68 EF_LIN_FIX_N(0x6FD7, SFI_NONE, "EF.GBANL", F_OPTIONAL, 1, 256,
69 "NAF Key Identifier TLV Objects"),
70 EF_LIN_FIX_N(0x6FDD, SFI_NONE, "EF.NAFKCA", F_OPTIONAL, 1, 256,
71 "NAF Key Centre Address"),
72 EF_LIN_FIX_N(0x6F3C, SFI_NONE, "EF.SMS", F_OPTIONAL, 176, 176,
73 "Short messages"),
74 EF_TRANSP_N(0x6F43, SFI_NONE, "EF.SMSS", F_OPTIONAL, 2, 4,
75 "SMS status"),
76 EF_LIN_FIX_N(0x6F47, SFI_NONE, "EF.SMSR", F_OPTIONAL, 30, 30,
77 "Short message status reports"),
78 EF_LIN_FIX_N(0x6F42, SFI_NONE, "EF.SMSP", F_OPTIONAL, 29, 64,
79 "Short message service parameters"),
80 EF_LIN_FIX_N(0x6FE7, SFI_NONE, "EF.UICCIARI", F_OPTIONAL, 1, 256,
81 "UICC IARI"),
82};
83
84/* Annex E - TS 101 220 */
85static const uint8_t adf_isim_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x04 };
86
87struct osim_card_profile *osim_cprof_isim(void *ctx)
88{
89 struct osim_card_profile *cprof;
90 struct osim_file_desc *mf;
91
92 cprof = talloc_zero(ctx, struct osim_card_profile);
93 cprof->name = "3GPP ISIM";
94 cprof->sws = isim_card_sws;
95
96 mf = alloc_df(cprof, 0x3f00, "MF");
97
98 cprof->mf = mf;
99
100 /* ADF.USIM with its EF siblings */
101 add_adf_with_ef(mf, adf_isim_aid, sizeof(adf_isim_aid),
102 "ADF.ISIM", isim_ef_in_adf_isim,
103 ARRAY_SIZE(isim_ef_in_adf_isim));
104
105 return cprof;
106}