summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2018-12-25 01:26:29 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2018-12-26 20:52:18 +0000
commit39dc9c463c26490d9a2bbb7d9fe0bfb6e0a1bca2 (patch)
tree01c6f3d8baf2f7fdc6c99095466c0c0fb4dd75b9 /src
parente11725aa868c8093288d0e1985854e15c7cb46e9 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/host/layer23/include/osmocom/bb/mobile/subscriber.h3
-rw-r--r--src/host/layer23/src/mobile/subscriber.c9
2 files changed, 7 insertions, 5 deletions
diff --git a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
index 958700a..c747af9 100644
--- a/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
+++ b/src/host/layer23/include/osmocom/bb/mobile/subscriber.h
@@ -20,6 +20,9 @@ struct gsm_sub_plmn_na {
#define GSM_IMSI_LENGTH 16
+#define GSM_SIM_IS_READER(type) \
+ (type == GSM_SIM_TYPE_L1PHY || type == GSM_SIM_TYPE_SAP)
+
enum {
GSM_SIM_TYPE_NONE = 0,
GSM_SIM_TYPE_L1PHY,
diff --git a/src/host/layer23/src/mobile/subscriber.c b/src/host/layer23/src/mobile/subscriber.c
index 097f785..7f24d56 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;