Change in libosmocore[master]: sim: Add HPSIM application support

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat Mar 21 13:17:13 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/17558 )


Change subject: sim: Add HPSIM application support
......................................................................

sim: Add HPSIM application support

Change-Id: I883faae5e170803b8301d10c8b9fad7892da009c
---
M src/sim/Makefile.am
A src/sim/card_fs_hpsim.c
M src/sim/core.c
M src/sim/sim_int.h
4 files changed, 79 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/58/17558/1

diff --git a/src/sim/Makefile.am b/src/sim/Makefile.am
index 14bbbd8..0539dd9 100644
--- a/src/sim/Makefile.am
+++ b/src/sim/Makefile.am
@@ -14,7 +14,7 @@
 
 libosmosim_la_SOURCES = core.c reader.c class_tables.c \
 			card_fs_sim.c card_fs_usim.c card_fs_uicc.c \
-			card_fs_isim.c card_fs_tetra.c
+			card_fs_isim.c card_fs_hpsim.c card_fs_tetra.c
 libosmosim_la_LDFLAGS = -version-info $(LIBVERSION)
 libosmosim_la_LIBADD = \
 	$(top_builddir)/src/libosmocore.la \
diff --git a/src/sim/card_fs_hpsim.c b/src/sim/card_fs_hpsim.c
new file mode 100644
index 0000000..4a5f7d9
--- /dev/null
+++ b/src/sim/card_fs_hpsim.c
@@ -0,0 +1,76 @@
+/*! \file card_fs_hpsim.c
+ * 3GPP HPSIM specific structures / routines. */
+/*
+ * (C) 2020 by Harald Welte <laforge at gnumonks.org>
+ *
+ * All Rights Reserved
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+
+#include <errno.h>
+#include <string.h>
+
+#include <osmocom/sim/sim.h>
+#include <osmocom/core/talloc.h>
+#include <osmocom/gsm/gsm48.h>
+
+#include "sim_int.h"
+#include "gsm_int.h"
+
+/* TS 31.104 Version 15.0.0 Release 15 / Chapter 7.1.3 */
+const struct osim_card_sw ts31_104_sw[] = {
+	{
+		0x9862, 0xffff, SW_TYPE_STR, SW_CLS_ERROR,
+		.u.str = "Security management - Authentication error, incorrect MAC",
+	},
+	OSIM_CARD_SW_LAST
+};
+
+/* TS 31.104 Version 15.0.0 Release 15 / Chapter 4.2 */
+static const struct osim_file_desc hpsim_ef_in_adf_hpsim[] = {
+	EF_LIN_FIX_N(0x6F06, 0x06, "EF.ARR", 0, 1, 256,
+		"Access Rule TLV data objects"),
+	EF_TRANSP_N(0x6F07, 0x07, "EF.IMST", 0, 9, 9,
+		"IMSI"),
+	EF_TRANSP_N(0x6FAD, 0x03, "EF_AD", 0, 4, 8,
+		"Administrative Data"),
+};
+
+/* Annex E - TS 101 220 */
+static const uint8_t adf_hpsim_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x0A };
+
+struct osim_card_app_profile *osim_aprof_hpsim(void *ctx)
+{
+	struct osim_card_app_profile *aprof;
+	struct osim_file_desc *iadf;
+
+	aprof = talloc_zero(ctx, struct osim_card_app_profile);
+	aprof->name = "3GPP HPSIM";
+	aprof->sw = ts31_104_sw;
+	aprof->aid_len = sizeof(adf_hpsim_aid);
+	memcpy(aprof->aid, adf_hpsim_aid, aprof->aid_len);
+
+	/* ADF.HPSIM with its EF siblings */
+	iadf = alloc_adf_with_ef(aprof, adf_hpsim_aid, sizeof(adf_hpsim_aid), "ADF.HPSIM",
+				 hpsim_ef_in_adf_hpsim, ARRAY_SIZE(hpsim_ef_in_adf_hpsim));
+	aprof->adf = iadf;
+
+	return aprof;
+}
diff --git a/src/sim/core.c b/src/sim/core.c
index 80a168f..8b2d6f9 100644
--- a/src/sim/core.c
+++ b/src/sim/core.c
@@ -453,6 +453,7 @@
 {
 	osim_app_profile_register(osim_aprof_usim(ctx));
 	osim_app_profile_register(osim_aprof_isim(ctx));
+	osim_app_profile_register(osim_aprof_hpsim(ctx));
 
 	return 0;
 }
diff --git a/src/sim/sim_int.h b/src/sim/sim_int.h
index 99a2242..a96a9cd 100644
--- a/src/sim/sim_int.h
+++ b/src/sim/sim_int.h
@@ -33,5 +33,6 @@
 
 struct osim_card_app_profile *osim_aprof_usim(void *ctx);
 struct osim_card_app_profile *osim_aprof_isim(void *ctx);
+struct osim_card_app_profile *osim_aprof_hpsim(void *ctx);
 
 #endif

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/17558
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I883faae5e170803b8301d10c8b9fad7892da009c
Gerrit-Change-Number: 17558
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200321/db626063/attachment.htm>


More information about the gerrit-log mailing list