aboutsummaryrefslogtreecommitdiffstats
path: root/src/sim/card_fs_isim.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-03-20 13:05:40 +0100
committerHarald Welte <laforge@osmocom.org>2020-03-21 16:31:17 +0100
commit429adecfd8e817b1d3d4eb9590ee0e351696bad9 (patch)
treeffbae2a5fcd1ee02fe07e23691fea59fe2e8331d /src/sim/card_fs_isim.c
parentbf90d747ad678fd301831b299c12f9de332341f9 (diff)
sim: re-structure how we support cards + applications
Before this change, a card application (USIM, ISIM, ...) didn't exist as a separate concept from a card profile. This meant, we had a manual combination of UICC card profile with USIM application, and another one of UICC card profile and ISIM application. But what if there's a combined USIM+ISIM? In reality, applications exist as separate objects, on top of an ETSI UICC. Lets therefore register all known applications to the osim library core, and add code to osmo-sim-test which dynamically detects all applications present on a given card (by reading EF.DIR). Change-Id: Ic4b4ac433a9976842b30a017fb0fc347d87201cd
Diffstat (limited to 'src/sim/card_fs_isim.c')
-rw-r--r--src/sim/card_fs_isim.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/sim/card_fs_isim.c b/src/sim/card_fs_isim.c
index e6ba0d09..2970c45e 100644
--- a/src/sim/card_fs_isim.c
+++ b/src/sim/card_fs_isim.c
@@ -43,12 +43,6 @@ const struct osim_card_sw ts31_103_sw[] = {
OSIM_CARD_SW_LAST
};
-static const struct osim_card_sw *isim_card_sws[] = {
- ts31_103_sw,
- ts102221_uicc_sw,
- NULL
-};
-
/* TS 31.103 Version 11.2.0 Release 11 / Chapoter 4.2 */
static const struct osim_file_desc isim_ef_in_adf_isim[] = {
EF_TRANSP_N(0x6F02, 0x02, "EF.IMPI", 0, 1, 256,
@@ -86,23 +80,21 @@ static const struct osim_file_desc isim_ef_in_adf_isim[] = {
/* Annex E - TS 101 220 */
static const uint8_t adf_isim_aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x87, 0x10, 0x04 };
-struct osim_card_profile *osim_cprof_isim(void *ctx)
+struct osim_card_app_profile *osim_aprof_isim(void *ctx)
{
- struct osim_card_profile *cprof;
- struct osim_file_desc *mf;
-
- cprof = talloc_zero(ctx, struct osim_card_profile);
- cprof->name = "3GPP ISIM";
- cprof->sws = isim_card_sws;
-
- mf = alloc_df(cprof, 0x3f00, "MF");
+ struct osim_card_app_profile *aprof;
+ struct osim_file_desc *iadf;
- cprof->mf = mf;
+ aprof = talloc_zero(ctx, struct osim_card_app_profile);
+ aprof->name = "3GPP ISIM";
+ aprof->sw = ts31_103_sw;
+ aprof->aid_len = sizeof(adf_isim_aid);
+ memcpy(aprof->aid, adf_isim_aid, aprof->aid_len);
/* ADF.USIM with its EF siblings */
- add_adf_with_ef(mf, adf_isim_aid, sizeof(adf_isim_aid),
- "ADF.ISIM", isim_ef_in_adf_isim,
- ARRAY_SIZE(isim_ef_in_adf_isim));
+ iadf = alloc_adf_with_ef(aprof, adf_isim_aid, sizeof(adf_isim_aid), "ADF.ISIM",
+ isim_ef_in_adf_isim, ARRAY_SIZE(isim_ef_in_adf_isim));
+ aprof->adf = iadf;
- return cprof;
+ return aprof;
}