blob: 1a38da2fbf8ade7b76086e472483bd45175cd2a4 [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/*
Harald Weltee92f3622020-03-21 14:07:06 +01004 * (C) 2014-2020 by Harald Welte <laforge@gnumonks.org>
Harald Welte171c5b12014-05-04 14:09:35 +02005 *
6 * All Rights Reserved
7 *
Harald Weltee08da972017-11-13 01:00:26 +09008 * SPDX-License-Identifier: GPL-2.0+
9 *
Harald Welte171c5b12014-05-04 14:09:35 +020010 * 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 *
Harald Welte171c5b12014-05-04 14:09:35 +020020 */
21
22
23#include <errno.h>
24#include <string.h>
25
26#include <osmocom/sim/sim.h>
27#include <osmocom/core/talloc.h>
28#include <osmocom/gsm/gsm48.h>
29
30#include "sim_int.h"
31#include "gsm_int.h"
32
Harald Weltee92f3622020-03-21 14:07:06 +010033/* TS 31.103 Version 15.5.0 Release 15 / Chapter 7.1.3 */
Harald Welte171c5b12014-05-04 14:09:35 +020034const struct osim_card_sw ts31_103_sw[] = {
35 {
36 0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
37 .u.str = "Security management - Authentication error, incorrect MAC",
Harald Weltee92f3622020-03-21 14:07:06 +010038 }, {
39 0x9864, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
40 .u.str = "Security management - Authentication error, security context not supported",
Harald Welte171c5b12014-05-04 14:09:35 +020041 },
42 OSIM_CARD_SW_LAST
43};
44
Harald Weltee92f3622020-03-21 14:07:06 +010045/* TS 31.103 Version 15.5.0 Release 15 / Chapter 4.2 */
Harald Welte171c5b12014-05-04 14:09:35 +020046static const struct osim_file_desc isim_ef_in_adf_isim[] = {
47 EF_TRANSP_N(0x6F02, 0x02, "EF.IMPI", 0, 1, 256,
48 "IMS private user identity"),
49 EF_TRANSP_N(0x6F03, 0x05, "EF.DOMAIN", 0, 1, 256,
50 "Home Network Domain Name"),
51 EF_LIN_FIX_N(0x6F04, 0x04, "EF.IMPU", 0, 1, 256,
52 "IMS public user identity"),
53 EF_TRANSP_N(0x6FAD, 0x03, "EF.AD", 0, 4, 16,
54 "Administrative Data"),
55 EF_LIN_FIX_N(0x6F06, 0x06, "EF.ARR", 0, 1, 256,
56 "Access Rule TLV data objects"),
57 EF_TRANSP_N(0x6F07, 0x07, "EF.IST", F_OPTIONAL, 1, 16,
58 "ISIM Service Table"),
59 EF_LIN_FIX_N(0x6F09, SFI_NONE, "EF.P-CSCF", F_OPTIONAL, 1, 256,
60 "P-CSCF Address"),
61 EF_TRANSP_N(0x6FD5, SFI_NONE, "EF.GBABP", F_OPTIONAL, 1, 35,
62 "GBA Bootstrapping parameters"),
63 EF_LIN_FIX_N(0x6FD7, SFI_NONE, "EF.GBANL", F_OPTIONAL, 1, 256,
64 "NAF Key Identifier TLV Objects"),
65 EF_LIN_FIX_N(0x6FDD, SFI_NONE, "EF.NAFKCA", F_OPTIONAL, 1, 256,
66 "NAF Key Centre Address"),
67 EF_LIN_FIX_N(0x6F3C, SFI_NONE, "EF.SMS", F_OPTIONAL, 176, 176,
68 "Short messages"),
69 EF_TRANSP_N(0x6F43, SFI_NONE, "EF.SMSS", F_OPTIONAL, 2, 4,
70 "SMS status"),
71 EF_LIN_FIX_N(0x6F47, SFI_NONE, "EF.SMSR", F_OPTIONAL, 30, 30,
72 "Short message status reports"),
73 EF_LIN_FIX_N(0x6F42, SFI_NONE, "EF.SMSP", F_OPTIONAL, 29, 64,
74 "Short message service parameters"),
75 EF_LIN_FIX_N(0x6FE7, SFI_NONE, "EF.UICCIARI", F_OPTIONAL, 1, 256,
76 "UICC IARI"),
Harald Weltee92f3622020-03-21 14:07:06 +010077 EF_TRANSP_N(0x6FF7, SFI_NONE, "EF_FromPreferred", F_OPTIONAL, 1, 1,
78 "From Preferred"),
79 EF_TRANSP_N(0x6FF8, SFI_NONE, "EF_IMSConfigData", F_OPTIONAL, 3, 128,
80 "IMS Configuration Data"),
81 EF_TRANSP_N(0x6FFC, SFI_NONE, "EF_XCAPConfigData", F_OPTIONAL, 1, 128,
82 "XCAP Configuration Data"),
83 EF_LIN_FIX_N(0x6FFA, SFI_NONE, "EF_WebRTCURI", F_OPTIONAL, 3, 128,
84 "WebRTC URI"),
Harald Welte171c5b12014-05-04 14:09:35 +020085};
86
87/* Annex E - TS 101 220 */
88static const uint8_t adf_isim_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x04 };
89
Harald Welte429adec2020-03-20 13:05:40 +010090struct osim_card_app_profile *osim_aprof_isim(void *ctx)
Harald Welte171c5b12014-05-04 14:09:35 +020091{
Harald Welte429adec2020-03-20 13:05:40 +010092 struct osim_card_app_profile *aprof;
93 struct osim_file_desc *iadf;
Harald Welte171c5b12014-05-04 14:09:35 +020094
Harald Welte429adec2020-03-20 13:05:40 +010095 aprof = talloc_zero(ctx, struct osim_card_app_profile);
96 aprof->name = "3GPP ISIM";
97 aprof->sw = ts31_103_sw;
98 aprof->aid_len = sizeof(adf_isim_aid);
99 memcpy(aprof->aid, adf_isim_aid, aprof->aid_len);
Harald Welte171c5b12014-05-04 14:09:35 +0200100
101 /* ADF.USIM with its EF siblings */
Harald Welte429adec2020-03-20 13:05:40 +0100102 iadf = alloc_adf_with_ef(aprof, adf_isim_aid, sizeof(adf_isim_aid), "ADF.ISIM",
103 isim_ef_in_adf_isim, ARRAY_SIZE(isim_ef_in_adf_isim));
104 aprof->adf = iadf;
Harald Welte171c5b12014-05-04 14:09:35 +0200105
Harald Welte429adec2020-03-20 13:05:40 +0100106 return aprof;
Harald Welte171c5b12014-05-04 14:09:35 +0200107}