diff options
author | Harald Welte <laforge@gnumonks.org> | 2017-12-23 19:30:32 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-01-28 00:09:42 +0000 |
commit | 7b222aa1062aae786c92ea649d945ae8d86bbba2 (patch) | |
tree | cd6429a67e8d31508ef7eb2b3201bf3524cd7208 /src/libmsc/gsm_04_08.c | |
parent | 71c51df07dfbc60cb41cb43385576a9d89c0c269 (diff) |
Permit a set of multiple different A5 ciphers
So far, the administrator had to pick one particular cipher which
would then be used throughout all subscribers/phones. This is a bit
impractical, as e.g. not all phones support A5/3. Extend the VTY
command syntax in a backwards-compatible way to permit for multiple
ciphers.
NOTE: Like the previous code, OsmoMSC does *not yet check* whether
the configured cipher is compatible with the MS capabilities as
reported in CLASSMARK! The network hence might choose an algorithm
not supported by the phone. Fixing this is subject to another patch.
Closes: OS#2460
Change-Id: I79a4e2892eb5fbecc3d84e11dceffb7149db264b
Diffstat (limited to 'src/libmsc/gsm_04_08.c')
-rw-r--r-- | src/libmsc/gsm_04_08.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libmsc/gsm_04_08.c b/src/libmsc/gsm_04_08.c index c37aeb758..3574583a6 100644 --- a/src/libmsc/gsm_04_08.c +++ b/src/libmsc/gsm_04_08.c @@ -339,7 +339,7 @@ int mm_rx_loc_upd_req(struct gsm_subscriber_connection *conn, struct msgb *msg) net->vlr, conn, vlr_lu_type, tmsi, imsi, &old_lai, &new_lai, is_utran || conn->network->authentication_required, - is_utran || conn->network->a5_encryption, + is_utran || conn->network->a5_encryption_mask > 0x01, classmark_is_r99(&conn->classmark), is_utran, net->vlr->cfg.assign_tmsi); @@ -723,7 +723,7 @@ int gsm48_rx_mm_serv_req(struct gsm_subscriber_connection *conn, struct msgb *ms net->vlr, conn, VLR_PR_ARQ_T_CM_SERV_REQ, mi-1, &lai, is_utran || conn->network->authentication_required, - is_utran || conn->network->a5_encryption, + is_utran || conn->network->a5_encryption_mask > 0x01, classmark_is_r99(&conn->classmark), is_utran); @@ -1127,7 +1127,7 @@ static int gsm48_rx_rr_pag_resp(struct gsm_subscriber_connection *conn, struct m net->vlr, conn, VLR_PR_ARQ_T_PAGING_RESP, mi_lv, &lai, is_utran || conn->network->authentication_required, - is_utran || conn->network->a5_encryption, + is_utran || conn->network->a5_encryption_mask > 0x01, classmark_is_r99(&conn->classmark), is_utran); @@ -3447,10 +3447,15 @@ static int msc_vlr_set_ciph_mode(void *msc_conn_ref, DEBUGP(DMM, "-> CIPHER MODE COMMAND %s\n", vlr_subscr_name(conn->vsub)); { + struct gsm_network *net = conn->network; struct gsm0808_encrypt_info ei; + int i, j = 0; - ei.perm_algo[0] = vlr_ciph_to_gsm0808_alg_id(conn->network->a5_encryption); - ei.perm_algo_len = 1; + for (i = 0; i < 8; i++) { + if (net->a5_encryption_mask & (1 << i)) + ei.perm_algo[j++] = vlr_ciph_to_gsm0808_alg_id(i); + } + ei.perm_algo_len = j; /* In case of UMTS AKA, the Kc for ciphering must be derived from the 3G auth * tokens. tuple->vec.kc was calculated from the GSM algorithm and is not |