From 39dc9c463c26490d9a2bbb7d9fe0bfb6e0a1bca2 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Tue, 25 Dec 2018 01:26:29 +0700 Subject: mobile/subscriber.c: consider GSM_SIM_TYPE_SAP too There are several SIM card interfaces, two of which: - GSM_SIM_TYPE_L1PHY (using built-in SIM reader of the L1 PHY), - GSM_SIM_TYPE_SAP (using remote reader via (BT)SAP protocol), can actually deal with a physical SIM card. But, for some reason, only GSM_SIM_TYPE_L1PHY was considered as such. Let's also get along with GSM_SIM_TYPE_SAP for the following procedures: - PIN management and verification, - FPLMN / LOCI updating, - A3 authentication. Change-Id: I4b3080fa7a5332467a449a314ba3cc3a07a9b7df --- src/host/layer23/src/mobile/subscriber.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/host/layer23/src/mobile') diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c index 097f7859..7f24d56f 100644 --- a/src/host/layer23/src/mobile/subscriber.c +++ b/src/host/layer23/src/mobile/subscriber.c @@ -711,7 +711,7 @@ void gsm_subscr_sim_pin(struct osmocom_ms *ms, char *pin1, char *pin2, uint8_t job; /* skip, if no real valid SIM */ - if (subscr->sim_type != GSM_SIM_TYPE_L1PHY) + if (!GSM_SIM_IS_READER(subscr->sim_type)) return; switch (mode) { @@ -790,7 +790,7 @@ static int subscr_write_plmn_na(struct osmocom_ms *ms) #endif /* skip, if no real valid SIM */ - if (subscr->sim_type != GSM_SIM_TYPE_L1PHY || !subscr->sim_valid) + if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) return 0; /* get tail list from "PLMN not allowed" */ @@ -844,7 +844,7 @@ int gsm_subscr_write_loci(struct osmocom_ms *ms) struct gsm1111_ef_loci *loci; /* skip, if no real valid SIM */ - if (subscr->sim_type != GSM_SIM_TYPE_L1PHY || !subscr->sim_valid) + if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid) return 0; LOGP(DMM, LOGL_INFO, "Updating LOCI on SIM\n"); @@ -907,8 +907,7 @@ int gsm_subscr_generate_kc(struct osmocom_ms *ms, uint8_t key_seq, struct sim_hdr *nsh; /* not a SIM */ - if ((subscr->sim_type != GSM_SIM_TYPE_L1PHY - && subscr->sim_type != GSM_SIM_TYPE_TEST) + if (!GSM_SIM_IS_READER(subscr->sim_type) || !subscr->sim_valid || no_sim) { struct gsm48_mm_event *nmme; -- cgit v1.2.3